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
26e786c6
Commit
26e786c6
authored
Aug 02, 2021
by
Jiwon Yoon
Browse files
Merge branch 'jiwon'
parents
dd1c9aee
54b1ec39
Changes
29
Show whitespace changes
Inline
Side-by-side
server/controllers/theater.controller.js
View file @
26e786c6
import
{
Theater
,
TheaterType
}
from
"
../db/index.js
"
;
const
getTheaterInfo
=
async
(
req
,
res
)
=>
{
const
{
theaterN
um
}
=
req
.
body
const
{
theaterN
ame
}
=
req
.
body
try
{
const
theaterInfo
=
await
Theater
.
findOne
({
where
:
{
theaterN
um
:
theaterN
um
},
attributes
:
[
'
theaterN
um
'
,
'
rows
'
,
'
columns
'
,
'
theaterType
'
]
where
:
{
theaterN
ame
:
String
(
theaterN
ame
)
},
attributes
:
[
'
theaterN
ame
'
,
'
rows
'
,
'
columns
'
]
})
// console.log("theaterInfo====",theaterInfo)
return
res
.
json
(
theaterInfo
)
...
...
server/controllers/user.controller.js
View file @
26e786c6
import
jwt
from
"
jsonwebtoken
"
;
import
config
from
"
../config/app.config.js
"
;
import
{
User
,
Role
}
from
'
../db/index.js
'
;
<<<<<<<
HEAD
import
{
User
,
Role
,
Guest
}
from
'
../db/index.js
'
;
const
getUser
=
async
(
req
,
res
)
=>
{
try
{
if
(
req
.
cookies
)
{
if
(
req
.
cookies
.
butterStudio
)
{
const
token
=
req
.
cookies
.
butterStudio
;
const
decoded
=
jwt
.
verify
(
token
,
config
.
jwtSecret
);
res
.
json
(
decoded
);
...
...
@@ -17,9 +16,6 @@ const getUser = async (req, res) => {
return
res
.
status
(
500
).
send
(
"
유저를 가져오지 못했습니다.
"
);
}
}
=======
// import Twilio from "twilio";
>>>>>>>
jiwon
const
login
=
async
(
req
,
res
)
=>
{
try
{
...
...
@@ -175,7 +171,6 @@ const comparePw = async (req, res) => {
}
}
<<<<<<<
HEAD
const
modifyUser
=
async
(
req
,
res
)
=>
{
try
{
const
token
=
req
.
cookies
.
butterStudio
;
...
...
@@ -189,10 +184,10 @@ const modifyUser = async (req, res) => {
if
(
decoded
)
{
let
user
=
await
User
.
findOne
({
where
:
{
id
:
decoded
.
id
}
});
await
user
.
update
({
email
:
userEmail
,
nickname
:
userNickName
,
phoneNumber
:
userMbnum
,
password
:
userPassword
,
email
:
userEmail
,
nickname
:
userNickName
,
phoneNumber
:
userMbnum
,
password
:
userPassword
,
});
res
.
json
(
user
);
}
...
...
@@ -202,21 +197,37 @@ const modifyUser = async (req, res) => {
res
.
status
(
500
).
send
(
"
수정 에러. 나중에 다시 시도 해주세요
"
);
}
};
=======
const
getUserInfo
=
async
(
req
,
res
)
=>
{
const
{
id
}
=
req
.
body
const
getUserInfo
=
async
(
req
,
res
)
=>
{
const
{
id
}
=
req
.
body
console
.
log
(
id
)
try
{
const
userInfo
=
await
User
.
findOne
({
where
:
{
id
:
id
},
attributes
:[
"
userId
"
,
"
email
"
,
"
nickname
"
,
"
birth
"
,
"
phoneNumber
"
]
where
:
{
id
:
id
},
attributes
:
[
"
id
"
,
"
userId
"
,
"
email
"
,
"
nickname
"
,
"
birth
"
,
"
phoneNumber
"
]
})
res
.
json
(
userInfo
)
}
catch
(
error
)
{
res
.
status
(
500
).
send
(
"
회원정보 불러오기 실패
"
);
}
}
const
saveGuestInfo
=
async
(
req
,
res
)
=>
{
const
{
name
,
email
,
birth
,
phoneNumber
,
password
}
=
req
.
body
try
{
const
newGuest
=
await
Guest
.
create
({
name
:
name
,
email
:
email
,
birth
:
birth
,
phoneNumber
:
phoneNumber
,
password
:
password
,
});
res
.
json
(
newGuest
);
}
catch
(
error
)
{
console
.
log
(
error
)
res
.
status
(
500
).
send
(
"
비회원정보 등록 실패
"
);
}
}
>>>>>>>
jiwon
export
default
{
getUser
,
...
...
@@ -226,10 +237,8 @@ export default {
confirmMbnum
,
signup
,
getNickName
,
<<<<<<<
HEAD
comparePw
,
modifyUser
=======
getUserInfo
>>>>>>>
jiwon
modifyUser
,
getUserInfo
,
saveGuestInfo
}
server/db/index.js
View file @
26e786c6
...
...
@@ -8,6 +8,7 @@ import TheaterTypeModel from "../models/theatertype.model.js";
import
TicketFeeModel
from
"
../models/ticketfee.model.js
"
;
import
TimeTableModel
from
'
../models/role.model.js
'
;
import
ReservationModel
from
'
../models/reservation.model.js
'
;
import
GuestModel
from
'
../models/guest.model.js
'
import
dbConfig
from
"
../config/db.config.js
"
;
const
sequelize
=
new
Sequelize
(
...
...
@@ -35,6 +36,7 @@ const TheaterType = TheaterTypeModel(sequelize)
const
TicketFee
=
TicketFeeModel
(
sequelize
)
const
TimeTable
=
TimeTableModel
(
sequelize
)
const
Reservation
=
ReservationModel
(
sequelize
)
const
Guest
=
GuestModel
(
sequelize
)
User
.
belongsTo
(
Role
);
Role
.
hasOne
(
User
);
...
...
@@ -53,5 +55,6 @@ export {
TheaterType
,
TicketFee
,
TimeTable
,
Reservation
Reservation
,
Guest
}
\ No newline at end of file
server/index.js
View file @
26e786c6
...
...
@@ -19,7 +19,7 @@ sequelize
);
const
adminRole
=
await
Role
.
findOne
({
where
:
{
name
:
"
admin
"
}
});
console
.
log
(
"
adminRole :
"
,
adminRole
);
//
console.log("adminRole : ", adminRole);
if
(
!
adminRole
)
{
await
User
.
create
({
userId
:
"
admin
"
,
...
...
server/models/guest.model.js
0 → 100644
View file @
26e786c6
import
Sequelize
from
"
sequelize
"
;
const
{
DataTypes
}
=
Sequelize
;
const
GuestModel
=
(
sequelize
)
=>
{
const
Guest
=
sequelize
.
define
(
"
guest
"
,
{
id
:
{
type
:
DataTypes
.
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
,
},
name
:
{
type
:
DataTypes
.
STRING
,
},
email
:
{
type
:
DataTypes
.
STRING
,
},
birth
:
{
type
:
DataTypes
.
STRING
,
},
phoneNumber
:
{
type
:
DataTypes
.
STRING
},
password
:
{
type
:
DataTypes
.
STRING
,
},
},
{
timestamps
:
true
,
freezeTableName
:
true
,
tableName
:
"
guests
"
,
}
);
return
Guest
};
export
default
GuestModel
\ No newline at end of file
server/models/reservation.model.js
View file @
26e786c6
...
...
@@ -26,11 +26,14 @@ const ReservationModel = (sequelize) => {
timetable
:{
type
:
DataTypes
.
INTEGER
,
},
userType
:{
type
:
DataTypes
.
STRING
,
},
user
:{
type
:
DataTypes
.
INTEGER
,
},
payment
:{
type
:
DataTypes
.
INTEGER
,
type
:
DataTypes
.
STRING
,
}
},
{
...
...
server/routes/index.js
View file @
26e786c6
import
express
from
"
express
"
;
import
userRouter
from
'
./user.route.js
'
import
movieRouter
from
'
./movie.route.js
'
import
theaterRouter
from
"
./theater.route.js
"
;
import
cinemaRouter
from
"
./cinema.route.js
"
;
import
kakaopayRouter
from
"
./kakaopay.route.js
"
;
import
emailRouter
from
'
./email.route.js
'
...
...
server/routes/reservation.route.js
View file @
26e786c6
...
...
@@ -7,4 +7,7 @@ const router = express.Router();
router
.
route
(
'
/findreservation
'
)
.
post
(
ReservationCtrl
.
findReservation
)
router
.
route
(
'
/save
'
)
.
post
(
ReservationCtrl
.
saveReservation
)
export
default
router
;
\ No newline at end of file
server/routes/user.route.js
View file @
26e786c6
...
...
@@ -40,11 +40,10 @@ router
.
route
(
"
/:id/:token
"
)
.
get
(
userCtrl
.
confirmMbnum
)
// router
// .route("/:iddd")
// .get(userCtrl.getNickName)
router
.
route
(
'
/getuserinfo
'
)
.
post
(
userCtrl
.
getUserInfo
)
router
.
route
(
'
/guest/save
'
)
.
post
(
userCtrl
.
saveGuestInfo
)
export
default
router
;
\ No newline at end of file
Prev
1
2
Next
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