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
reservation-service
Commits
ec0852e1
Commit
ec0852e1
authored
Nov 05, 2020
by
Kim, Subin
Browse files
채린+진주+수빈 병합
parents
f9eab7b0
5d0a841d
Changes
10
Hide whitespace changes
Inline
Side-by-side
server/client/src/Components/Menu.js
View file @
ec0852e1
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
Link
,
Redirect
}
from
'
react-router-dom
'
;
import
{
Link
,
Redirect
}
from
'
react-router-dom
'
;
import
styled
from
'
styled-components
'
;
import
styled
from
'
styled-components
'
;
import
{
Navbar
,
Nav
,
NavLink
}
from
'
react-bootstrap
'
;
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
import
{
Navbar
,
Nav
,
NavLink
}
from
'
react-bootstrap
'
;
const
MENU
=
styled
(
Navbar
)
`
const
MENU
=
styled
(
Navbar
)
`
background-color: #7B031D;
background-color: #7B031D;
...
@@ -28,8 +28,10 @@ function Menu() {
...
@@ -28,8 +28,10 @@ function Menu() {
},
[])
},
[])
function
acheck
()
{
function
acheck
()
{
axios
.
get
(
`/users/
${
localStorage
.
getItem
(
'
_id
'
)}
`
)
axios
.
get
(
`/users/
${
localStorage
.
getItem
(
'
_id
'
)}
`
,
{
.
then
(
res
=>
{
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
}).
then
(
res
=>
{
console
.
log
(
res
.
data
)
if
(
res
.
data
.
role
==
"
admin
"
)
{
if
(
res
.
data
.
role
==
"
admin
"
)
{
setUser
(
res
.
data
)
setUser
(
res
.
data
)
}
}
...
@@ -59,12 +61,12 @@ function Menu() {
...
@@ -59,12 +61,12 @@ function Menu() {
}}
className
=
"
nav-link
"
>
}}
className
=
"
nav-link
"
>
대관
확인
/
취소
<
/NavLink
>
대관
확인
/
취소
<
/NavLink
>
{
user
.
role
===
"
admin
"
?
(
{
/*
{user.role === "admin" ? (
<NavLink as={Link} to={{
<NavLink as={Link} to={{
pathname: `/acheck/${localStorage.getItem('_id')}`,
pathname: `/acheck/${localStorage.getItem('_id')}`,
state: { id: localStorage.getItem('_id') },
state: { id: localStorage.getItem('_id') },
}} className="nav-link">
}} className="nav-link">
대관
확인
/
취소
(
관리자
)
<
/NavLink>
)
: null
}
대관 확인/취소(관리자)</NavLink>) : null}
*/
}
<
/Nav
>
<
/Nav
>
<
Nav
>
<
Nav
>
<
NavLink
>
<
NavLink
>
...
...
server/client/src/Pages/ACheckPage.js
View file @
ec0852e1
...
@@ -2,10 +2,31 @@ import React, { useState, useEffect } from 'react';
...
@@ -2,10 +2,31 @@ import React, { useState, useEffect } from 'react';
import
Menu
from
'
../Components/Menu
'
;
import
Menu
from
'
../Components/Menu
'
;
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
import
{
Link
,
Redirect
}
from
'
react-router-dom
'
;
import
{
Link
,
Redirect
}
from
'
react-router-dom
'
;
import
{
Container
,
Table
}
from
'
react-bootstrap
'
;
import
styled
from
'
styled-components
'
;
const
Ta
=
styled
(
Table
)
`
& th, & td {
padding: 0;
vertical-align: middle;
};
& tr {
display: d-flex;
width: 50px;
};
& td {
align-items: center;
width: 70px;
};
`
function
ACheck
(
props
)
{
function
ACheck
(
props
)
{
const
[
state
,
setState
]
=
useState
()
const
[
state
,
setState
]
=
useState
()
const
[
reserve
,
setReserve
]
=
useState
([]);
const
[
reserve
,
setReserve
]
=
useState
([]);
useEffect
(()
=>
{
useEffect
(()
=>
{
getReserve
();
getReserve
();
},
[])
},
[])
...
@@ -57,16 +78,17 @@ function ACheck(props) {
...
@@ -57,16 +78,17 @@ function ACheck(props) {
return
(
return
(
<
div
>
<
div
>
<
Menu
/>
<
Menu
/>
<
div
className
=
""
>
<
Container
fluid
>
<
table
className
=
"
table
"
>
<
Ta
responsive
=
"
lg
"
>
<
thead
>
<
thead
className
=
"
thead-light
"
>
<
tr
>
<
tr
>
<
th
>
대표자
<
/th
>
<
th
>
대표자
<
/th
>
<
th
>
날짜
<
/th
>
<
th
>
날짜
<
/th
>
<
th
>
시간
<
/th
>
<
th
>
시간
<
/th
>
<
th
>
강의실
<
/th
>
<
th
>
강의실
<
/th
>
<
th
>
사용인원
<
/th
>
<
th
>
사용
인원
<
/th
>
<
th
>
승인여부
<
/th
>
<
th
>
승인
여부
<
/th
>
<
/tr
>
<
/tr
>
<
/thead
>
<
/thead
>
<
tbody
>
<
tbody
>
...
@@ -80,10 +102,10 @@ function ACheck(props) {
...
@@ -80,10 +102,10 @@ function ACheck(props) {
<
td
>
{
reserve
.
room
}
<
/td
>
<
td
>
{
reserve
.
room
}
<
/td
>
<
td
>
{
reserve
.
num
}
<
/td
>
<
td
>
{
reserve
.
num
}
<
/td
>
<
td
>
<
td
>
<
button
onClick
=
{()
=>
admit
(
index
)}
className
=
"
btn btn-primary
"
>
<
button
onClick
=
{()
=>
admit
(
index
)}
className
=
"
btn btn-primary
btn-sm
"
>
승인
승인
<
/button
>
<
/button
>
<
button
onClick
=
{()
=>
remove
(
index
)}
className
=
"
btn btn-danger
"
>
<
button
onClick
=
{()
=>
remove
(
index
)}
className
=
"
btn btn-danger
btn-sm
"
>
거절
거절
<
/button
>
<
/button
>
<
/td
>
<
/td
>
...
@@ -91,9 +113,8 @@ function ACheck(props) {
...
@@ -91,9 +113,8 @@ function ACheck(props) {
)
)
}))
:
<
div
>
최근
대관
신청
내역이
없습니다
.
<
/div>
}
}))
:
<
div
>
최근
대관
신청
내역이
없습니다
.
<
/div>
}
<
/tbody
>
<
/tbody
>
<
/table
>
<
/Ta
>
<
/Container
>
<
/div
>
<
/div
>
<
/div
>
)
)
}
}
...
...
server/client/src/Pages/ApplyPage.js
View file @
ec0852e1
...
@@ -7,15 +7,15 @@ import { Redirect } from 'react-router-dom';
...
@@ -7,15 +7,15 @@ import { Redirect } from 'react-router-dom';
import
{
Col
,
Container
,
Row
}
from
'
react-bootstrap
'
;
import
{
Col
,
Container
,
Row
}
from
'
react-bootstrap
'
;
function
Apply
(
props
)
{
function
Apply
(
props
)
{
const
[
state
,
setState
]
=
useState
();
const
[
state
,
setState
]
=
useState
(
{
ok
:
""
}
);
const
[
user
,
setUser
]
=
useState
({
name
:
""
});
const
[
user
,
setUser
]
=
useState
({
name
:
""
});
const
[
room_Num
,
setRoom_Num
]
=
useState
({
"
9-116
"
:
5
,
"
7-234
"
:
7
,
"
25-101
"
:
10
});
const
[
room_Num
,
setRoom_Num
]
=
useState
({
"
9-116
"
:
5
,
"
7-234
"
:
7
,
"
25-101
"
:
10
});
useEffect
(()
=>
{
useEffect
(()
=>
{
getUser
();
getUser
();
},
[])
},
[])
if
(
state
.
ok
===
"
no
"
)
return
<
Redirect
to
=
"
/
"
/>
;
if
(
state
)
{
if
(
state
.
ok
===
"
ok
"
)
{
return
<
Redirect
to
=
{{
return
<
Redirect
to
=
{{
pathname
:
`/check/
${
props
.
match
.
params
.
id
}
`
,
pathname
:
`/check/
${
props
.
match
.
params
.
id
}
`
,
state
:
{
id
:
props
.
match
.
params
.
id
},
state
:
{
id
:
props
.
match
.
params
.
id
},
...
@@ -51,6 +51,8 @@ function Apply(props) {
...
@@ -51,6 +51,8 @@ function Apply(props) {
.
then
(
res
=>
{
.
then
(
res
=>
{
if
(
res
.
status
!==
201
)
{
if
(
res
.
status
!==
201
)
{
alert
(
res
.
data
.
error
);
alert
(
res
.
data
.
error
);
localStorage
.
clear
();
setState
({
ok
:
"
no
"
});
}
}
console
.
log
(
res
.
data
);
console
.
log
(
res
.
data
);
setUser
(
res
.
data
);
setUser
(
res
.
data
);
...
@@ -106,7 +108,7 @@ function Apply(props) {
...
@@ -106,7 +108,7 @@ function Apply(props) {
return
window
.
location
.
reload
();
return
window
.
location
.
reload
();
}
}
alert
(
"
신청이 완료되었습니다!
"
);
alert
(
"
신청이 완료되었습니다!
"
);
setState
(
true
);
setState
(
{
ok
:
"
ok
"
}
);
console
.
log
(
"
res.data
"
,
res
.
data
)
console
.
log
(
"
res.data
"
,
res
.
data
)
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
...
...
server/client/src/Pages/CheckPage.js
View file @
ec0852e1
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
Menu
from
'
../Components/Menu
'
;
import
Menu
from
'
../Components/Menu
'
;
import
{
Redirect
}
from
'
react-router-dom
'
;
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
import
Table
from
'
react-bootstrap/Table
'
import
{
Container
}
from
'
react-bootstrap
'
;
import
styled
from
'
styled-components
'
;
const
Ta
=
styled
(
Table
)
`
margin-top: 0.5em;
& th, & td {
padding: 0;
vertical-align: middle;
font-size: 0.9rem;
margin-left : auto; margin-right : auto;
border-spacing: initial;
};
& tr {
display: d-flex;
width: 150px;
};
& td {
align-items: center;
margin: 10px;
};
`
function
Check
(
props
)
{
function
Check
(
props
)
{
const
[
reserve
,
setReserve
]
=
useState
([]);
const
[
reserve
,
setReserve
]
=
useState
([]);
const
[
state
,
setState
]
=
useState
()
useEffect
(()
=>
{
useEffect
(()
=>
{
getReserve
();
getReserve
();
},
[])
},
[])
if
(
state
)
return
<
Redirect
to
=
"
/
"
/>
;
function
getReserve
()
{
function
getReserve
()
{
axios
.
get
(
`/reserves/
${
props
.
match
.
params
.
id
}
`
,
{
axios
.
get
(
`/reserves/
${
props
.
match
.
params
.
id
}
`
,
{
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
})
})
.
then
(
res
=>
{
.
then
(
res
=>
{
if
(
res
.
status
!==
201
)
{
if
(
res
.
status
===
404
)
{
alert
(
res
.
data
.
error
);
}
if
(
res
.
status
===
419
)
{
alert
(
res
.
data
.
error
);
alert
(
res
.
data
.
error
);
localStorage
.
clear
();
setState
(
true
);
}
}
console
.
log
(
res
.
data
);
console
.
log
(
res
.
data
);
setReserve
(
res
.
data
);
const
reserves
=
res
.
data
.
filter
(
function
(
item
)
{
return
item
!==
''
;
});
setReserve
(
reserves
);
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
alert
(
err
.
error
)
alert
(
err
.
error
)
...
@@ -38,29 +76,29 @@ function Check(props) {
...
@@ -38,29 +76,29 @@ function Check(props) {
return
(
return
(
<
div
>
<
div
>
<
Menu
/>
<
Menu
/>
<
div
className
=
""
>
<
Container
fluid
>
<
table
className
=
"
table
"
>
<
Ta
responsive
=
"
lg ml-2rem
"
>
<
thead
>
<
thead
className
=
"
thead-light
"
>
<
tr
>
<
tr
>
<
th
>
날짜
<
/th
>
<
th
className
=
"
text-center
"
>
날짜
<
/th
>
<
th
>
시간
<
/th
>
<
th
className
=
"
text-center
"
>
시간
<
/th
>
<
th
>
강의실
<
/th
>
<
th
className
=
"
text-center
"
>
강의실
<
/th
>
<
th
>
사용인원
<
/th
>
<
th
className
=
"
text-center
"
>
사용인원
<
/th
>
<
th
>
승인여부
<
/th
>
{
/*
<th>승인여부</th>
*/
}
<
th
>
예약취소
<
/th
>
<
th
className
=
"
text-center
"
>
예약취소
<
/th
>
<
/tr
>
<
/tr
>
<
/thead
>
<
/thead
>
<
tbody
>
<
tbody
>
{
reserve
.
map
((
reserve
,
index
)
=>
{
{
reserve
.
map
((
reserve
,
index
)
=>
{
return
(
return
(
<
tr
key
=
{
index
}
>
<
tr
key
=
{
index
}
>
<
td
>
{
reserve
.
date
}
<
/td
>
<
td
className
=
"
text-center
"
>
{
reserve
.
date
}
<
/td
>
<
td
>
{
reserve
.
starttime
}
시
~
{(
Number
(
reserve
.
starttime
)
+
reserve
.
usetime
)}
시
<
/td
>
<
td
className
=
"
text-center
"
>
{
reserve
.
starttime
}
시
~
{(
Number
(
reserve
.
starttime
)
+
reserve
.
usetime
)}
시
<
/td
>
<
td
>
{
reserve
.
room
}
<
/td
>
<
td
className
=
"
text-center
"
>
{
reserve
.
room
}
<
/td
>
<
td
>
{
reserve
.
num
}
<
/td
>
<
td
className
=
"
text-center
"
>
{
reserve
.
num
}
<
/td
>
<
td
>
{
reserve
.
check
?
(
reserve
.
approve
?
"
사용가능
"
:
"
사용불가
"
)
:
"
승인대기중
"
}
<
/td
>
{
/*
<td>{reserve.check ? (reserve.approve ? "사용가능" : "사용불가") : "승인대기중"}</td>
*/
}
<
td
>
<
td
className
=
"
text-center
"
>
<
button
onClick
=
{()
=>
remove
(
index
)}
className
=
"
btn btn-danger
"
>
<
button
onClick
=
{()
=>
remove
(
index
)}
className
=
"
btn btn-danger
btn-sm
"
>
취소
취소
<
/button
>
<
/button
>
<
/td
>
<
/td
>
...
@@ -68,9 +106,8 @@ function Check(props) {
...
@@ -68,9 +106,8 @@ function Check(props) {
)
)
})}
})}
<
/tbody
>
<
/tbody
>
<
/table
>
<
/Ta
>
<
/Container
>
<
/div
>
<
/div
>
<
/div
>
)
)
}
}
...
...
server/client/src/Pages/HomePage.js
View file @
ec0852e1
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
Redirect
}
from
'
react-router-dom
'
;
import
axios
from
'
axios
'
;
import
Menu
from
'
../Components/Menu
'
;
import
Menu
from
'
../Components/Menu
'
;
import
Schedule
from
'
../Components/Schedule
'
;
import
Schedule
from
'
../Components/Schedule
'
;
import
{
Container
,
Tabs
,
Tab
}
from
'
react-bootstrap
'
;
import
{
Container
,
Tabs
,
Tab
}
from
'
react-bootstrap
'
;
function
Home
()
{
function
Home
()
{
const
[
key
,
setKey
]
=
useState
(
'
9-116
'
);
const
[
key
,
setKey
]
=
useState
(
'
9-116
'
);
const
[
state
,
setState
]
=
useState
()
useEffect
(()
=>
{
tcheck
();
},
[]);
if
(
state
)
return
<
Redirect
to
=
"
/
"
/>
;
function
tcheck
()
{
axios
.
get
(
`/users/
${
localStorage
.
getItem
(
'
_id
'
)}
`
,
{
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
})
.
then
(
res
=>
{
if
(
res
.
status
!==
201
)
{
alert
(
res
.
data
.
error
);
localStorage
.
clear
();
setState
(
true
);
}
}).
catch
(
err
=>
{
alert
(
err
.
error
)
});
}
return
(
return
(
<
div
>
<
div
>
...
@@ -28,13 +52,13 @@ function Home() {
...
@@ -28,13 +52,13 @@ function Home() {
<
/p
>
<
/p
>
<
Tabs
defaultActiveKey
=
"
9-116
"
id
=
"
uncontrolled-tab-example
"
onSelect
=
{(
k
)
=>
setKey
(
k
)}
>
<
Tabs
defaultActiveKey
=
"
9-116
"
id
=
"
uncontrolled-tab-example
"
onSelect
=
{(
k
)
=>
setKey
(
k
)}
>
<
Tab
eventKey
=
"
9-116
"
title
=
"
9-116
"
>
<
Tab
eventKey
=
"
9-116
"
title
=
"
9-116
"
>
<
Schedule
room
=
{
key
}
/
>
<
Schedule
room
=
{
key
}
/
>
<
/Tab
>
<
/Tab
>
<
Tab
eventKey
=
"
7-234
"
title
=
"
7-234
"
>
<
Tab
eventKey
=
"
7-234
"
title
=
"
7-234
"
>
<
Schedule
room
=
{
key
}
/
>
<
Schedule
room
=
{
key
}
/
>
<
/Tab
>
<
/Tab
>
<
Tab
eventKey
=
"
25-101
"
title
=
"
25-101
"
>
<
Tab
eventKey
=
"
25-101
"
title
=
"
25-101
"
>
<
Schedule
room
=
{
key
}
/
>
<
Schedule
room
=
{
key
}
/
>
<
/Tab
>
<
/Tab
>
<
/Tabs
>
<
/Tabs
>
<
/Container
>
<
/Container
>
...
...
server/client/src/Pages/NoticePage.js
View file @
ec0852e1
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
Menu
from
'
../Components/Menu
'
;
import
Menu
from
'
../Components/Menu
'
;
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
import
{
Link
}
from
'
react-router-dom
'
;
import
{
Link
,
Redirect
}
from
'
react-router-dom
'
;
import
{
Container
,
Row
,
Col
,
Card
,
Accordion
,
Button
}
from
'
react-bootstrap
'
;
import
{
Container
,
Row
,
Col
,
Card
,
Accordion
,
Button
}
from
'
react-bootstrap
'
;
import
CARD
from
'
../Components/Card
'
;
import
CARD
from
'
../Components/Card
'
;
...
@@ -9,15 +9,25 @@ function Notice() {
...
@@ -9,15 +9,25 @@ function Notice() {
const
[
show
,
setShow
]
=
useState
(
false
);
const
[
show
,
setShow
]
=
useState
(
false
);
const
[
notices
,
setNotices
]
=
useState
([]);
const
[
notices
,
setNotices
]
=
useState
([]);
const
[
user
,
setUser
]
=
useState
({
role
:
""
})
const
[
user
,
setUser
]
=
useState
({
role
:
""
})
const
[
state
,
setState
]
=
useState
()
useEffect
(()
=>
{
useEffect
(()
=>
{
acheck
();
acheck
();
getNotice
();
getNotice
();
},
[]);
},
[]);
if
(
state
)
return
<
Redirect
to
=
"
/
"
/>
;
function
acheck
()
{
function
acheck
()
{
axios
.
get
(
`/users/
${
localStorage
.
getItem
(
'
_id
'
)}
`
)
axios
.
get
(
`/users/
${
localStorage
.
getItem
(
'
_id
'
)}
`
,
{
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
})
.
then
(
res
=>
{
.
then
(
res
=>
{
if
(
res
.
status
!==
201
)
{
alert
(
res
.
data
.
error
);
localStorage
.
clear
();
setState
(
true
);
}
if
(
res
.
data
.
role
==
"
admin
"
)
{
if
(
res
.
data
.
role
==
"
admin
"
)
{
setUser
(
res
.
data
)
setUser
(
res
.
data
)
}
}
...
...
server/client/src/Pages/SignupPage.js
View file @
ec0852e1
...
@@ -67,7 +67,6 @@ function Signup() {
...
@@ -67,7 +67,6 @@ function Signup() {
}).
then
(
res
=>
{
}).
then
(
res
=>
{
if
(
res
.
status
===
404
)
return
alert
(
res
.
data
.
error
)
if
(
res
.
status
===
404
)
return
alert
(
res
.
data
.
error
)
alert
(
"
회원가입이 완료되었습니다!
"
)
alert
(
"
회원가입이 완료되었습니다!
"
)
setState
(
true
);
setState
(
true
);
})
})
.
catch
(
err
=>
{
.
catch
(
err
=>
{
...
...
server/routes/login.js
View file @
ec0852e1
...
@@ -37,7 +37,7 @@ router.post('/', function (req, res, next) {
...
@@ -37,7 +37,7 @@ router.post('/', function (req, res, next) {
const
token
=
jwt
.
sign
({
const
token
=
jwt
.
sign
({
id
:
users
.
id
,
id
:
users
.
id
,
},
process
.
env
.
JWT_SECRET
,
{
},
process
.
env
.
JWT_SECRET
,
{
expiresIn
:
'
1
m
'
,
expiresIn
:
'
1
h
'
,
});
});
return
res
.
status
(
201
).
json
({
return
res
.
status
(
201
).
json
({
token
,
token
,
...
...
server/routes/reserves.js
View file @
ec0852e1
...
@@ -27,7 +27,8 @@ router.post('/', function (req, res, next) {
...
@@ -27,7 +27,8 @@ router.post('/', function (req, res, next) {
room
:
req
.
body
.
room
,
room
:
req
.
body
.
room
,
reason
:
req
.
body
.
reason
,
reason
:
req
.
body
.
reason
,
students
:
req
.
body
.
students
,
students
:
req
.
body
.
students
,
approve
:
req
.
body
.
approve
,
approve
:
true
,
check
:
true
,
num
:
req
.
body
.
students
.
length
+
1
,
num
:
req
.
body
.
students
.
length
+
1
,
});
});
...
@@ -79,15 +80,25 @@ router.get('/room/:room', function (req, res, next) {
...
@@ -79,15 +80,25 @@ router.get('/room/:room', function (req, res, next) {
})
})
})
})
router
.
get
(
'
/:_id
'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'
/:_id
'
,
verifyToken
,
function
(
req
,
res
,
next
)
{
console
.
log
(
'
/reserves get req.params
'
,
req
.
params
)
console
.
log
(
'
/reserves get req.params
'
,
req
.
params
)
Reserve
.
find
({
user
:
req
.
params
.
_id
},
function
(
err
,
reserve
)
{
Reserve
.
find
({
user
:
req
.
params
.
_id
},
function
(
err
,
reserve
)
{
if
(
err
)
return
res
.
status
(
500
).
json
({
error
:
err
});
if
(
err
)
return
res
.
status
(
500
).
json
({
error
:
err
});
res
.
status
(
201
).
json
(
reserve
);
// console.log(reserve, Date.now())
const
reserves
=
reserve
.
map
(
item
=>
(
new
Date
(
item
.
end
)
>=
Date
.
now
()
?
item
:
""
));
if
(
!
reserves
)
{
console
.
log
(
"
no신청
"
)
res
.
status
(
404
).
json
({
error
:
"
신청내역이 없습니다.
"
})
}
console
.
log
(
"
reserves
"
,
reserves
)
res
.
status
(
201
).
json
(
reserves
);
})
})
});
});
router
.
get
(
'
/admin/:_id
'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'
/admin/:_id
'
,
verifyToken
,
function
(
req
,
res
,
next
)
{
console
.
log
(
'
/reserves/admin get req.params
'
,
req
.
params
)
console
.
log
(
'
/reserves/admin get req.params
'
,
req
.
params
)
Reserve
.
find
({
approve
:
false
}).
populate
(
'
user
'
).
exec
(
function
(
err
,
reserve
)
{
Reserve
.
find
({
approve
:
false
}).
populate
(
'
user
'
).
exec
(
function
(
err
,
reserve
)
{
if
(
err
)
return
res
.
status
(
500
).
json
({
error
:
err
});
if
(
err
)
return
res
.
status
(
500
).
json
({
error
:
err
});
...
...
server/routes/users.js
View file @
ec0852e1
...
@@ -34,7 +34,7 @@ router.post('/', function (req, res, next) {
...
@@ -34,7 +34,7 @@ router.post('/', function (req, res, next) {
})
})
});
});
router
.
get
(
'
/:_id
'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'
/:_id
'
,
verifyToken
,
function
(
req
,
res
,
next
)
{
console
.
log
(
'
/users get req.params
'
,
req
.
params
)
console
.
log
(
'
/users get req.params
'
,
req
.
params
)
User
.
findOne
({
_id
:
req
.
params
.
_id
},
function
(
err
,
user
)
{
User
.
findOne
({
_id
:
req
.
params
.
_id
},
function
(
err
,
user
)
{
if
(
err
)
return
res
.
status
(
500
).
json
({
error
:
err
});
if
(
err
)
return
res
.
status
(
500
).
json
({
error
:
err
});
...
...
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