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
3639e9fe
Commit
3639e9fe
authored
Jul 28, 2021
by
Jiwon Yoon
Browse files
Merge branch 'gyumin'
parents
c4a8991d
bd9ff2cc
Changes
23
Hide whitespace changes
Inline
Side-by-side
server/index.js
View file @
3639e9fe
import
dotenv
from
"
dotenv
"
;
import
{
sequelize
,
Role
}
from
"
./db/index.js
"
;
import
{
sequelize
,
User
,
Role
}
from
"
./db/index.js
"
;
import
app
from
"
./app.js
"
;
import
appConfig
from
"
./config/app.config.js
"
;
import
{
ROLE_NAME
}
from
'
./models/role.model.js
'
;
...
...
@@ -18,17 +18,19 @@ sequelize
})
);
// const adminRole = await Role.findOne({ where: { name: "admin" } });
// await User.create({
// userId: "admin",
// nickname: "admin@example.com",
// birth: "990926",
// phoneNumber: "01086074580",
// password: "admin!",
// isMember: true,
// roleId: adminRole?.id,
// });
const
adminRole
=
await
Role
.
findOne
({
where
:
{
name
:
"
admin
"
}
});
console
.
log
(
"
adminRole :
"
,
adminRole
);
// if (!adminRole) {
await
User
.
create
({
userId
:
"
admin
"
,
email
:
"
han35799@naver.com
"
,
nickname
:
"
haha
"
,
birth
:
"
990926
"
,
phoneNumber
:
"
01086074580
"
,
password
:
"
admin!
"
,
roleId
:
adminRole
?.
id
,
});
// }else{}
app
.
listen
(
appConfig
.
port
,
()
=>
{
console
.
log
(
`Server is running on port
${
appConfig
.
port
}
`
);
...
...
server/models/user.model.js
View file @
3639e9fe
...
...
@@ -16,6 +16,9 @@ const UserModel = (sequelize) => {
userId
:
{
type
:
DataTypes
.
STRING
,
},
email
:
{
type
:
DataTypes
.
STRING
,
},
nickname
:
{
type
:
DataTypes
.
STRING
,
},
...
...
@@ -28,9 +31,6 @@ const UserModel = (sequelize) => {
password
:
{
type
:
DataTypes
.
STRING
,
},
roleId
:
{
type
:
DataTypes
.
INTEGER
}
},
{
timestamps
:
true
,
...
...
server/routes/user.route.js
View file @
3639e9fe
...
...
@@ -19,4 +19,12 @@ router
.
route
(
"
/:userId
"
)
.
get
(
userCtrl
.
compareId
)
router
.
route
(
"
/:id/:token
"
)
.
get
(
userCtrl
.
confirmMbnum
)
router
.
route
(
"
/:iddd
"
)
.
get
(
userCtrl
.
getNickName
)
export
default
router
;
\ No newline at end of file
Prev
1
2
Next
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