update seed to include user role
This commit is contained in:
parent
6bcd20897d
commit
f63f141d72
@ -14,6 +14,10 @@ datasource db {
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
enum Role {
|
||||
ADMIN
|
||||
}
|
||||
|
||||
enum Platform {
|
||||
APP_IOS
|
||||
APP_ANDROID
|
||||
@ -85,6 +89,7 @@ model User {
|
||||
name String
|
||||
username String @unique
|
||||
password String
|
||||
role Role
|
||||
sessions Session[]
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import { PrismaClient, Role } from "@prisma/client";
|
||||
import * as argon2 from "argon2";
|
||||
import * as dotenv from "dotenv";
|
||||
|
||||
@ -16,11 +16,16 @@ async function main() {
|
||||
|
||||
await prisma.user.upsert({
|
||||
where: { username: "admin" },
|
||||
update: {},
|
||||
update: {
|
||||
name: "Admin User",
|
||||
password: hashedPassword,
|
||||
role: Role.ADMIN,
|
||||
},
|
||||
create: {
|
||||
name: "Admin User",
|
||||
username: "admin",
|
||||
password: hashedPassword,
|
||||
role: Role.ADMIN,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user