Merge remote-tracking branch 'origin/dev' into feat/pagina-om-leerpaden-te-bekijken-#41
# Conflicts: # backend/src/controllers/learning-objects.ts # frontend/src/controllers/base-controller.ts
This commit is contained in:
commit
99dc346dc1
155 changed files with 3463 additions and 2931 deletions
|
@ -2,18 +2,19 @@ import { Request, Response } from 'express';
|
|||
import { FALLBACK_LANG } from '../config.js';
|
||||
import { FilteredLearningObject, LearningObjectIdentifier, LearningPathIdentifier } from '../interfaces/learning-content.js';
|
||||
import learningObjectService from '../services/learning-objects/learning-object-service.js';
|
||||
import { EnvVars, getEnvVar } from '../util/envvars.js';
|
||||
import { Language } from '../entities/content/language.js';
|
||||
import {BadRequestException, NotFoundException} from '../exceptions.js';
|
||||
import attachmentService from '../services/learning-objects/attachment-service.js';
|
||||
import { BadRequestException } from '../exceptions/bad-request-exception.js';
|
||||
import { NotFoundException } from '../exceptions/not-found-exception.js';
|
||||
import { envVars, getEnvVar } from '../util/envVars.js';
|
||||
|
||||
function getLearningObjectIdentifierFromRequest(req: Request): LearningObjectIdentifier {
|
||||
if (!req.params.hruid) {
|
||||
throw new BadRequestException('HRUID is required.');
|
||||
}
|
||||
return {
|
||||
hruid: req.params.hruid as string,
|
||||
language: (req.query.language || getEnvVar(EnvVars.FallbackLanguage)) as Language,
|
||||
hruid: req.params.hruid,
|
||||
language: (req.query.language || getEnvVar(envVars.FallbackLanguage)) as Language,
|
||||
version: parseInt(req.query.version as string),
|
||||
};
|
||||
}
|
||||
|
@ -23,7 +24,7 @@ function getLearningPathIdentifierFromRequest(req: Request): LearningPathIdentif
|
|||
throw new BadRequestException('HRUID is required.');
|
||||
}
|
||||
return {
|
||||
hruid: req.params.hruid as string,
|
||||
hruid: req.params.hruid,
|
||||
language: (req.query.language as Language) || FALLBACK_LANG,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue