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
butter-studio
Commits
1241f3e0
Commit
1241f3e0
authored
Jul 23, 2021
by
Kim, Subin
Browse files
cinema controller
parent
b3d6dfc5
Changes
1
Show whitespace changes
Inline
Side-by-side
server/controllers/cinema.controller.js
0 → 100644
View file @
1241f3e0
import
{
Cinema
}
from
"
../db/index.js
"
;
const
getAll
=
async
(
req
,
res
)
=>
{
try
{
const
info
=
await
Cinema
.
findOne
({
where
:
{
id
:
1
},
attributes
:
[
'
cinemaName
'
,
'
transportation
'
,
'
parking
'
,
'
address
'
]
})
return
res
.
json
(
info
)
}
catch
(
error
)
{
return
res
.
status
(
500
).
send
(
error
.
message
||
"
영화관 정보 가져오는 중 에러 발생
"
)
}
}
const
edit
=
async
(
req
,
res
)
=>
{
try
{
let
response
=
null
const
result
=
await
Cinema
.
findOrCreate
({
where
:
{
id
:
1
},
defaults
:
{
...
req
.
body
}
})
if
(
!
result
[
1
])
{
const
updateData
=
await
Cinema
.
update
({
...
req
.
body
},
{
where
:
{
id
:
1
}
})
response
=
updateData
}
else
response
=
result
[
0
]
return
res
.
json
(
response
)
}
catch
(
error
)
{
return
res
.
status
(
500
).
send
(
error
.
message
||
"
영화관 정보 수정 중 에러 발생
"
)
}
}
export
default
{
getAll
,
edit
}
\ No newline at end of file
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