From cbf8dfc4536d2f4cfc118508bc58662df3c7bb71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me> Date: Wed, 1 Nov 2023 18:00:33 +0100 Subject: [PATCH] DB => Update seed for new schema --- ExpressAPI/prisma/seed.ts | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/ExpressAPI/prisma/seed.ts b/ExpressAPI/prisma/seed.ts index 6037124..ec4b605 100644 --- a/ExpressAPI/prisma/seed.ts +++ b/ExpressAPI/prisma/seed.ts @@ -1,25 +1,20 @@ -require('dotenv').config(); // ATTENTION : This line MUST be the first of this file -require('../src/shared/helpers/TypeScriptExtensions'); // ATTENTION : This line MUST be the second of this file +require('../src/InitialImports'); // ATTENTION : These lines MUST be the first of this file -import Config from '../src/config/Config'; -import logger from '../src/shared/logging/WinstonLogger'; -import * as bcrypt from 'bcryptjs'; -import db from '../src/helpers/DatabaseHelper'; +import { UserRole } from '@prisma/client'; +import logger from '../src/shared/logging/WinstonLogger'; +import db from '../src/helpers/DatabaseHelper'; async function main() { await db.user.upsert({ - where : { gitlabId: 142 }, + where : { id: 142 }, update: {}, create: { - id : 1, - firstname: 'Michaƫl', - lastname : 'Minelli', - mail : 'michael@minelli.me', - password : bcrypt.hashSync('123456', Config.userPasswordSaltRounds), - gitlabId : 142, - role : 'colsci', - deleted : false + id : 142, + gitlabUsername: 'michael.minelli', + gitlabLastInfo: {}, + role : UserRole.ADMIN, + deleted : false } }); } -- GitLab