fix(backend): Formatting + .env.development.example

npm run format uitgevoerd, .env.development.example toegevoegd.
This commit is contained in:
Gerald Schmittinger 2025-02-26 22:03:53 +01:00
parent 4e883a1a18
commit 48c8ce7c57
36 changed files with 499 additions and 331 deletions

View file

@ -1,6 +1,6 @@
import { EntityManager, MikroORM} from '@mikro-orm/core';
import { EntityManager, MikroORM } from '@mikro-orm/core';
import config from './mikro-orm.config.js';
import {EnvVars, getEnvVar} from "./util/envvars";
import { EnvVars, getEnvVar } from './util/envvars';
let orm: MikroORM | undefined;
export async function initORM(testingMode: boolean = false) {
@ -11,15 +11,20 @@ export async function initORM(testingMode: boolean = false) {
} else {
const diff = await orm.schema.getUpdateSchemaSQL();
if (diff) {
throw Error("The database structure needs to be updated in order to fit the new database structure " +
"of the app. In order to do so automatically, set the environment variable DWENGO_DB_UPDATE to true. " +
"The following queries will then be executed:\n" + diff)
throw Error(
'The database structure needs to be updated in order to fit the new database structure ' +
'of the app. In order to do so automatically, set the environment variable DWENGO_DB_UPDATE to true. ' +
'The following queries will then be executed:\n' +
diff
);
}
}
}
export function forkEntityManager(): EntityManager {
if (!orm) {
throw Error("Accessing the Entity Manager before the ORM is fully initialized.")
throw Error(
'Accessing the Entity Manager before the ORM is fully initialized.'
);
}
return orm.em.fork();
}