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";
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";
......@@ -29,14 +30,14 @@ 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);
User.belongsTo(Role);
Role.hasOne(User);
TicketFee.hasOne(Theater, { foreignKey: "theaterType", targetKey: "theaterType", onDelete : "Cascade" });
export {
sequelize,
......@@ -45,6 +46,7 @@ export {
Movie,
Cinema,
Theater,
TicketFee,
TimeTable,
Reservation
}
\ No newline at end of file
......@@ -22,6 +22,9 @@ const CinemaModel = (sequelize) => {
},
address: {
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