Commit a276f40f authored by Kim, Subin's avatar Kim, Subin
Browse files

cinema Model

parent ef0b5a8c
......@@ -2,6 +2,7 @@ import { Sequelize } from "sequelize";
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 dbConfig from "../config/db.config.js";
const sequelize = new Sequelize(
......@@ -23,6 +24,7 @@ const sequelize = new Sequelize(
const User = UserModel(sequelize)
const Role = RoleModel(sequelize)
const Movie = MovieModel(sequelize)
const Cinema = CinemaModel(sequelize)
User.belongsTo(Role);
Role.hasOne(User);
......@@ -31,5 +33,6 @@ export {
sequelize,
User,
Role,
Movie
Movie,
Cinema
}
\ No newline at end of file
import Sequelize from "sequelize";
const { DataTypes } = Sequelize;
const CinemaModel = (sequelize) => {
const Cinema = sequelize.define(
"cinema",
{
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
cinemaName: {
type: DataTypes.STRING,
},
transportation: {
type: DataTypes.TEXT
},
parking: {
type: DataTypes.TEXT
},
address: {
type: DataTypes.STRING
}
},
{
timestamps: true,
freezeTableName: true,
tableName: "cinemas"
}
);
return Cinema;
};
export default CinemaModel;
\ 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