Commit 54b0a783 authored by Kim, Subin's avatar Kim, Subin
Browse files

TicketFee Model 추가

parent fef70b2b
...@@ -4,6 +4,7 @@ import RoleModel from "../models/role.model.js"; ...@@ -4,6 +4,7 @@ import RoleModel from "../models/role.model.js";
import MovieModel from "../models/movie.model.js"; import MovieModel from "../models/movie.model.js";
import CinemaModel from "../models/cinema.model.js"; import CinemaModel from "../models/cinema.model.js";
import TheaterModel from "../models/theater.model.js"; import TheaterModel from "../models/theater.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 dbConfig from "../config/db.config.js"; import dbConfig from "../config/db.config.js";
...@@ -29,14 +30,14 @@ const Role = RoleModel(sequelize) ...@@ -29,14 +30,14 @@ const Role = RoleModel(sequelize)
const Movie = MovieModel(sequelize) const Movie = MovieModel(sequelize)
const Cinema = CinemaModel(sequelize) const Cinema = CinemaModel(sequelize)
const Theater = TheaterModel(sequelize) const Theater = TheaterModel(sequelize)
const TicketFee = TicketFeeModel(sequelize)
const TimeTable = TimeTableModel(sequelize) const TimeTable = TimeTableModel(sequelize)
const Reservation = ReservationModel(sequelize) const Reservation = ReservationModel(sequelize)
User.belongsTo(Role); User.belongsTo(Role);
Role.hasOne(User); Role.hasOne(User);
User.belongsTo(Role); TicketFee.hasOne(Theater, { foreignKey: "theaterType", targetKey: "theaterType", onDelete : "Cascade" });
Role.hasOne(User);
export { export {
sequelize, sequelize,
...@@ -45,6 +46,7 @@ export { ...@@ -45,6 +46,7 @@ export {
Movie, Movie,
Cinema, Cinema,
Theater, Theater,
TicketFee,
TimeTable, TimeTable,
Reservation Reservation
} }
\ No newline at end of file
...@@ -22,6 +22,9 @@ const CinemaModel = (sequelize) => { ...@@ -22,6 +22,9 @@ const CinemaModel = (sequelize) => {
}, },
address: { address: {
type: DataTypes.STRING type: DataTypes.STRING
},
moreFeeInfo: {
type: DataTypes.TEXT
} }
}, },
{ {
......
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
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