mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
fix setup script
This commit is contained in:
parent
6a208d15be
commit
03f9fe0b47
@ -1,24 +1,25 @@
|
||||
import { User } from "../../models"
|
||||
import { createUser } from "../../lib"
|
||||
import createUser from "../../controllers/UserController/methods/createUser"
|
||||
|
||||
export default async () => {
|
||||
// check if any user with includes admin role exists
|
||||
const adminUser = await User.find({
|
||||
$or: [
|
||||
{ roles: { $in: ['admin'] } },
|
||||
{ roles: { $in: ["admin"] } },
|
||||
],
|
||||
})
|
||||
|
||||
// if no user with admin role exists, create one
|
||||
if (adminUser.length === 0) {
|
||||
console.log('Creating admin user...')
|
||||
console.log("Creating admin user...")
|
||||
|
||||
await createUser({
|
||||
username: 'admin',
|
||||
password: 'admin',
|
||||
roles: ['admin'],
|
||||
username: "admin",
|
||||
password: "admin",
|
||||
email: "admin@admin.com",
|
||||
roles: ["admin"],
|
||||
})
|
||||
|
||||
console.log('Admin user created!')
|
||||
console.log("Admin user created!")
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user