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

admin User 반복생성 수정 완료

parent dd785351
...@@ -18,20 +18,21 @@ sequelize ...@@ -18,20 +18,21 @@ sequelize
}) })
); );
const adminRole = await Role.findOne({ where: { name: "admin" } }); const adminRole = await Role.findOne({ where: { name: "admin" } })
if (!adminRole) { await User.findOrCreate({
await User.create({ where: { userId: "admin" },
defaults: {
userId: "admin", userId: "admin",
name: "관리자", name: "관리자",
email: "han35799@naver.com", email: "han35799@naver.com",
nickname: "haha", nickname: "admin",
birth: "990926", birth: "000000",
phoneNumber: "01086074580", phoneNumber: "01000000000",
password: "admin!", password: "admin!",
img: "970aaa79673a39331d45d4b55ca05d25", img: "970aaa79673a39331d45d4b55ca05d25",
roleId: adminRole?.id, 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}`);
......
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