Commit 3d810a85 authored by Kim, Subin's avatar Kim, Subin
Browse files

TheaterModel 생성

parent 60d4bbf9
...@@ -3,6 +3,7 @@ import UserModel from "../models/user.model.js"; ...@@ -3,6 +3,7 @@ import UserModel from "../models/user.model.js";
import RoleModel from "../models/role.model.js"; 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 dbConfig from "../config/db.config.js"; import dbConfig from "../config/db.config.js";
const sequelize = new Sequelize( const sequelize = new Sequelize(
...@@ -25,6 +26,7 @@ const User = UserModel(sequelize) ...@@ -25,6 +26,7 @@ const User = UserModel(sequelize)
const Role = RoleModel(sequelize) const Role = RoleModel(sequelize)
const Movie = MovieModel(sequelize) const Movie = MovieModel(sequelize)
const Cinema = CinemaModel(sequelize) const Cinema = CinemaModel(sequelize)
const Theater = TheaterModel(sequelize)
User.belongsTo(Role); User.belongsTo(Role);
Role.hasOne(User); Role.hasOne(User);
...@@ -37,5 +39,6 @@ export { ...@@ -37,5 +39,6 @@ export {
User, User,
Role, Role,
Movie, Movie,
Cinema Cinema,
Theater
} }
\ No newline at end of file
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
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