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