Merge branch 'dev' into chore/logging

This commit is contained in:
Tibo De Peuter 2025-03-06 12:11:29 +01:00
commit 11e3dc6a3f
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
48 changed files with 2252 additions and 1541 deletions

View file

@ -26,11 +26,20 @@ import { Answer } from './entities/questions/answer.entity.js';
import { Question } from './entities/questions/question.entity.js';
const entities = [
User, Student, Teacher,
Assignment, Group, Submission,
Class, ClassJoinRequest, TeacherInvitation,
Attachment, LearningObject, LearningPath,
Answer, Question
User,
Student,
Teacher,
Assignment,
Group,
Submission,
Class,
ClassJoinRequest,
TeacherInvitation,
Attachment,
LearningObject,
LearningPath,
Answer,
Question,
];
function config(testingMode: boolean = false): Options {
@ -57,7 +66,7 @@ function config(testingMode: boolean = false): Options {
user: getEnvVar(EnvVars.DbUsername),
password: getEnvVar(EnvVars.DbPassword),
entities: entities,
//entitiesTs: entitiesTs,
// entitiesTs: entitiesTs,
// Logging
debug: LOG_LEVEL === 'debug',

View file

@ -1,7 +1,7 @@
import fs from 'fs';
import path from 'path';
import yaml from 'js-yaml';
import {FALLBACK_LANG} from "../../config.js";
import { FALLBACK_LANG } from '../../config.js';
import { getLogger, Logger } from '../logging/initalize.js';
const logger: Logger = getLogger();
@ -16,7 +16,11 @@ export function loadTranslations<T>(language: string): T {
`Cannot load translation for ${language}, fallen back to dutch`,
error
);
const fallbackPath = path.join(process.cwd(), '_i18n', `${FALLBACK_LANG}.yml`);
const fallbackPath = path.join(
process.cwd(),
'_i18n',
`${FALLBACK_LANG}.yml`
);
return yaml.load(fs.readFileSync(fallbackPath, 'utf8')) as T;
}
}