Commit eacc9ce9 authored by 한규민's avatar 한규민
Browse files

Merge branch 'master' into gyumin

parents 19251ba0 c6fcbcbe
...@@ -3,52 +3,12 @@ import { Movie } from '../db/index.js' ...@@ -3,52 +3,12 @@ import { Movie } from '../db/index.js'
import sequelize from 'sequelize' import sequelize from 'sequelize'
const { Op } = sequelize const { Op } = sequelize
const getMovieByCategory = async (req, res, next, category) => { const getListfromDB = async (req, res) => {
try { try {
console.log(category) const findAll = await Movie.findAll({ attributes: ['movieId', 'title', 'release_date'] })
const TMDBmovieIds = [] res.json(findAll)
const movieIds = []
console.log(process.env.TMDB_APP_KEY)
const response = await axios.get(`https://api.themoviedb.org/3/movie/${category}?api_key=${process.env.TMDB_APP_KEY}&language=ko-KR&page=1`)
console.log(response.data)
const TMDBmovies = response.data.results
TMDBmovies.forEach(element => {
TMDBmovieIds.push(element.id)
})
console.log(TMDBmovies)
const responseAfterCompare = await Movie.findAll({
where: {
movieId: {
[Op.or]: TMDBmovieIds
}
}
})
responseAfterCompare.forEach(el => {
movieIds.push(el.movieId)
})
console.log('movieIds=', movieIds)
req.movieIds = movieIds
next()
} catch (error) { } catch (error) {
return res.status(500).send(error.message || "영화 가져오기 중 에러 발생"); return res.status(500).send(error.message || "영화 목록 가져오기 중 에러 발생");
}
}
const getMovieById = async (req, res) => {
try {
const movieIds = req.movieIds
console.log(movieIds)
const elements = await Promise.all(
movieIds.map(async (movieId) => {
const movie = await axios.get(`https://api.themoviedb.org/3/movie/${movieId}?api_key=${process.env.TMDB_APP_KEY}&language=ko-KR`)
return movie.data
})
)
console.log(elements)
res.json(elements)
} catch (error) {
return res.status(500).send(error.message || "영화 가져오기 중 에러 발생");
} }
} }
...@@ -66,13 +26,14 @@ const movieforAdmin = async (req, res) => { ...@@ -66,13 +26,14 @@ const movieforAdmin = async (req, res) => {
if (findDirectors.length !== 0) { if (findDirectors.length !== 0) {
const name = findDirectors.reduce((acc, cur, idx) => { const name = findDirectors.reduce((acc, cur, idx) => {
if (idx !== 0) return acc + ', ' + cur.name if (idx !== 0) return acc + ', ' + cur.name
else return acc + cur.name}, '') else return acc + cur.name
}, '')
newObj.name = name newObj.name = name
} else newObj.name = "없음" } else newObj.name = "없음"
return newObj return newObj
})) }))
findDirectorResult.forEach(element => TMDBmovies.forEach(movie => { findDirectorResult.forEach(element => TMDBmovies.forEach(movie => {
if (element.id === movie.id) movie.director = element.name if (element.id === movie.id) movie.director = element.name
})) }))
const responseAfterCompare = await Movie.findAll({ const responseAfterCompare = await Movie.findAll({
...@@ -104,22 +65,56 @@ const getAllMovie = async (req, res, next) => { ...@@ -104,22 +65,56 @@ const getAllMovie = async (req, res, next) => {
} }
} }
const getMovieList = async(req,res)=>{ const getMovieList = async (req, res) => {
const { category } = req.params
// console.log(category)
try { try {
const movieList = await Movie.findAll() const movieList = await Movie.findAll()
// console.log(movieList) const movieIds = []
const movieIds=[]
movieList.forEach(el => { movieList.forEach(el => {
movieIds.push(el.movieId) movieIds.push(el.movieId)
}) })
const elements = await Promise.all( const elements = await Promise.all(
movieIds.map(async (movieId) => { movieIds.map(async (movieId) => {
const movie = await axios.get(`https://api.themoviedb.org/3/movie/${movieId}?api_key=${process.env.TMDB_APP_KEY}&language=ko-KR`) const movie = await axios.get(`https://api.themoviedb.org/3/movie/${movieId}?api_key=${process.env.TMDB_APP_KEY}&language=ko-KR`)
return movie.data const cols = await Movie.findOne({
where: { "movieId": movieId },
attributes: ["ticket_sales", "vote_average"]
})
const totalReservationRate = Movie.sum('ticket_sales')
const rate = await Promise.all(cols.ticket_sales / totalReservationRate * 100)
return { ...movie.data, ticket_sales: rate, vote_average: cols.vote_average }
})
)
if (category === "popular") {
for (let i = 0; i < elements.length; i++) {
if (new Date(elements[i].release_date) > new Date()) {
elements.splice(i, 1);
i--;
}
}
elements.sort(function (a, b) {
return b.popularity - a.popularity
})
res.json(elements)
} else if (category === "upcoming") {
for (let i = 0; i < elements.length; i++) {
if (new Date(elements[i].release_date) <= new Date()) {
elements.splice(i, 1);
i--;
}
}
elements.sort(function (a, b) {
return a.release_date - b.release_date
})
res.json(elements)
} else {
elements.sort(function (a, b) {
return a.title - b.title
}) })
) res.json(elements)
console.log(elements) }
res.json(elements)
} catch (error) { } catch (error) {
console.log(error) console.log(error)
} }
...@@ -184,8 +179,7 @@ const findaboutAll = async (req, res, next) => { ...@@ -184,8 +179,7 @@ const findaboutAll = async (req, res, next) => {
} }
export default { export default {
getMovieByCategory, getListfromDB,
getMovieById,
getAllMovie, getAllMovie,
getMovieList, getMovieList,
create, create,
......
import axios from 'axios' import axios from 'axios'
import { Reservation,Theater } from '../db/index.js' import { Movie, Reservation, Theater } from '../db/index.js'
import sequelize from 'sequelize' import sequelize from 'sequelize'
const { Op } = sequelize const { Op } = sequelize
const findReservation = async (req,res) => { const findReservedSeats = async (req, res) => {
const {timetable} = req.body const { timetable } = req.body
try { try {
const reservedSeats = await Reservation.findAll({ const reservedSeats = await Reservation.findAll({
where: { where: {
timetable:timetable timetable: timetable
} }
}) })
res.json(reservedSeats) res.json(reservedSeats)
} catch (error) { } catch (error) {
return res.status(500).send(error.message || "이미 예매되어있는 좌석을 찾는 중 오류발생") res.status(500).send(error.message || "이미 예매되어있는 좌석을 찾는 중 오류발생")
}
}
const findReservation = async (req, res) => {
const { user } = req.body
try {
const reservation = await Reservation.findAll({
where: {
user: user
}
})
res.json(reservation)
} catch (error) {
res.status(500).send(error.message || "예매 내역들을 찾는 중 오류발생")
}
}
const findOneReservation = async (req, res) => {
const { userType, user } = req.body
try {
const reservation = await Reservation.findAll({
where: {
userType: userType,
user: user
},
})
console.log(reservation)
res.json(reservation)
} catch (error) {
res.status(500).send(error.message || "예매 내역을 찾는 중 오류 발생")
}
}
const saveReservation = async (req, res) => {
const { movieId, selectedTheater, timetable, payment, user, userType } = req.body
const rows = req.body.selectedSeats.map(el => el.split('-')[0])
const cols = req.body.selectedSeats.map(el => el.split('-')[1])
try {
for (let index = 0; index < rows.length; index++) {
const reservation = await Reservation.create({
user: user,
userType: userType,
movieId: movieId,
theater: selectedTheater,
row: rows[index],
col: cols[index],
timetable: timetable,
payment: payment
})
}
const movie = await Movie.findOne({
where: {
movieId: movieId
}
})
movie.ticket_sales++
await movie.save();
res.json({ message: '200 OK' })
} catch (error) {
console.log(error)
res.status(500).send(error.message || "예매DB에 저장 실패")
} }
} }
export default {findReservation} export default {
\ No newline at end of file findReservedSeats,
findReservation,
findOneReservation,
saveReservation
}
\ No newline at end of file
import { Theater, TicketFee } from "../db/index.js"; import { Theater, TheaterType } from "../db/index.js";
const getTheaterInfo = async (req, res) => { const getTheaterInfo = async (req, res) => {
const { theaterNum } = req.body const { theaterName } = req.body
try { try {
const theaterInfo = await Theater.findOne({ const theaterInfo = await Theater.findOne({
where: { theaterNum: theaterNum }, where: { theaterName: String(theaterName) },
attributes: ['theaterNum', 'rows', 'columns', 'theaterType'] attributes: ['theaterName', 'rows', 'columns']
}) })
// console.log("theaterInfo====",theaterInfo) // console.log("theaterInfo====",theaterInfo)
return res.json(theaterInfo) return res.json(theaterInfo)
...@@ -15,17 +15,27 @@ const getTheaterInfo = async (req, res) => { ...@@ -15,17 +15,27 @@ const getTheaterInfo = async (req, res) => {
} }
const getAll = async (req, res) => { const getAll = async (req, res) => {
try { try {
const findList = await Theater.findAll({ include: [{ model: TicketFee, attributes: ["theaterType"] }] }) const findList = await Theater.findAll({ attributes: { exclude: ['createdAt', 'updatedAt'] }, include: [TheaterType], order: [['theaterName']] })
console.log("Ads==", findList)
return res.json(findList) return res.json(findList)
} catch (error) { } catch (error) {
return res.status(500).send(error.message || "상영관 정보 가져오는 중 에러 발생") return res.status(500).send(error.message || "상영관 정보 가져오는 중 에러 발생")
} }
} }
const getOne = async (req, res) => {
try {
const { theaterId } = req.params
const find = await Theater.findOne({ where: { id: theaterId }, attributes: { exclude: ['createdAt', 'updatedAt'] } })
if (!find) throw new Error("해당 정보를 찾지 못했습니다.");
return res.json(find)
} catch (error) {
return res.status(500).send(error.message || "상영관 정보 가져오는 중 에러 발생")
}
}
const getTypes = async (req, res) => { const getTypes = async (req, res) => {
try { try {
const findTypes = await TicketFee.findAll({ attributes: ['id', 'theaterType'] }) const findTypes = await TheaterType.findAll({ attributes: { exclude: ['createdAt', 'updatedAt'] } })
return res.json(findTypes) return res.json(findTypes)
} catch (error) { } catch (error) {
return res.status(500).send(error.message || "상영관 정보 가져오는 중 에러 발생") return res.status(500).send(error.message || "상영관 정보 가져오는 중 에러 발생")
...@@ -34,10 +44,17 @@ const getTypes = async (req, res) => { ...@@ -34,10 +44,17 @@ const getTypes = async (req, res) => {
const submit = async (req, res) => { const submit = async (req, res) => {
try { try {
const { id } = req.body const { id, theatertypeId, theaterName, rows, columns } = req.body
let response = null let response = null
if (id) response = await Theater.update({ ...req.body }, { where: { id: id } }) if (id) response = await Theater.update({ theatertypeId, theaterName, rows, columns }, { where: { id: id } })
else response = await Theater.create({ ...req.body }) else {
const result = await Theater.findOrCreate({
where: { theaterName: theaterName },
defaults: { theatertypeId, theaterName, rows, columns }
})
if (!result[1]) throw new Error("이미 존재하는 이름의 상영관입니다. 다시 등록해주세요.");
else response = result[0]
}
return res.json(response) return res.json(response)
} catch (error) { } catch (error) {
return res.status(500).send(error.message || "상영관 정보 저장 중 에러 발생") return res.status(500).send(error.message || "상영관 정보 저장 중 에러 발생")
...@@ -46,7 +63,10 @@ const submit = async (req, res) => { ...@@ -46,7 +63,10 @@ const submit = async (req, res) => {
const remove = async (req, res) => { const remove = async (req, res) => {
try { try {
const { theaterId } = req.params
const delNum = await Theater.destroy({ where: { id: theaterId } })
if (delNum) res.json(delNum)
else throw new Error("해당 정보를 서버에서 삭제하는데 실패했습니다.");
} catch (error) { } catch (error) {
return res.status(500).send(error.message || "상영관 정보 삭제 중 에러 발생") return res.status(500).send(error.message || "상영관 정보 삭제 중 에러 발생")
} }
...@@ -54,6 +74,7 @@ const remove = async (req, res) => { ...@@ -54,6 +74,7 @@ const remove = async (req, res) => {
export default { export default {
getAll, getAll,
getOne,
getTypes, getTypes,
submit, submit,
remove, remove,
......
import { TicketFee } from "../db/index.js"; import { TheaterType, TicketFee } from "../db/index.js";
const getAll = async (req, res) => { const getAll = async (req, res) => {
try { try {
const findAll = await TicketFee.findAll({ attributes: { exclude: ['createdAt', 'updatedAt'] } }) const findAll = await TicketFee.findAll({ attributes: { exclude: ['createdAt', 'updatedAt'] }, include: [ TheaterType ] })
return res.json(findAll) return res.json(findAll)
} catch (error) { } catch (error) {
return res.status(500).send(error.message || "관람료 정보 가져오는 중 에러 발생") return res.status(500).send(error.message || "관람료 정보 가져오는 중 에러 발생")
...@@ -11,8 +11,9 @@ const getAll = async (req, res) => { ...@@ -11,8 +11,9 @@ const getAll = async (req, res) => {
const getOne = async (req, res) => { const getOne = async (req, res) => {
try { try {
const { theaterType } = req.params const { theaterTypeId } = req.params
const find = await TicketFee.findOne({ where: { theaterType: theaterType }, attributes: { exclude: ['createdAt', 'updatedAt'] } }) const find = await TicketFee.findOne({ where: { theatertypeId: theaterTypeId }, attributes: { exclude: ['createdAt', 'updatedAt'] }, include: [ TheaterType ] })
find.dataValues.theaterTypeName = find.dataValues.theatertype.dataValues.theaterTypeName
if (!find) throw new Error("해당 정보를 찾지 못했습니다."); if (!find) throw new Error("해당 정보를 찾지 못했습니다.");
return res.json(find) return res.json(find)
} catch (error) { } catch (error) {
...@@ -22,26 +23,29 @@ const getOne = async (req, res) => { ...@@ -22,26 +23,29 @@ const getOne = async (req, res) => {
const edit = async (req, res) => { const edit = async (req, res) => {
try { try {
const { theaterType } = req.body const { theatertypeId, theaterTypeName, defaultPrice, weekdays, weekend, morning, day, night, youth, adult, senior } = req.body
let response = null let response = null
const result = await TicketFee.findOrCreate({ const result = await TheaterType.findOrCreate({
where: { theaterType: theaterType }, where: { id: theatertypeId },
defaults: { ...req.body } defaults: { theaterTypeName: theaterTypeName }
}) })
if (!result[1]) { if (result[1]) {
const updateData = await TicketFee.update({ ...req.body }, { where: { theaterType: theaterType } }) response = await TicketFee.create({ theatertypeId: result[0].id, defaultPrice, weekdays, weekend, morning, day, night, youth, adult, senior })
response = updateData } else {
} else response = result[0] await TheaterType.update({ theaterTypeName: theaterTypeName }, { where: { id: theatertypeId } })
response = await TicketFee.update({ defaultPrice, weekdays, weekend, morning, day, night, youth, adult, senior }, { where: { theatertypeId: result[0].id } })
}
return res.json(response) return res.json(response)
} catch (error) { } catch (error) {
return res.status(500).send(error.message || "관람료 정보 수정 중 에러 발생") return res.status(500).send(error.message || "관람료 정보 추가 및 수정 중 에러 발생")
} }
} }
const remove = async (req, res) => { const remove = async (req, res) => {
try { try {
const { theaterType } = req.query const { theaterTypeId } = req.query
const delNum = await TicketFee.destroy({ where: { theaterType: theaterType } }) const delNum = await TicketFee.destroy({ where: { theatertypeId: theaterTypeId } })
await TheaterType.destroy({ where: { id: theaterTypeId } })
if (delNum) res.json(delNum) if (delNum) res.json(delNum)
else throw new Error("해당 정보를 서버에서 삭제하는데 실패했습니다."); else throw new Error("해당 정보를 서버에서 삭제하는데 실패했습니다.");
} catch (error) { } catch (error) {
......
import { TimeTable } from "../db/index.js";
import sequelize from 'sequelize'
const { Op } = sequelize
const submit = async (req, res) => {
try {
console.log("req.body==", req.body)
const { theater, runtime } = req.body
const result = theater.filter(async (theater) => {
const startDate = getDate(theater.start)
const endDate = getDate(theater.start, runtime)
// const isTimeTable = await TimeTable.findAll({
// where: {
// [Op.and]: [
// { theater: theater.theater },
// {
// [Op.and]: [
// { start_date: { [Op.lte]: endDate } },
// { end_date: { [Op.gte]: startDate } }
// ]
// }
// ]
// }
// })
// [Op.or]: [{ [Op.and]: [{ start_date: { [Op.gt]: startDate } }, { start_date: { [Op.gt]: endDate } }] },
// { [Op.and]: [{ end_date: { [Op.lt]: startDate } }, { end_date: { [Op.lt]: endDate } }] }]
console.log("isTimeTable==", isTimeTable)
return isTimeTable
})
console.log("result==", result)
} catch (error) {
return res.status(500).send(error.message || "상영시간표 저장 중 에러 발생")
}
}
const getDate = (string, runtime = 0) => {
const arr = string.split(':')
const date = new Date(0, 0, 0, Number(arr[0]), Number(arr[1]) + runtime)
// console.log("custom==", date.toString())
return date
}
export default {
submit
}
\ No newline at end of file
import jwt from "jsonwebtoken"; import jwt from "jsonwebtoken";
import config from "../config/app.config.js"; import config from "../config/app.config.js";
import { User, Role, ConfirmNum } from '../db/index.js'; import { User, Role, Guest, ConfirmNum } from '../db/index.js';
import fs from "fs"; import fs from "fs";
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import validator from "validator"; import validator from "validator";
...@@ -111,7 +111,8 @@ const confirmMbnum = async (req, res) => { ...@@ -111,7 +111,8 @@ const confirmMbnum = async (req, res) => {
const signature = hash.toString(CryptoJS.enc.Base64); const signature = hash.toString(CryptoJS.enc.Base64);
const phoneNumber = req.params.phone; const phoneNumber = req.params.phone;
console.log(uri,secretKey,accessKey); console.log(phoneNumber);
//인증번호 생성 //인증번호 생성
const verifyCode = Math.floor(Math.random() * (999999 - 100000)) + 100000; const verifyCode = Math.floor(Math.random() * (999999 - 100000)) + 100000;
console.log("verifyCode : ", verifyCode); console.log("verifyCode : ", verifyCode);
...@@ -412,14 +413,57 @@ const getUserInfo = async (req, res) => { ...@@ -412,14 +413,57 @@ const getUserInfo = async (req, res) => {
try { try {
const userInfo = await User.findOne({ const userInfo = await User.findOne({
where: { id: id }, where: { id: id },
attributes: ["userId", "email", "nickname", "birth", "phoneNumber"] attributes: ["id", "userId", "email", "nickname", "birth", "phoneNumber"]
}) })
console.log(userInfo)
res.json(userInfo) res.json(userInfo)
} catch (error) { } catch (error) {
console.log(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,
});
// console.log(newGuest)
res.clearCookie(config.cookieName);
const token = jwt.sign({id: newGuest.id, role: "user"}, config.jwtSecret, {
expiresIn: config.jwtExpires,
});
res.cookie(config.cookieName,token , {
maxAge: config.cookieMaxAge,
path: "/",
httpOnly: config.env === "production",
secure: config.env === "production",
})
res.json(newGuest);
} catch (error) {
res.status(500).send("비회원정보 등록 실패");
} }
} }
const getGuestInfo = async (req,res) => {
const {guestId} = req.params
// console.log(req.body)
try {
const guestInfo = await Guest.findOne({
where: {
id:guestId
}
})
// console.log("guestInfo====", guestInfo)
res.json(guestInfo)
} catch (error) {
res.status(500).send("비회원정보 불러오기 실패");
}
}
export default { export default {
getUser, getUser,
login, login,
...@@ -427,10 +471,11 @@ export default { ...@@ -427,10 +471,11 @@ export default {
confirmMbnum, confirmMbnum,
confirmNum, confirmNum,
signup, signup,
getMember,
uploadProfile,
getUser,
comparePw, comparePw,
modifyUser, modifyUser,
getUserInfo saveGuestInfo,
getMember,
uploadProfile,
getUserInfo,
getGuestInfo
} }
...@@ -8,6 +8,7 @@ import TheaterTypeModel from "../models/theatertype.model.js"; ...@@ -8,6 +8,7 @@ import TheaterTypeModel from "../models/theatertype.model.js";
import TicketFeeModel from "../models/ticketfee.model.js"; import TicketFeeModel from "../models/ticketfee.model.js";
import TimeTableModel from '../models/role.model.js'; import TimeTableModel from '../models/role.model.js';
import ReservationModel from '../models/reservation.model.js'; import ReservationModel from '../models/reservation.model.js';
import GuestModel from '../models/guest.model.js'
import ConfirmNumModel from '../models/confirmnum.model.js' import ConfirmNumModel from '../models/confirmnum.model.js'
import dbConfig from "../config/db.config.js"; import dbConfig from "../config/db.config.js";
...@@ -36,12 +37,13 @@ const TheaterType = TheaterTypeModel(sequelize) ...@@ -36,12 +37,13 @@ const TheaterType = TheaterTypeModel(sequelize)
const TicketFee = TicketFeeModel(sequelize) const TicketFee = TicketFeeModel(sequelize)
const TimeTable = TimeTableModel(sequelize) const TimeTable = TimeTableModel(sequelize)
const Reservation = ReservationModel(sequelize) const Reservation = ReservationModel(sequelize)
const Guest = GuestModel(sequelize)
const ConfirmNum = ConfirmNumModel(sequelize) const ConfirmNum = ConfirmNumModel(sequelize)
User.belongsTo(Role); User.belongsTo(Role);
Role.hasOne(User); Role.hasOne(User);
Theater.belongsTo(TheaterType); Theater.belongsTo(TheaterType, { onDelete: 'CASCADE' });
TicketFee.belongsTo(TheaterType, { onDelete: 'CASCADE' }); TicketFee.belongsTo(TheaterType, { onDelete: 'CASCADE' });
...@@ -56,5 +58,6 @@ export { ...@@ -56,5 +58,6 @@ export {
TicketFee, TicketFee,
TimeTable, TimeTable,
Reservation, Reservation,
Guest,
ConfirmNum ConfirmNum
} }
\ No newline at end of file
...@@ -19,6 +19,7 @@ sequelize ...@@ -19,6 +19,7 @@ sequelize
); );
const adminRole = await Role.findOne({ where: { name: "admin" } }); const adminRole = await Role.findOne({ where: { name: "admin" } });
// console.log("adminRole : ", adminRole);
if (!adminRole) { if (!adminRole) {
await User.create({ await User.create({
userId: "admin", userId: "admin",
......
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
...@@ -26,11 +26,14 @@ const ReservationModel = (sequelize) => { ...@@ -26,11 +26,14 @@ const ReservationModel = (sequelize) => {
timetable:{ timetable:{
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
}, },
userType:{
type: DataTypes.STRING,
},
user:{ user:{
type: DataTypes.INTEGER, type: DataTypes.INTEGER,
}, },
payment:{ payment:{
type: DataTypes.INTEGER, type: DataTypes.STRING,
} }
}, },
{ {
......
...@@ -20,11 +20,19 @@ const TimeTableModel = (sequelize) => { ...@@ -20,11 +20,19 @@ const TimeTableModel = (sequelize) => {
title: { title: {
type: DataTypes.STRING, type: DataTypes.STRING,
}, },
runtime: {
type: DataTypes.INTEGER,
},
release_date: { release_date: {
type: DataTypes.STRING type: DataTypes.STRING
}, },
date: { start_date: {
type: DataTypes.STRING, type: DataTypes.DATE,
defaultValue: new Date(0)
},
end_date: {
type: DataTypes.DATE,
defaultValue: new Date(0)
}, },
time: { time: {
type: DataTypes.TIME, type: DataTypes.TIME,
......
...@@ -10,7 +10,7 @@ router ...@@ -10,7 +10,7 @@ router
.put(cinemaCtrl.edit) .put(cinemaCtrl.edit)
router router
.route("/ticketfee/:theaterType") .route("/ticketfee/:theaterTypeId")
.get(ticketfeeCtrl.getOne) .get(ticketfeeCtrl.getOne)
router router
......
...@@ -2,6 +2,7 @@ import express from "express"; ...@@ -2,6 +2,7 @@ import express from "express";
import userRouter from './user.route.js' import userRouter from './user.route.js'
import movieRouter from './movie.route.js' import movieRouter from './movie.route.js'
import theaterRouter from "./theater.route.js"; import theaterRouter from "./theater.route.js";
import timetableRouter from "./timetable.route.js";
import cinemaRouter from "./cinema.route.js"; import cinemaRouter from "./cinema.route.js";
import kakaopayRouter from "./kakaopay.route.js"; import kakaopayRouter from "./kakaopay.route.js";
import emailRouter from './email.route.js' import emailRouter from './email.route.js'
...@@ -16,5 +17,6 @@ router.use('/email',emailRouter) ...@@ -16,5 +17,6 @@ router.use('/email',emailRouter)
router.use('/info', cinemaRouter) router.use('/info', cinemaRouter)
router.use('/theater', theaterRouter) router.use('/theater', theaterRouter)
router.use('/reservation', reservationRouter) router.use('/reservation', reservationRouter)
router.use('/timetable', timetableRouter)
export default router; export default router;
\ No newline at end of file
...@@ -5,12 +5,11 @@ const router = express.Router(); ...@@ -5,12 +5,11 @@ const router = express.Router();
router router
.route("/") .route("/")
// .post(movieCtrl.comparePopularMovie) .get(movieCtrl.getListfromDB)
router.route('/showmovies/:category')
.get(movieCtrl.getMovieById)
router.route('/movielist') router
.route('/movielist/:category')
.get(movieCtrl.getMovieList) .get(movieCtrl.getMovieList)
router router
...@@ -36,6 +35,5 @@ router ...@@ -36,6 +35,5 @@ router
.post(movieCtrl.create) .post(movieCtrl.create)
.delete(movieCtrl.remove) .delete(movieCtrl.remove)
router.param('category', movieCtrl.getMovieByCategory)
export default router; export default router;
\ No newline at end of file
...@@ -5,6 +5,13 @@ const router = express.Router(); ...@@ -5,6 +5,13 @@ const router = express.Router();
router.route('/findreservation') router.route('/findreservation')
.post(ReservationCtrl.findReservation) .post(ReservationCtrl.findReservedSeats)
.get(ReservationCtrl.findReservation)
router.route('/findonereservation')
.post(ReservationCtrl.findOneReservation)
router.route('/save')
.post(ReservationCtrl.saveReservation)
export default router; export default router;
\ No newline at end of file
...@@ -10,10 +10,14 @@ router ...@@ -10,10 +10,14 @@ router
.route("/") .route("/")
.get(theaterCtrl.getAll) .get(theaterCtrl.getAll)
.put(theaterCtrl.submit) .put(theaterCtrl.submit)
.delete(theaterCtrl.remove)
router router
.route("/type") .route("/type")
.get(theaterCtrl.getTypes) .get(theaterCtrl.getTypes)
router
.route("/:theaterId")
.get(theaterCtrl.getOne)
.delete(theaterCtrl.remove)
export default router; export default router;
import express from "express";
import timetableCtrl from "../controllers/timetable.controller.js";
const router = express.Router();
router
.route("/")
.post(timetableCtrl.submit)
export default router;
\ No newline at end of file
...@@ -25,7 +25,7 @@ router ...@@ -25,7 +25,7 @@ router
router router
.post("/profile", upload.single("image"), userCtrl.uploadProfile) .post("/profile", upload.single("image"), userCtrl.uploadProfile)
router router
.route("/modify") .route("/modify")
.post(userCtrl.modifyUser) .post(userCtrl.modifyUser)
...@@ -49,4 +49,14 @@ router ...@@ -49,4 +49,14 @@ router
router.route('/getuserinfo') router.route('/getuserinfo')
.post(userCtrl.getUserInfo) .post(userCtrl.getUserInfo)
router.route('/guest/save')
.post(userCtrl.saveGuestInfo)
router.route('/guestinfo/:guestId')
.get(userCtrl.getGuestInfo)
router
.route("/:userId")
.get(userCtrl.compareId)
export default router; export default router;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment