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

Role model 추가 및 User model 수정

parent af0b4d10
import { Sequelize } from "sequelize";
// import UserModel from "../models/user.model.js";
import UserModel from "../models/user.model.js";
import RoleModel from "../models/role.model.js";
import MovieModel from "../models/movie.model.js";
import dbConfig from "../config/db.config.js";
......@@ -19,11 +20,16 @@ const sequelize = new Sequelize(
}
);
// const User = UserModel(sequelize)
const User = UserModel(sequelize)
const Role = RoleModel(sequelize)
const Movie = MovieModel(sequelize)
User.belongsTo(Role);
Role.hasOne(User);
export {
sequelize,
// User,
User,
Role,
Movie
}
\ No newline at end of file
......@@ -2,12 +2,12 @@ import Sequelize from "sequelize";
const { DataTypes } = Sequelize;
// export const ROLE_NAME = {
// USER = "user",
// MEMBER = "member",
// ADMIN = "admin",
// ROOT = "root",
// }
export const ROLE_NAME = {
USER : "user",
MEMBER : "member",
ADMIN : "admin",
ROOT : "root",
}
const RoleModel = (sequelize) => {
const Role = sequelize.define(
......
......@@ -28,11 +28,6 @@ const UserModel = (sequelize) => {
phoneNumber: {
type: DataTypes.INTEGER
},
// role: {
// type: DataTypes.ENUM({
// values: Object.values(ROLE_NAME),
// }),
// }
},
{
timestamps: true,
......
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