add basic repo setup, with user creation

This commit is contained in:
mrjvs
2023-10-28 16:49:02 +02:00
parent 9166c37aea
commit 94e1f9ebe1
26 changed files with 5762 additions and 374 deletions

17
src/modules/mikro/orm.ts Normal file
View File

@@ -0,0 +1,17 @@
import { MikroORM, PostgreSqlDriver } from '@mikro-orm/postgresql';
import path from 'path';
export async function createORM(url: string, log: (msg: string) => void) {
return await MikroORM.init<PostgreSqlDriver>({
type: 'postgresql',
clientUrl: url,
entities: ['./models/**/*.js'],
entitiesTs: ['./models/**/*.ts'],
baseDir: path.join(__dirname, '../../db'),
migrations: {
pathTs: './migrations/**/*.ts',
path: './migrations/**/*.ts',
},
logger: log,
});
}