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
dotenv
from
"
dotenv
"
;
import
{
sequelize
,
Role
}
from
"
./db/index.js
"
;
import
{
sequelize
,
User
,
Role
}
from
"
./db/index.js
"
;
import
app
from
"
./app.js
"
;
import
app
from
"
./app.js
"
;
import
appConfig
from
"
./config/app.config.js
"
;
import
appConfig
from
"
./config/app.config.js
"
;
import
{
ROLE_NAME
}
from
'
./models/role.model.js
'
;
import
{
ROLE_NAME
}
from
'
./models/role.model.js
'
;
...
@@ -18,17 +18,19 @@ sequelize
...
@@ -18,17 +18,19 @@ sequelize
})
})
);
);
// const adminRole = await Role.findOne({ where: { name: "admin" } });
const
adminRole
=
await
Role
.
findOne
({
where
:
{
name
:
"
admin
"
}
});
console
.
log
(
"
adminRole :
"
,
adminRole
);
// await User.create({
// if (!adminRole) {
// userId: "admin",
await
User
.
create
({
// nickname: "admin@example.com",
userId
:
"
admin
"
,
// birth: "990926",
email
:
"
han35799@naver.com
"
,
// phoneNumber: "01086074580",
nickname
:
"
haha
"
,
// password: "admin!",
birth
:
"
990926
"
,
// isMember: true,
phoneNumber
:
"
01086074580
"
,
// roleId: adminRole?.id,
password
:
"
admin!
"
,
// });
roleId
:
adminRole
?.
id
,
});
// }else{}
app
.
listen
(
appConfig
.
port
,
()
=>
{
app
.
listen
(
appConfig
.
port
,
()
=>
{
console
.
log
(
`Server is running on port
${
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) => {
...
@@ -16,6 +16,9 @@ const UserModel = (sequelize) => {
userId
:
{
userId
:
{
type
:
DataTypes
.
STRING
,
type
:
DataTypes
.
STRING
,
},
},
email
:
{
type
:
DataTypes
.
STRING
,
},
nickname
:
{
nickname
:
{
type
:
DataTypes
.
STRING
,
type
:
DataTypes
.
STRING
,
},
},
...
@@ -28,9 +31,6 @@ const UserModel = (sequelize) => {
...
@@ -28,9 +31,6 @@ const UserModel = (sequelize) => {
password
:
{
password
:
{
type
:
DataTypes
.
STRING
,
type
:
DataTypes
.
STRING
,
},
},
roleId
:
{
type
:
DataTypes
.
INTEGER
}
},
},
{
{
timestamps
:
true
,
timestamps
:
true
,
...
...
server/routes/user.route.js
View file @
3639e9fe
...
@@ -19,4 +19,12 @@ router
...
@@ -19,4 +19,12 @@ router
.
route
(
"
/:userId
"
)
.
route
(
"
/:userId
"
)
.
get
(
userCtrl
.
compareId
)
.
get
(
userCtrl
.
compareId
)
router
.
route
(
"
/:id/:token
"
)
.
get
(
userCtrl
.
confirmMbnum
)
router
.
route
(
"
/:iddd
"
)
.
get
(
userCtrl
.
getNickName
)
export
default
router
;
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