Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
butter-studio
Commits
c54b5a00
Commit
c54b5a00
authored
Jul 23, 2021
by
Kim, Subin
Browse files
Role model 추가 및 User model 수정
parent
af0b4d10
Changes
3
Show whitespace changes
Inline
Side-by-side
server/db/index.js
View file @
c54b5a00
import
{
Sequelize
}
from
"
sequelize
"
;
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
MovieModel
from
"
../models/movie.model.js
"
;
import
dbConfig
from
"
../config/db.config.js
"
;
import
dbConfig
from
"
../config/db.config.js
"
;
...
@@ -19,11 +20,16 @@ const sequelize = new Sequelize(
...
@@ -19,11 +20,16 @@ const sequelize = new Sequelize(
}
}
);
);
// const User = UserModel(sequelize)
const
User
=
UserModel
(
sequelize
)
const
Role
=
RoleModel
(
sequelize
)
const
Movie
=
MovieModel
(
sequelize
)
const
Movie
=
MovieModel
(
sequelize
)
User
.
belongsTo
(
Role
);
Role
.
hasOne
(
User
);
export
{
export
{
sequelize
,
sequelize
,
// User,
User
,
Role
,
Movie
Movie
}
}
\ No newline at end of file
server/models/role.model.js
View file @
c54b5a00
...
@@ -2,12 +2,12 @@ import Sequelize from "sequelize";
...
@@ -2,12 +2,12 @@ import Sequelize from "sequelize";
const
{
DataTypes
}
=
Sequelize
;
const
{
DataTypes
}
=
Sequelize
;
//
export const ROLE_NAME = {
export
const
ROLE_NAME
=
{
//
USER
=
"user",
USER
:
"
user
"
,
//
MEMBER
=
"member",
MEMBER
:
"
member
"
,
//
ADMIN
=
"admin",
ADMIN
:
"
admin
"
,
//
ROOT
=
"root",
ROOT
:
"
root
"
,
//
}
}
const
RoleModel
=
(
sequelize
)
=>
{
const
RoleModel
=
(
sequelize
)
=>
{
const
Role
=
sequelize
.
define
(
const
Role
=
sequelize
.
define
(
...
...
server/models/user.model.js
View file @
c54b5a00
...
@@ -28,11 +28,6 @@ const UserModel = (sequelize) => {
...
@@ -28,11 +28,6 @@ const UserModel = (sequelize) => {
phoneNumber
:
{
phoneNumber
:
{
type
:
DataTypes
.
INTEGER
type
:
DataTypes
.
INTEGER
},
},
// role: {
// type: DataTypes.ENUM({
// values: Object.values(ROLE_NAME),
// }),
// }
},
},
{
{
timestamps
:
true
,
timestamps
:
true
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment