Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
students
Today KU
Commits
74f07500
"vscode:/vscode.git/clone" did not exist on "75b9c5fab0c817af4bcbe7806026e941626a940a"
Commit
74f07500
authored
Nov 12, 2021
by
Kim, Subin
Browse files
Merge branch 'kimpen'
parents
c0d95ac8
b95f3381
Changes
20
Hide whitespace changes
Inline
Side-by-side
client/src/components/Calendar/AdminMonthly.js
View file @
74f07500
...
...
@@ -134,8 +134,10 @@ const AdminMonthly = () => {
timeZone
=
"
local
"
events
=
{
scheduleList
}
eventLimit
=
{
3
}
moreLinkContent
=
{
function
(
arg
)
{
return
arg
.
shortText
moreLinkContent
=
{
arg
=>
arg
.
shortText
}
moreLinkClick
=
{
info
=>
{
setDateShow
({
...
dateShow
,
date
:
moment
(
info
.
date
).
format
(
'
YYYY-MM-DD
'
),
show
:
true
})
return
<
button
type
=
"
button
"
className
=
"
btn btn-primary
"
data
-
bs
-
toggle
=
"
modal
"
data
-
bs
-
target
=
"
#scheduleModal
"
><
/button
>
}}
themeSystem
=
'
bootstrap
'
height
=
'
78vh
'
...
...
client/src/components/Calendar/DateSet.js
View file @
74f07500
...
...
@@ -8,7 +8,7 @@ const DateSet = ({ index, info, today, handleClick }) => {
<
div
className
=
"
col d-flex flex-column text-center
"
onClick
=
{()
=>
handleClick
(
info
.
date
)}
>
<
span
className
=
"
text-center
"
>
{
week
[
index
]}
<
/span
>
<
span
className
=
{
today
?
`rounded-circle
${
styles
.
today
}
`
:
""
}
>
{
moment
(
info
.
date
).
format
(
"
DD
"
)}
<
/span
>
<
span
className
=
"
text-secondary
"
>
{
info
.
rate
?
info
.
rate
+
"
%
"
:
null
}
<
/span
>
<
span
className
=
"
text-secondary
"
>
{
info
.
rate
!==
""
?
info
.
rate
+
"
%
"
:
null
}
<
/span
>
<
/div
>
)
}
...
...
client/src/components/Calendar/Monthly.js
View file @
74f07500
...
...
@@ -126,12 +126,8 @@ const Monthly = () => {
timeZone
=
"
local
"
themeSystem
=
'
bootstrap
'
eventLimit
=
{
3
}
moreLinkClick
=
{
function
(
arg
)
{
console
.
log
(
"
click..?
"
,
arg
)
}}
moreLinkContent
=
{
function
(
arg
)
{
return
arg
.
shortText
}}
moreLinkContent
=
{
arg
=>
arg
.
shortText
}
moreLinkClick
=
{
info
=>
history
.
push
(
`/schedule/
${
moment
(
info
.
date
).
format
(
'
YYYY-MM-DD
'
)}
`
)}
height
=
'
80vh
'
/>
<
DatePickerModal
initialDate
=
{
initialDate
}
changeDate
=
{
changeDate
}
setChangeDate
=
{
setChangeDate
}
show
=
{
show
}
setShow
=
{
setShow
}
/
>
...
...
client/src/components/Calendar/Weekly.js
View file @
74f07500
...
...
@@ -16,43 +16,41 @@ const Weekly = () => {
const
[
initialDate
,
setInitialDate
]
=
useState
(
moment
().
format
(
"
YYYY-MM-DD
"
))
const
[
chooseDate
,
setChooseDate
]
=
useState
(
moment
(
date
).
format
(
"
YYYY-MM-DD
"
))
const
[
week
,
setWeek
]
=
useState
([
{
date
:
moment
(
date
).
day
(
0
).
format
(
"
YYYY-MM-DD
"
),
rate
:
"
75
"
},
{
date
:
moment
(
date
).
day
(
1
).
format
(
"
YYYY-MM-DD
"
),
rate
:
"
85
"
},
{
date
:
moment
(
date
).
day
(
2
).
format
(
"
YYYY-MM-DD
"
),
rate
:
"
40
"
},
{
date
:
moment
(
date
).
day
(
3
).
format
(
"
YYYY-MM-DD
"
),
rate
:
"
100
"
},
{
date
:
moment
(
date
).
day
(
0
).
format
(
"
YYYY-MM-DD
"
),
rate
:
""
},
{
date
:
moment
(
date
).
day
(
1
).
format
(
"
YYYY-MM-DD
"
),
rate
:
""
},
{
date
:
moment
(
date
).
day
(
2
).
format
(
"
YYYY-MM-DD
"
),
rate
:
""
},
{
date
:
moment
(
date
).
day
(
3
).
format
(
"
YYYY-MM-DD
"
),
rate
:
""
},
{
date
:
moment
(
date
).
day
(
4
).
format
(
"
YYYY-MM-DD
"
),
rate
:
""
},
{
date
:
moment
(
date
).
day
(
5
).
format
(
"
YYYY-MM-DD
"
),
rate
:
"
0
"
},
{
date
:
moment
(
date
).
day
(
5
).
format
(
"
YYYY-MM-DD
"
),
rate
:
""
},
{
date
:
moment
(
date
).
day
(
6
).
format
(
"
YYYY-MM-DD
"
),
rate
:
""
}
])
const
[
error
,
setError
]
=
useState
(
""
)
const
calendarRef
=
useRef
(
null
)
let
calendar
=
null
useEffect
(()
=>
{
if
(
calendarRef
&&
calendarRef
.
current
)
{
calendar
=
calendarRef
.
current
.
getApi
()
}
})
useEffect
(()
=>
{
setChooseDate
(
moment
(
date
).
format
(
"
YYYY-MM-DD
"
))
getTodoList
()
setWeek
([
{
date
:
moment
(
date
).
day
(
0
).
format
(
"
YYYY-MM-DD
"
),
rate
:
"
7
"
},
{
date
:
moment
(
date
).
day
(
1
).
format
(
"
YYYY-MM-DD
"
),
rate
:
"
8
"
},
{
date
:
moment
(
date
).
day
(
2
).
format
(
"
YYYY-MM-DD
"
),
rate
:
"
4
"
},
{
date
:
moment
(
date
).
day
(
3
).
format
(
"
YYYY-MM-DD
"
),
rate
:
"
100
"
},
{
date
:
moment
(
date
).
day
(
4
).
format
(
"
YYYY-MM-DD
"
),
rate
:
""
},
{
date
:
moment
(
date
).
day
(
5
).
format
(
"
YYYY-MM-DD
"
),
rate
:
"
0
"
},
{
date
:
moment
(
date
).
day
(
6
).
format
(
"
YYYY-MM-DD
"
),
rate
:
""
}
])
setChooseDate
(
date
)
getTodoList
(
date
)
},
[
date
])
async
function
getTodoList
()
{
async
function
getTodoList
(
date
)
{
try
{
setError
(
""
)
let
weekArr
=
[]
const
result
=
await
todoApi
.
getTodopercent
(
user
.
id
,
moment
(
date
).
day
(
0
).
format
(
"
YYYY-MM-DD
"
),
moment
(
date
).
day
(
6
).
format
(
"
YYYY-MM-DD
"
))
console
.
log
(
"
result==
"
,
result
)
for
(
let
i
=
0
;
i
<
7
;
i
++
)
{
const
generateDate
=
moment
(
date
).
day
(
i
).
format
(
"
YYYY-MM-DD
"
)
const
find
=
result
.
find
(
el
=>
el
.
date
===
generateDate
)
if
(
find
)
weekArr
[
i
]
=
find
else
weekArr
[
i
]
=
{
date
:
generateDate
,
rate
:
""
}
}
setWeek
(
weekArr
)
}
catch
(
error
)
{
catchErrors
(
error
,
setError
)
}
...
...
@@ -60,13 +58,13 @@ const Weekly = () => {
function
prev
()
{
calendar
.
prev
()
le
t
date
=
moment
(
calendar
.
getDate
()).
format
(
'
YYYY-MM-DD
'
)
cons
t
date
=
moment
(
calendar
.
getDate
()).
format
(
'
YYYY-MM-DD
'
)
history
.
push
(
`/todo/
${
date
}
`
)
}
function
next
()
{
calendar
.
next
()
le
t
date
=
moment
(
calendar
.
getDate
()).
format
(
'
YYYY-MM-DD
'
)
cons
t
date
=
moment
(
calendar
.
getDate
()).
format
(
'
YYYY-MM-DD
'
)
history
.
push
(
`/todo/
${
date
}
`
)
}
...
...
client/src/components/Form/LoginForm.js
View file @
74f07500
...
...
@@ -30,7 +30,6 @@ const LoginForm = () => {
})}
onSubmit
=
{
async
(
values
,
{
setSubmitting
,
resetForm
})
=>
{
try
{
console
.
log
(
'
login values
'
,
values
)
setError
(
""
)
const
result
=
await
login
(
values
)
if
(
result
)
{
...
...
client/src/components/Form/SignupForm.js
View file @
74f07500
...
...
@@ -49,7 +49,6 @@ const SignupForm = () => {
try
{
setError
(
""
)
const
result
=
await
authApi
.
signup
(
values
)
// console.log('회원가입 요청 후 result 확인', result, '|', result.status)
if
(
result
.
status
===
201
)
{
alert
(
"
회원가입이 완료되었습니다.
"
)
setSuccess
(
true
)
...
...
client/src/components/Form/StudyPlanEditForm.js
View file @
74f07500
...
...
@@ -106,7 +106,6 @@ const StudyPlanEditForm = () => {
return
(
<
div
className
=
"
pt-5
"
>
{
console
.
log
(
"
studyplan---
"
,
studyplan
)}
<
select
className
=
{
`form-select mb-4
${
styles
.
selectInput
}
`
}
name
=
"
selected
"
aria
-
label
=
"
Choose subject
"
onChange
=
{
handleChange
}
>
{
subjectList
.
length
!==
0
?
subjectList
.
map
((
subject
,
idx
)
=>
{
if
(
idx
===
0
)
return
<>
...
...
client/src/components/Form/form.module.scss
View file @
74f07500
...
...
@@ -44,4 +44,10 @@
&
:focus
{
border-color
:
crimson
;
}
}
.list
{
height
:
60vh
;
overflow-y
:
auto
;
padding-bottom
:
4em
;
}
\ No newline at end of file
client/src/components/Menu/Menu.js
View file @
74f07500
...
...
@@ -19,8 +19,18 @@ const Menu = () => {
try
{
setError
(
""
)
const
result
=
await
todoApi
.
getTodopercent
(
user
.
id
,
moment
().
format
(
"
YYYY-MM-DD
"
))
console
.
log
(
"
client resList
"
,
result
)
setTodoList
({...
todoList
,
...
result
})
setTodoList
({
...
todoList
,
...
result
})
}
catch
(
error
)
{
catchErrors
(
error
,
setError
)
}
}
async
function
checkFn
(
e
,
todoId
)
{
try
{
setError
(
""
)
const
check_v
=
e
.
target
.
value
===
"
true
"
?
true
:
false
await
todoApi
.
edit
({
id
:
todoId
,
done
:
check_v
},
user
.
id
)
todayTodo
()
}
catch
(
error
)
{
catchErrors
(
error
,
setError
)
}
...
...
@@ -41,13 +51,11 @@ const Menu = () => {
<
div
className
=
"
d-flex flex-column justify-content-between flex-grow-1 py-4 ps-3 text-dark
"
>
<
div
className
=
"
user-select-none w-75 ps-3
"
>
<
h2
className
=
"
mb-4
"
>
To
-
do
<
/h2
>
{
todoList
.
list
.
length
!==
0
?
todoList
.
list
.
map
((
todo
,
idx
)
=>
{
if
(
idx
<=
2
)
return
<
div
className
=
"
d-flex
"
>
{
todoList
.
list
.
length
!==
0
?
todoList
.
list
.
map
((
todo
,
idx
)
=>
<
div
className
=
"
d-flex
"
>
<
p
className
=
{
`form-check-label border-bottom border-2 text-nowrap fs-5 pb-1 me-3
${
styles
.
title
}
`
}
>
{
todo
.
title
}
<
/p
>
<
input
className
=
{
`form-check-input rounded-0 border-dark shadow-none mt-1
${
styles
.
checkBox
}
`
}
type
=
"
checkbox
"
id
=
"
inlineCheckbox1
"
aria
-
label
=
"
checkbox
"
checked
=
{
todo
.
done
}
/
>
<
/div
>
})
:
null
}
<
Link
className
=
"
d-flex justify-content-center text-dark text-decoration-none
"
to
=
{
`/todo/
${
moment
().
format
(
"
YYYY-MM-DD
"
)}
`
}
>
<
input
className
=
{
`form-check-input rounded-0 border-dark shadow-none mt-1
${
styles
.
checkBox
}
`
}
type
=
"
checkbox
"
id
=
{
"
todoCheck
"
+
idx
}
value
=
{
todo
.
done
}
aria
-
label
=
"
checkbox
"
onClick
=
{(
e
)
=>
checkFn
(
e
,
todo
.
id
)}
checked
=
{
todo
.
done
}
/
>
<
/div>
)
: <div className="text-center border-bottom border-2 pb-1">오늘의 Todo를 등록해 보세요!</
div
>
}
<
Link
className
=
"
d-flex justify-content-center text-dark text-decoration-none mt-2
"
to
=
{
`/todo/
${
moment
().
format
(
"
YYYY-MM-DD
"
)}
`
}
>
<
i
className
=
"
bi bi-plus-lg me-2
"
><
/i
>
<
p
className
=
"
mb-0
"
>
더보기
<
/p
>
<
/Link
>
...
...
client/src/components/Modal/TodoModal.js
View file @
74f07500
...
...
@@ -5,30 +5,32 @@ import catchErrors from "../../utils/catchErrors";
import
moment
from
"
moment
"
;
import
styles
from
"
./modal.module.scss
"
;
const
TodoModal
=
({
curDate
,
selectTodo
=
""
})
=>
{
const
TodoModal
=
({
curDate
,
selectTodo
,
clicked
,
setClicked
})
=>
{
const
{
user
}
=
useAuth
()
const
[
todo
,
setTodo
]
=
useState
({
todoTitle
:
""
,
todoDate
:
moment
(
curDate
).
format
(
"
YYYY-MM-DD
"
)
})
const
[
error
,
setError
]
=
useState
(
""
)
;
const
[
error
,
setError
]
=
useState
(
""
)
useEffect
(()
=>
{
setTodo
({
...
todo
,
todoDate
:
curDate
})
},
[
c
urDate
])
if
(
clicked
)
setTodo
({
...
todo
,
...
selectTodo
})
},
[
c
licked
])
useEffect
(()
=>
{
if
(
selectTodo
)
{
console
.
log
(
"
selectTodo 값 변경으로 실행
"
)
setTodo
({
...
todo
,
...
selectTodo
})
}
},
[
selectTodo
])
setTodo
({
...
todo
,
todoDate
:
curDate
})
},
[
curDate
])
const
handleChange
=
(
e
)
=>
{
const
{
name
,
value
}
=
e
.
target
setTodo
({
...
todo
,
[
name
]:
value
})
}
function
handleClick
()
{
setTodo
({
todoTitle
:
""
,
todoDate
:
""
})
setClicked
(
false
)
}
async
function
handleSubmit
()
{
try
{
setError
(
""
)
...
...
@@ -39,6 +41,7 @@ const TodoModal = ({ curDate, selectTodo = "" }) => {
await
todoApi
.
submit
(
todo
,
user
.
id
)
alert
(
"
해당 할일이 성공적으로 등록되었습니다.
"
)
}
setClicked
(
false
)
window
.
location
.
reload
()
}
catch
(
error
)
{
catchErrors
(
error
,
setError
)
...
...
@@ -60,13 +63,13 @@ const TodoModal = ({ curDate, selectTodo = "" }) => {
<
div
className
=
"
d-flex justify-content-between mt-4
"
>
<
label
className
=
"
col-2 col-form-label ms-2
"
>
날짜
<
/label
>
<
div
className
=
"
col-8 d-flex align-items-center
"
>
<
input
type
=
"
date
"
className
=
"
form-control form-control-sm
"
name
=
"
todoDate
"
onChange
=
{
handleChange
}
value
=
{
todo
.
todoDate
}
/
>
<
input
type
=
"
date
"
className
=
{
`
form-control form-control-sm
shadow-none
${
styles
.
dateInput
}
`
}
name
=
"
todoDate
"
onChange
=
{
handleChange
}
value
=
{
todo
.
todoDate
}
/
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
modal-footer bg-white p-1
"
>
<
button
type
=
"
button
"
className
=
"
btn btn-secondary btn-sm
"
data
-
bs
-
dismiss
=
"
modal
"
onClick
=
{
()
=>
setTodo
({
todoTitle
:
""
,
todoDate
:
""
})
}
>
취소
<
/button
>
data
-
bs
-
dismiss
=
"
modal
"
onClick
=
{
handleClick
}
>
취소
<
/button
>
<
button
type
=
"
button
"
className
=
"
btn btn-crimson btn-sm
"
onClick
=
{
handleSubmit
}
>
{
selectTodo
?
"
수정
"
:
"
확인
"
}
<
/button
>
<
/div
>
<
/div
>
...
...
client/src/components/Modal/modal.module.scss
View file @
74f07500
...
...
@@ -19,6 +19,14 @@
}
}
.dateInput
{
font-size
:
0
.75rem
;
&
:focus
{
border-color
:
crimson
;
}
}
.cursor
{
cursor
:
pointer
;
}
\ No newline at end of file
client/src/components/Schedule/ScheduleCarousel.js
View file @
74f07500
...
...
@@ -28,10 +28,18 @@ const ScheduleCarousel = () => {
<
div
className
=
"
carousel-inner
"
>
{
scheduleList
.
length
!==
0
?
scheduleList
.
map
((
schedule
,
idx
)
=>
<
div
key
=
{
idx
}
className
=
{
"
carousel-item
"
+
(
idx
===
0
?
"
active
"
:
""
)}
>
<
KU
key
=
{
idx
}
schedule
=
{
schedule
}
/
>
<
div
className
=
{
"
carousel-item
"
+
(
idx
===
0
?
"
active
"
:
"
"
)}
>
<
KU
schedule
=
{
schedule
}
/
>
<
/div>
)
: null
}
<
/div
>
<
button
className
=
"
carousel-control-prev
"
type
=
"
button
"
data
-
bs
-
target
=
"
#scheduleListCarousel
"
data
-
bs
-
slide
=
"
prev
"
>
<
span
className
=
"
carousel-control-prev-icon
"
aria
-
hidden
=
"
true
"
><
/span
>
<
span
className
=
"
visually-hidden
"
>
Previous
<
/span
>
<
/button
>
<
button
className
=
"
carousel-control-next
"
type
=
"
button
"
data
-
bs
-
target
=
"
#scheduleListCarousel
"
data
-
bs
-
slide
=
"
next
"
>
<
span
className
=
"
carousel-control-next-icon
"
aria
-
hidden
=
"
true
"
><
/span
>
<
span
className
=
"
visually-hidden
"
>
Next
<
/span
>
<
/button
>
<
/div
>
)
}
...
...
client/src/components/Schedule/ScheduleItem.js
View file @
74f07500
...
...
@@ -20,7 +20,7 @@ const ScheduleItem = ({ index, curDate, schedule, handleClick }) => {
<
div
className
=
"
col-11
"
>
{
schedule
.
location
}
<
/div
>
<
/div> : null
}
{
schedule
.
memo
}
<
div
className
=
"
d-flex justify-content-end
mt-3
"
>
<
div
className
=
{
"
d-flex justify-content-end
"
+
((
schedule
.
location
||
schedule
.
memo
)
?
"
mt-3
"
:
null
)}
>
<
Link
className
=
"
btn btn-light btn-sm border-dark
"
to
=
{
`/schedule/edit/
${
schedule
.
id
}
`
}
>
수정
<
/Link
>
<
button
type
=
"
button
"
className
=
"
btn btn-crimson btn-sm ms-2
"
onClick
=
{()
=>
handleClick
(
schedule
.
id
)}
>
삭제
<
/button
>
<
/div
>
...
...
client/src/components/TodoList.js
View file @
74f07500
...
...
@@ -13,7 +13,8 @@ const TodoList = () => {
const
{
date
}
=
useParams
()
const
[
todoList
,
setTodoList
]
=
useState
([])
const
[
selectTodo
,
setSelectTodo
]
=
useState
(
null
)
const
[
error
,
setError
]
=
useState
(
""
);
const
[
clicked
,
setClicked
]
=
useState
(
false
)
const
[
error
,
setError
]
=
useState
(
""
)
useEffect
(()
=>
{
getAll
()
...
...
@@ -29,12 +30,26 @@ const TodoList = () => {
}
}
async
function
checkFn
(
e
,
todoId
)
{
try
{
setError
(
""
)
const
check_v
=
e
.
target
.
value
===
"
true
"
?
true
:
false
await
todoApi
.
edit
({
id
:
todoId
,
done
:
check_v
},
user
.
id
)
alert
(
"
해당 변경사항이 정상적으로 저장되었습니다.
"
)
window
.
location
.
reload
()
// getAll()
// getTodoList()
}
catch
(
error
)
{
catchErrors
(
error
,
setError
)
}
}
async
function
delayTodo
()
{
try
{
setError
(
""
)
const
nextDate
=
moment
(
date
).
add
(
1
,
'
day
'
).
format
(
"
YYYY-MM-DD
"
)
await
todoApi
.
edit
({
id
:
selectTodo
.
id
,
todoDate
:
nextDate
},
user
.
id
)
getAll
()
window
.
location
.
reload
()
}
catch
(
error
)
{
catchErrors
(
error
,
setError
)
}
...
...
@@ -45,28 +60,32 @@ const TodoList = () => {
setError
(
""
)
await
todoApi
.
remove
(
todoId
,
user
.
id
)
alert
(
"
해당 할일이 성공적으로 삭제되었습니다.
"
)
getAll
()
window
.
location
.
reload
()
}
catch
(
error
)
{
catchErrors
(
error
,
setError
)
}
}
return
(
<
div
className
=
{
"
mt-3
"
+
(
todoList
.
length
?
"
d-flex flex-column
"
:
"
d-block
"
)}
>
{
todoList
.
length
!==
0
?
todoList
.
map
((
todo
,
idx
)
=>
<
div
className
=
"
d-flex
"
>
<
div
className
=
"
d-flex align-items-center
"
style
=
{{
width
:
"
75%
"
}}
>
<
input
className
=
{
`form-check-input rounded-0 shadow-none mt-0 me-2
${
styles
.
checkBox
}
`
}
type
=
"
checkbox
"
checked
=
{
todo
.
done
}
/
>
<
label
className
=
"
form-check-label fs-5 pe-2 text-nowrap
"
style
=
{{
overflow
:
"
hidden
"
,
textOverflow
:
"
ellipsis
"
}}
>
{
todo
.
todoTitle
}
<
/label
>
<
/div
>
<
div
className
=
"
d-flex justify-content-between
"
style
=
{{
cursor
:
"
pointer
"
,
width
:
"
25%
"
}}
>
<
i
className
=
"
bi bi-arrow-right fs-5
"
data
-
bs
-
toggle
=
"
modal
"
data
-
bs
-
target
=
"
#postmodal
"
onClick
=
{()
=>
setSelectTodo
(
todo
)}
><
/i
>
<
i
className
=
"
bi bi-pencil-square fs-5
"
data
-
bs
-
toggle
=
"
modal
"
data
-
bs
-
target
=
"
#todomodal
"
onClick
=
{()
=>
setSelectTodo
(
todo
)}
><
/i
>
<
i
className
=
"
bi bi-trash fs-5
"
onClick
=
{()
=>
delTodo
(
todo
.
id
)}
><
/i
>
<
/div
>
<
/div>
)
: <p className="text-center">등록된 할일이 없습니다.</
p
>
}
<
TodoPostModal
handleClick
=
{
delayTodo
}
/
>
<
TodoModal
curDate
=
{
date
}
selectTodo
=
{
selectTodo
}
/
>
<
div
className
=
{
`mt-3
${
styles
.
list
}
`
}
>
<
div
className
=
{
todoList
.
length
?
"
d-flex flex-column
"
:
"
d-block
"
}
>
{
todoList
.
length
!==
0
?
todoList
.
map
((
todo
,
idx
)
=>
<
div
key
=
{
idx
}
className
=
"
d-flex mb-1
"
>
<
div
className
=
"
d-flex align-items-center
"
style
=
{{
width
:
"
75%
"
}}
>
<
div
className
=
"
col d-flex align-items-center
"
>
<
input
className
=
{
`form-check-input rounded-0 shadow-none mt-0
${
styles
.
checkBox
}
`
}
type
=
"
checkbox
"
id
=
{
"
todoCheck
"
+
idx
}
value
=
{
todo
.
done
}
checked
=
{
todo
.
done
}
onClick
=
{(
e
)
=>
checkFn
(
e
,
todo
.
id
)}
/
>
<
/div
>
<
label
className
=
"
col-11 form-check-label fs-5 pe-1 text-nowrap
"
style
=
{{
overflow
:
"
hidden
"
,
textOverflow
:
"
ellipsis
"
}}
>
{
todo
.
todoTitle
}
<
/label
>
<
/div
>
<
div
className
=
"
d-flex justify-content-between
"
style
=
{{
cursor
:
"
pointer
"
,
width
:
"
25%
"
}}
>
<
i
className
=
"
bi bi-arrow-right fs-5
"
data
-
bs
-
toggle
=
"
modal
"
data
-
bs
-
target
=
"
#postmodal
"
onClick
=
{()
=>
setSelectTodo
(
todo
)}
><
/i
>
<
i
className
=
"
bi bi-pencil-square fs-5
"
data
-
bs
-
toggle
=
"
modal
"
data
-
bs
-
target
=
"
#todomodal
"
onClick
=
{()
=>
{
setSelectTodo
(
todo
);
setClicked
(
true
)
}}
><
/i
>
<
i
className
=
"
bi bi-trash fs-5
"
onClick
=
{()
=>
delTodo
(
todo
.
id
)}
><
/i
>
<
/div
>
<
/div>
)
: <p className="text-center">등록된 할일이 없습니다.</
p
>
}
<
TodoPostModal
handleClick
=
{
delayTodo
}
/
>
<
TodoModal
curDate
=
{
date
}
selectTodo
=
{
selectTodo
}
clicked
=
{
clicked
}
setClicked
=
{
setClicked
}
/
>
<
/div
>
<
/div
>
)
}
...
...
client/src/scss/custom.scss
View file @
74f07500
...
...
@@ -149,10 +149,6 @@ button {
display
:
none
;
}
&
.fc-dayGridDay-view
{
display
:
none
;
}
&
.text
{
font-family
:
"Plex-Text"
;
...
...
client/src/utils/context.js
View file @
74f07500
...
...
@@ -20,7 +20,6 @@ const AuthProvider = ({ children }) => {
const
{
pathname
}
=
useLocation
()
const
getUser
=
async
()
=>
{
try
{
console
.
log
(
"
context getUser
"
)
const
resUser
=
await
authApi
.
getUser
();
setUser
({
...
user
,
...
resUser
})
if
(
resUser
.
role
===
"
admin
"
)
history
.
push
(
"
/admin
"
)
...
...
server/controllers/schedule.controller.js
View file @
74f07500
...
...
@@ -153,7 +153,6 @@ const findbyDate = async (req, res, next) => {
},
attributes
:
[
'
id
'
,
'
title
'
,
'
start
'
,
'
end
'
]
,
order
:
[[
'
start
'
]]
})
console
.
log
(
"
개인 일정 찾기
"
,
findIndividualList
)
findIndividualList
.
forEach
(
schedule
=>
{
schedule
.
dataValues
.
end
.
setDate
(
schedule
.
dataValues
.
end
.
getDate
()
+
1
)
schedule
.
dataValues
.
end
=
dateToString
(
schedule
.
dataValues
.
end
,
"
full
"
)
...
...
server/controllers/todo.controller.js
View file @
74f07500
...
...
@@ -3,33 +3,15 @@ import sequelize from 'sequelize';
const
{
Op
}
=
sequelize
const
findbyId
=
async
(
req
,
res
,
next
)
=>
{
try
{
const
userId
=
req
.
userId
const
{
todoId
}
=
req
.
query
if
(
todoId
)
{
console
.
log
(
"
findbyId todoId가 있을 때 실행
"
,
todoId
)
const
findTodo
=
await
Todo
.
findOne
({
where
:
{
[
Op
.
and
]:
[{
id
:
todoId
},
{
userId
:
userId
}]
},
attributes
:
[
'
id
'
,
[
'
title
'
,
'
todoTitle
'
],
[
'
date
'
,
'
todoDate
'
],
'
done
'
]
})
if
(
!
findTodo
)
throw
new
Error
(
"
해당 todo를 찾지 못했습니다.
"
)
req
.
todoOne
=
findTodo
}
next
()
}
catch
(
error
)
{
return
res
.
status
(
500
).
send
(
error
.
message
||
"
todo 가져오는 중 에러 발생
"
)
}
}
const
findbyDate
=
async
(
req
,
res
,
next
)
=>
{
const
findbyDate
=
async
(
req
,
res
)
=>
{
try
{
// Todo 페이지
const
userId
=
req
.
userId
const
{
date
}
=
req
.
query
if
(
date
)
{
console
.
log
(
"
findbydate 날짜가 있을 때 실행
"
,
date
,
userId
)
const
findList
=
await
Todo
.
findAll
({
where
:
{
[
Op
.
and
]:
[{
date
:
{
[
Op
.
eq
]:
date
}
},
{
userId
:
userId
}]
},
attributes
:
[
'
id
'
,
[
'
title
'
,
'
todoTitle
'
],
[
'
date
'
,
'
todoDate
'
],
'
done
'
]
})
console
.
log
(
"
find==
"
,
findList
)
req
.
todoList
=
findList
}
next
()
const
nonCheck
=
await
Todo
.
findAll
({
where
:
{
[
Op
.
and
]:
[{
done
:
false
},
{
date
:
{
[
Op
.
eq
]:
date
}
},
{
userId
:
userId
}]
},
attributes
:
[
'
id
'
,
[
'
title
'
,
'
todoTitle
'
],
[
'
date
'
,
'
todoDate
'
],
'
done
'
],
order
:
[[
'
updatedAt
'
,
"
DESC
"
]]
})
const
check
=
await
Todo
.
findAll
({
where
:
{
[
Op
.
and
]:
[{
done
:
true
},
{
date
:
{
[
Op
.
eq
]:
date
}
},
{
userId
:
userId
}]
},
attributes
:
[
'
id
'
,
[
'
title
'
,
'
todoTitle
'
],
[
'
date
'
,
'
todoDate
'
],
'
done
'
],
order
:
[[
'
updatedAt
'
,
"
DESC
"
]]
})
check
.
forEach
(
el
=>
nonCheck
.
push
(
el
.
dataValues
))
return
res
.
json
(
nonCheck
)
}
catch
(
error
)
{
return
res
.
status
(
500
).
send
(
error
.
message
||
"
todo 가져오는 중 에러 발생
"
)
}
...
...
@@ -37,24 +19,51 @@ const findbyDate = async (req, res, next) => {
const
findforPercent
=
async
(
req
,
res
)
=>
{
try
{
let
doneTodo
=
null
let
nonCheck
=
null
let
check
=
null
const
userId
=
req
.
userId
const
{
start
,
end
}
=
req
.
query
if
(
end
)
{
console
.
log
(
"
week 실행하냐
"
)
const
findList
=
await
Todo
.
findAndCountAll
({
where
:
{
[
Op
.
and
]:
[{
userId
:
userId
},
{
date
:
[
start
,
end
]
}]
},
group
:
[
'
date
'
]
})
console
.
log
(
"
week findList
"
,
findList
)
// weekly percent
nonCheck
=
await
Todo
.
findAll
({
where
:
{
[
Op
.
and
]:
[{
userId
:
userId
},
{
done
:
false
},
{
date
:
{
[
Op
.
between
]:
[
start
,
end
]
}
}]
},
order
:
[[
'
date
'
]]
})
check
=
await
Todo
.
findAll
({
where
:
{
[
Op
.
and
]:
[{
userId
:
userId
},
{
done
:
true
},
{
date
:
{
[
Op
.
between
]:
[
start
,
end
]
}
}]
},
order
:
[[
'
date
'
]]
})
const
nonCheckCountList
=
countInList
(
nonCheck
)
let
checkCountList
=
countInList
(
check
)
let
percentList
=
nonCheckCountList
.
map
(
nonCheckEl
=>
{
const
findIdx
=
checkCountList
.
findIndex
(
el
=>
el
.
date
===
nonCheckEl
.
date
)
if
(
findIdx
===
-
1
)
nonCheckEl
[
'
rate
'
]
=
0
else
{
nonCheckEl
[
'
rate
'
]
=
Math
.
round
((
checkCountList
[
findIdx
].
count
/
(
nonCheckEl
.
count
+
checkCountList
[
findIdx
].
count
))
*
100
)
checkCountList
.
splice
(
findIdx
,
1
)
}
return
nonCheckEl
})
if
(
checkCountList
.
length
!==
0
)
{
checkCountList
.
forEach
(
el
=>
el
[
'
rate
'
]
=
100
)
const
sendList
=
percentList
.
concat
(
checkCountList
).
sort
((
pre
,
next
)
=>
{
if
(
pre
.
date
<
next
.
date
)
return
-
1
else
if
(
pre
.
date
>
next
.
date
)
return
1
else
return
0
})
return
res
.
json
(
sendList
)
}
else
return
res
.
json
(
percentList
)
}
else
{
// Menu
let
percent
=
0
console
.
log
(
"
findforPercent end 없음
"
)
const
nonCheck
=
await
Todo
.
findAndCountAll
({
where
:
{
[
Op
.
and
]:
[{
date
:
{
[
Op
.
eq
]:
start
}
},
{
userId
:
userId
},
{
done
:
false
}]
},
order
:
[[
'
updatedAt
'
,
"
DESC
"
]]
})
const
check
=
await
Todo
.
findAndCountAll
({
where
:
{
[
Op
.
and
]:
[{
date
:
{
[
Op
.
eq
]:
start
}
},
{
userId
:
userId
},
{
done
:
true
}]
},
order
:
[[
'
updatedAt
'
,
"
DESC
"
]]
})
nonCheck
=
await
Todo
.
findAndCountAll
({
where
:
{
[
Op
.
and
]:
[{
date
:
{
[
Op
.
eq
]:
start
}
},
{
userId
:
userId
},
{
done
:
false
}]
},
order
:
[[
'
updatedAt
'
,
"
DESC
"
]]
})
check
=
await
Todo
.
findAndCountAll
({
where
:
{
[
Op
.
and
]:
[{
date
:
{
[
Op
.
eq
]:
start
}
},
{
userId
:
userId
},
{
done
:
true
}]
},
order
:
[[
'
updatedAt
'
,
"
DESC
"
]]
})
let
total
=
nonCheck
.
count
+
check
.
count
check
.
rows
.
forEach
(
el
=>
nonCheck
.
rows
.
push
(
el
.
dataValues
))
console
.
log
(
"
non
"
,
nonCheck
)
if
(
total
===
0
)
percent
=
0
else
percent
=
Math
.
round
((
check
.
count
/
total
)
*
100
)
return
res
.
json
({
percent
:
percent
,
list
:
nonCheck
.
rows
})
if
(
total
!==
0
)
percent
=
Math
.
round
((
check
.
count
/
total
)
*
100
)
if
(
nonCheck
.
count
<
3
)
check
.
rows
.
forEach
(
el
=>
nonCheck
.
rows
.
push
(
el
.
dataValues
))
return
res
.
json
({
percent
:
percent
,
list
:
nonCheck
.
rows
.
slice
(
0
,
3
)
})
}
}
catch
(
error
)
{
return
res
.
status
(
500
).
send
(
error
.
message
||
"
todo 가져오는 중 에러 발생
"
)
...
...
@@ -77,9 +86,10 @@ const edit = async (req, res) => {
let
updated
=
null
const
userId
=
req
.
userId
const
{
todoId
}
=
req
.
query
const
{
todoTitle
,
todoDate
}
=
req
.
body
const
{
todoTitle
,
todoDate
,
done
}
=
req
.
body
if
(
todoTitle
)
updated
=
await
Todo
.
update
({
title
:
todoTitle
,
date
:
todoDate
},
{
where
:
{
[
Op
.
and
]:
[{
id
:
todoId
},
{
userId
:
userId
}]
}
})
else
updated
=
await
Todo
.
update
({
date
:
todoDate
},
{
where
:
{
[
Op
.
and
]:
[{
id
:
todoId
},
{
userId
:
userId
}]
}
})
else
if
(
todoDate
)
updated
=
await
Todo
.
update
({
date
:
todoDate
},
{
where
:
{
[
Op
.
and
]:
[{
id
:
todoId
},
{
userId
:
userId
}]
}
})
else
updated
=
await
Todo
.
update
({
done
:
!
done
},
{
where
:
{
[
Op
.
and
]:
[{
id
:
todoId
},
{
userId
:
userId
}]
}
})
if
(
!
updated
)
throw
new
Error
(
"
해당 todo의 일부 정보를 수정하는데 실패하였습니다.
"
)
else
return
res
.
send
(
200
)
}
catch
(
error
)
{
...
...
@@ -109,22 +119,22 @@ const getParams = async (req, res, next) => {
}
}
const
send
=
async
(
req
,
res
)
=>
{
try
{
const
result
=
req
.
todoOne
||
req
.
todoList
return
res
.
json
(
result
)
}
catch
(
error
)
{
return
res
.
status
(
500
).
send
(
error
.
message
||
"
todo 가져오는 중 에러 발생
"
)
}
function
countInList
(
list
)
{
const
countList
=
list
.
reduce
((
acc
,
cur
)
=>
{
const
findIdx
=
acc
.
findIndex
(
el
=>
el
.
date
===
cur
.
dataValues
.
date
)
if
(
findIdx
===
-
1
)
acc
.
push
({
date
:
cur
.
dataValues
.
date
,
count
:
1
})
else
acc
[
findIdx
].
count
+=
1
return
acc
},
[])
return
countList
}
export
default
{
findbyId
,
findbyDate
,
findforPercent
,
create
,
edit
,
remove
,
getParams
,
send
getParams
}
\ No newline at end of file
server/controllers/user.controller.js
View file @
74f07500
...
...
@@ -17,7 +17,6 @@ const getUser = async (req, res) => {
}
const
signup
=
async
(
req
,
res
)
=>
{
console
.
log
(
'
server/signup req.body
'
,
req
.
body
)
const
{
userId
,
password
,
userName
,
userStudNum
}
=
req
.
body
;
try
{
const
findId
=
await
User
.
findOne
({
where
:
{
userID
:
userId
}
});
...
...
@@ -39,7 +38,6 @@ const signup = async (req, res) => {
}
const
login
=
async
(
req
,
res
)
=>
{
console
.
log
(
'
server/login req.body
'
,
req
.
body
)
const
{
userId
,
password
}
=
req
.
body
;
try
{
const
user
=
await
User
.
scope
(
"
withPassword
"
).
findOne
({
where
:
{
userID
:
userId
}
});
...
...
server/routes/todo.route.js
View file @
74f07500
...
...
@@ -9,7 +9,7 @@ router
router
.
route
(
"
/:userId
"
)
.
get
(
todoCtrl
.
findby
Id
,
todoCtrl
.
findbyDate
,
todoCtrl
.
send
)
.
get
(
todoCtrl
.
findby
Date
)
.
post
(
todoCtrl
.
create
)
.
put
(
todoCtrl
.
edit
)
.
delete
(
todoCtrl
.
remove
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment