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
01fc5d96
Commit
01fc5d96
authored
Jul 28, 2021
by
한규민
Browse files
병합
parents
2210462f
067778dd
Changes
41
Show whitespace changes
Inline
Side-by-side
client/src/scss/custom.scss
View file @
01fc5d96
...
...
@@ -41,7 +41,7 @@ $theme-colors: map-merge($theme-colors, $custom-colors);
font-style
:
normal
;
}
@media
(
max-width
:
76
8
px
)
{
@media
(
max-width
:
76
7
px
)
{
// .carousel-inner .carousel-item > div {
// display: none;
// }
...
...
package-lock.json
View file @
01fc5d96
...
...
@@ -1181,6 +1181,11 @@
"resolved"
:
"https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz"
,
"integrity"
:
"sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
},
"nodemailer"
:
{
"version"
:
"6.6.3"
,
"resolved"
:
"https://registry.npmjs.org/nodemailer/-/nodemailer-6.6.3.tgz"
,
"integrity"
:
"sha512-faZFufgTMrphYoDjvyVpbpJcYzwyFnbAMmQtj1lVBYAUSm3SOy2fIdd9+Mr4UxPosBa0JRw9bJoIwQn+nswiew=="
},
"nodemon"
:
{
"version"
:
"2.0.12"
,
"resolved"
:
"https://registry.npmjs.org/nodemon/-/nodemon-2.0.12.tgz"
,
...
...
package.json
View file @
01fc5d96
...
...
@@ -23,6 +23,7 @@
"
express
"
:
"
^4.17.1
"
,
"
jsonwebtoken
"
:
"
^8.5.1
"
,
"
multer
"
:
"
^1.4.2
"
,
"
nodemailer
"
:
"
^6.6.3
"
,
"
pg
"
:
"
^8.6.0
"
,
"
pg-hstore
"
:
"
^2.3.4
"
,
"
sequelize
"
:
"
^6.6.4
"
,
...
...
server/config/app.config.js
View file @
01fc5d96
...
...
@@ -5,6 +5,7 @@ const config = {
jwtExpires
:
'
7d
'
,
cookieName
:
'
butterStudio
'
,
cookieMaxAge
:
60
*
60
*
24
*
7
*
1000
,
kakaoAdminKey
:
'
e3ce7106688a35e072e2630daa9d7250
'
,
}
export
default
config
\ No newline at end of file
server/controllers/cinema.controller.js
View file @
01fc5d96
...
...
@@ -4,7 +4,7 @@ const getAll = async (req, res) => {
try
{
const
info
=
await
Cinema
.
findOne
({
where
:
{
id
:
1
},
attributes
:
[
'
cinemaName
'
,
'
transportation
'
,
'
parking
'
,
'
address
'
]
attributes
:
[
'
cinemaName
'
,
'
transportation
'
,
'
parking
'
,
'
address
'
,
'
moreFeeInfo
'
]
})
return
res
.
json
(
info
)
}
catch
(
error
)
{
...
...
server/controllers/email.controller.js
0 → 100644
View file @
01fc5d96
import
nodemailer
from
"
nodemailer
"
const
SendMail
=
async
(
req
,
res
)
=>
{
// console.log(req.body)
const
{
email
}
=
req
.
body
console
.
log
(
email
)
const
sendMail
=
async
(
email
)
=>
{
// 메일을 전달해줄 객체
const
transporter
=
nodemailer
.
createTransport
({
// service: "gmail",
host
:
'
smtp.gmail.com
'
,
port
:
465
,
secure
:
true
,
auth
:
{
type
:
"
OAuth2
"
,
user
:
"
angelayoon99@gmail.com
"
,
clientId
:
process
.
env
.
GMAIL_CLIENTID
,
clientSecret
:
process
.
env
.
GMAIL_CLIENTSECRET
,
accessToken
:
process
.
env
.
GMAIL_ACCESS_TOKEN
,
refreshToken
:
process
.
env
.
GMAIL_REFRESH_TOKEN
,
},
tls
:
{
rejectUnauthorized
:
false
,
},
});
// 메일 옵션
const
mailOptions
=
{
from
:
`윤지원 <angelayoon99@gmail.com>`
,
to
:
"
jiwon5393@naver.com
"
,
subject
:
"
사용자 계정 확인용 메일.
"
,
text
:
"
Test Mail from Test Server.
"
,
};
// 메일 전송
try
{
const
mailResult
=
await
transporter
.
sendMail
(
mailOptions
);
console
.
log
(
`Mail sent - ID :
${
mailResult
.
messageId
}
`
);
}
catch
(
err
)
{
console
.
log
(
"
Mail Sending Failuer.
"
);
console
.
log
(
err
);
}
}
sendMail
(
email
);
}
export
default
{
SendMail
}
\ No newline at end of file
server/controllers/kakaopay.controller.js
0 → 100644
View file @
01fc5d96
import
axios
from
'
axios
'
import
config
from
"
../config/app.config.js
"
;
const
success
=
(
req
,
res
)
=>
{
return
res
.
json
({
message
:
'
Success
'
})
}
const
fail
=
(
req
,
res
)
=>
{
return
res
.
json
({
message
:
'
Failed
'
})
}
const
cancel
=
(
req
,
res
)
=>
{
return
res
.
json
({
message
:
'
Canceled
'
})
}
const
singleTest
=
async
(
req
,
res
)
=>
{
try
{
const
item
=
req
.
body
const
data
=
[]
for
(
let
property
in
item
)
{
let
encodedKey
=
encodeURIComponent
(
property
);
let
encodedValue
=
encodeURIComponent
(
item
[
property
]);
data
.
push
(
encodedKey
+
"
=
"
+
encodedValue
);
}
const
bodyData
=
data
.
join
(
'
&
'
)
const
response
=
await
axios
.
post
(
'
https://kapi.kakao.com/v1/payment/ready
'
,
bodyData
,
{
headers
:
{
'
Authorization
'
:
`KakaoAK
${
config
.
kakaoAdminKey
}
`
,
'
Content-Type
'
:
'
application/x-www-form-urlencoded;charset=UTF-8
'
,
},
})
const
resp
=
response
.
data
console
.
log
(
'
resp
'
,
resp
)
res
.
json
({
redirect_url
:
resp
.
next_redirect_pc_url
})
}
catch
(
error
)
{
console
.
log
(
error
)
}
}
export
default
{
success
,
fail
,
cancel
,
singleTest
}
\ No newline at end of file
server/controllers/movie.controller.js
View file @
01fc5d96
import
axios
from
'
axios
'
import
sequelize
from
'
sequelize
'
;
const
{
Op
}
=
sequelize
import
{
Movie
}
from
'
../db/index.js
'
import
sequelize
from
'
sequelize
'
const
{
Op
}
=
sequelize
const
getMovieByCategory
=
async
(
req
,
res
,
next
,
category
)
=>
{
try
{
...
...
@@ -96,8 +96,7 @@ const getAllMovie = async (req, res, next) => {
const
{
pageNum
}
=
req
.
query
const
now
=
new
Date
()
const
monthAgo
=
new
Date
(
now
.
setMonth
(
now
.
getMonth
()
-
1
)).
toJSON
().
split
(
/T/
)[
0
]
// const response = await axios.get(`https://api.themoviedb.org/3/discover/movie?api_key=${process.env.TMDB_APP_KEY}&language=ko-KR®ion=KR&sort_by=release_date.asc&release_date.gte=${monthAgo}&page=${pageNum}`)
const
response
=
await
axios
.
get
(
`https://api.themoviedb.org/3/discover/movie?api_key=
${
process
.
env
.
TMDB_APP_KEY
}
&language=ko-KR®ion=KR&sort_by=release_date.asc&release_date.gte=
${
monthAgo
}
&page=6`
)
const
response
=
await
axios
.
get
(
`https://api.themoviedb.org/3/discover/movie?api_key=
${
process
.
env
.
TMDB_APP_KEY
}
&language=ko-KR®ion=KR&sort_by=release_date.asc&release_date.gte=
${
monthAgo
}
&page=
${
pageNum
}
`
)
req
.
TMDBmovies
=
response
.
data
.
results
next
()
}
catch
(
error
)
{
...
...
server/controllers/ticketfee.controller.js
0 → 100644
View file @
01fc5d96
import
{
TicketFee
}
from
"
../db/index.js
"
;
const
getAll
=
async
(
req
,
res
)
=>
{
try
{
const
findAll
=
await
TicketFee
.
findAll
({
attributes
:
{
exclude
:
[
'
createdAt
'
,
'
updatedAt
'
]
}
})
return
res
.
json
(
findAll
)
}
catch
(
error
)
{
return
res
.
status
(
500
).
send
(
error
.
message
||
"
관람료 정보 가져오는 중 에러 발생
"
)
}
}
const
getOne
=
async
(
req
,
res
)
=>
{
try
{
const
{
theaterType
}
=
req
.
params
const
find
=
await
TicketFee
.
findOne
({
where
:
{
theaterType
:
theaterType
},
attributes
:
{
exclude
:
[
'
createdAt
'
,
'
updatedAt
'
]
}
})
if
(
!
find
)
throw
new
Error
(
"
해당 정보를 찾지 못했습니다.
"
);
return
res
.
json
(
find
)
}
catch
(
error
)
{
return
res
.
status
(
500
).
send
(
error
.
message
||
"
관람료 정보 가져오는 중 에러 발생
"
)
}
}
const
edit
=
async
(
req
,
res
)
=>
{
try
{
const
{
theaterType
}
=
req
.
body
let
response
=
null
const
result
=
await
TicketFee
.
findOrCreate
({
where
:
{
theaterType
:
theaterType
},
defaults
:
{
...
req
.
body
}
})
if
(
!
result
[
1
])
{
const
updateData
=
await
TicketFee
.
update
({
...
req
.
body
},
{
where
:
{
theaterType
:
theaterType
}
})
response
=
updateData
}
else
response
=
result
[
0
]
return
res
.
json
(
response
)
}
catch
(
error
)
{
return
res
.
status
(
500
).
send
(
error
.
message
||
"
관람료 정보 수정 중 에러 발생
"
)
}
}
const
remove
=
async
(
req
,
res
)
=>
{
try
{
const
{
theaterType
}
=
req
.
query
const
delNum
=
await
TicketFee
.
destroy
({
where
:
{
theaterType
:
theaterType
}
})
if
(
delNum
)
res
.
json
(
delNum
)
else
throw
new
Error
(
"
해당 정보를 서버에서 삭제하는데 실패했습니다.
"
);
}
catch
(
error
)
{
return
res
.
status
(
500
).
send
(
error
.
message
||
"
관람료 정보 삭제 중 에러 발생
"
)
}
}
export
default
{
getAll
,
getOne
,
edit
,
remove
}
\ No newline at end of file
server/db/index.js
View file @
01fc5d96
...
...
@@ -3,6 +3,10 @@ import UserModel from "../models/user.model.js";
import
RoleModel
from
"
../models/role.model.js
"
;
import
MovieModel
from
"
../models/movie.model.js
"
;
import
CinemaModel
from
"
../models/cinema.model.js
"
;
import
TheaterModel
from
"
../models/theater.model.js
"
;
import
TicketFeeModel
from
"
../models/ticketfee.model.js
"
;
import
TimeTableModel
from
'
../models/role.model.js
'
;
import
ReservationModel
from
'
../models/reservation.model.js
'
;
import
dbConfig
from
"
../config/db.config.js
"
;
const
sequelize
=
new
Sequelize
(
...
...
@@ -25,14 +29,24 @@ const User = UserModel(sequelize)
const
Role
=
RoleModel
(
sequelize
)
const
Movie
=
MovieModel
(
sequelize
)
const
Cinema
=
CinemaModel
(
sequelize
)
const
Theater
=
TheaterModel
(
sequelize
)
const
TicketFee
=
TicketFeeModel
(
sequelize
)
const
TimeTable
=
TimeTableModel
(
sequelize
)
const
Reservation
=
ReservationModel
(
sequelize
)
User
.
belongsTo
(
Role
);
Role
.
hasOne
(
User
);
TicketFee
.
hasOne
(
Theater
,
{
foreignKey
:
"
theaterType
"
,
targetKey
:
"
theaterType
"
,
onDelete
:
"
Cascade
"
});
export
{
sequelize
,
User
,
Role
,
Movie
,
Cinema
Cinema
,
Theater
,
TicketFee
,
TimeTable
,
Reservation
}
\ No newline at end of file
server/index.js
View file @
01fc5d96
...
...
@@ -10,7 +10,7 @@ dotenv.config({
});
sequelize
.
sync
({
force
:
fals
e
})
.
sync
({
force
:
tru
e
})
.
then
(
async
()
=>
{
await
Promise
.
all
(
Object
.
keys
(
ROLE_NAME
).
map
((
name
)
=>
{
...
...
server/models/cinema.model.js
View file @
01fc5d96
...
...
@@ -22,6 +22,9 @@ const CinemaModel = (sequelize) => {
},
address
:
{
type
:
DataTypes
.
STRING
},
moreFeeInfo
:
{
type
:
DataTypes
.
TEXT
}
},
{
...
...
server/models/reservation.model.js
0 → 100644
View file @
01fc5d96
import
Sequelize
from
"
sequelize
"
;
const
{
DataTypes
}
=
Sequelize
;
const
ReservationModel
=
(
sequelize
)
=>
{
const
Reservation
=
sequelize
.
define
(
"
reservation
"
,
{
id
:
{
type
:
DataTypes
.
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
,
},
movieId
:
{
type
:
DataTypes
.
INTEGER
,
},
theater
:
{
type
:
DataTypes
.
INTEGER
,
},
row
:
{
type
:
DataTypes
.
STRING
,
},
col
:
{
type
:
DataTypes
.
INTEGER
,
},
timetable
:{
type
:
DataTypes
.
INTEGER
,
},
user
:{
type
:
DataTypes
.
INTEGER
,
},
payment
:{
type
:
DataTypes
.
INTEGER
,
}
},
{
timestamps
:
true
,
freezeTableName
:
true
,
tableName
:
"
reservations
"
}
);
return
Reservation
;
};
export
default
ReservationModel
;
\ No newline at end of file
server/models/theater.model.js
0 → 100644
View file @
01fc5d96
import
Sequelize
from
"
sequelize
"
;
const
{
DataTypes
}
=
Sequelize
;
const
TheaterModel
=
(
sequelize
)
=>
{
const
Theater
=
sequelize
.
define
(
"
theater
"
,
{
theaterNum
:
{
type
:
DataTypes
.
INTEGER
,
primaryKey
:
true
,
},
rows
:
{
type
:
DataTypes
.
STRING
,
},
columns
:
{
type
:
DataTypes
.
INTEGER
,
}
},
{
timestamps
:
true
,
freezeTableName
:
true
,
tableName
:
"
theaters
"
}
);
return
Theater
;
};
export
default
TheaterModel
;
\ No newline at end of file
server/models/ticketfee.model.js
0 → 100644
View file @
01fc5d96
import
Sequelize
from
"
sequelize
"
;
const
{
DataTypes
}
=
Sequelize
;
const
TicketFeeModel
=
(
sequelize
)
=>
{
const
TicketFee
=
sequelize
.
define
(
"
ticketfee
"
,
{
id
:
{
type
:
DataTypes
.
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
,
},
theaterType
:
{
type
:
DataTypes
.
STRING
},
weekdays
:
{
type
:
DataTypes
.
INTEGER
},
weekend
:
{
type
:
DataTypes
.
INTEGER
},
morning
:
{
type
:
DataTypes
.
INTEGER
},
day
:
{
type
:
DataTypes
.
INTEGER
},
night
:
{
type
:
DataTypes
.
INTEGER
},
youth
:
{
type
:
DataTypes
.
INTEGER
},
adult
:
{
type
:
DataTypes
.
INTEGER
},
senior
:
{
type
:
DataTypes
.
INTEGER
},
defaultPrice
:
{
type
:
DataTypes
.
INTEGER
,
}
},
{
timestamps
:
true
,
freezeTableName
:
true
,
tableName
:
"
ticketfees
"
}
);
return
TicketFee
;
};
export
default
TicketFeeModel
;
\ No newline at end of file
server/models/timetable.model.js
0 → 100644
View file @
01fc5d96
import
Sequelize
from
"
sequelize
"
;
const
{
DataTypes
}
=
Sequelize
;
const
TimeTableModel
=
(
sequelize
)
=>
{
const
TimeTable
=
sequelize
.
define
(
"
timetable
"
,
{
id
:
{
type
:
DataTypes
.
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
,
},
theater
:
{
type
:
DataTypes
.
INTEGER
,
},
movieId
:
{
type
:
DataTypes
.
INTEGER
,
},
title
:
{
type
:
DataTypes
.
STRING
,
},
release_date
:
{
type
:
DataTypes
.
STRING
},
date
:
{
type
:
DataTypes
.
STRING
,
},
time
:
{
type
:
DataTypes
.
TIME
,
},
},
{
// timestamps: true,
freezeTableName
:
true
,
tableName
:
"
timetables
"
}
);
return
TimeTable
;
};
export
default
TimeTableModel
;
\ No newline at end of file
server/routes/cinema.route.js
View file @
01fc5d96
import
express
from
"
express
"
;
import
cinemaCtrl
from
"
../controllers/cinema.controller.js
"
;
import
ticketfeeCtrl
from
"
../controllers/ticketfee.controller.js
"
;
const
router
=
express
.
Router
();
router
.
route
(
"
/
"
)
.
route
(
"
/
cinema
"
)
.
get
(
cinemaCtrl
.
getAll
)
.
put
(
cinemaCtrl
.
edit
)
router
.
route
(
"
/ticketfee/:theaterType
"
)
.
get
(
ticketfeeCtrl
.
getOne
)
router
.
route
(
"
/ticketfee
"
)
.
get
(
ticketfeeCtrl
.
getAll
)
.
put
(
ticketfeeCtrl
.
edit
)
.
delete
(
ticketfeeCtrl
.
remove
)
export
default
router
;
\ No newline at end of file
server/routes/email.route.js
0 → 100644
View file @
01fc5d96
import
express
from
"
express
"
;
import
EmailCtrl
from
'
../controllers/email.controller.js
'
const
router
=
express
.
Router
();
router
.
route
(
"
/send
"
)
.
post
(
EmailCtrl
.
SendMail
)
export
default
router
\ No newline at end of file
server/routes/index.js
View file @
01fc5d96
...
...
@@ -2,11 +2,15 @@ import express from "express";
import
userRouter
from
'
./user.route.js
'
import
movieRouter
from
'
./movie.route.js
'
import
cinemaRouter
from
"
./cinema.route.js
"
;
import
kakaopayRouter
from
"
./kakaopay.route.js
"
;
import
emailRouter
from
'
./email.route.js
'
const
router
=
express
.
Router
();
router
.
use
(
'
/movie
'
,
movieRouter
)
router
.
use
(
'
/auth
'
,
userRouter
)
router
.
use
(
'
/cinema
'
,
cinemaRouter
)
router
.
use
(
'
/kakaopay
'
,
kakaopayRouter
)
router
.
use
(
'
/email
'
,
emailRouter
)
router
.
use
(
'
/info
'
,
cinemaRouter
)
export
default
router
;
\ No newline at end of file
server/routes/kakaopay.route.js
0 → 100644
View file @
01fc5d96
import
express
from
'
express
'
import
kakaopayCtrl
from
'
../controllers/kakaopay.controller.js
'
const
router
=
express
.
Router
()
router
.
route
(
'
/success
'
)
.
get
(
kakaopayCtrl
.
success
)
router
.
route
(
'
/fail
'
)
.
get
(
kakaopayCtrl
.
fail
)
router
.
route
(
'
/cancel
'
)
.
get
(
kakaopayCtrl
.
cancel
)
router
.
route
(
'
/test/single
'
)
.
post
(
kakaopayCtrl
.
singleTest
)
export
default
router
Prev
1
2
3
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