Merge remote-tracking branch 'origin/dev' into feat/user-routes
# Conflicts: # backend/src/controllers/learning-objects.ts # frontend/src/controllers/controllers.ts # frontend/src/queries/themes.ts
This commit is contained in:
		
						commit
						084f4fcdbd
					
				
					 45 changed files with 1319 additions and 110 deletions
				
			
		
							
								
								
									
										21
									
								
								backend/.env.staging
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								backend/.env.staging
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,21 @@ | |||
| PORT=3000 | ||||
| DWENGO_DB_HOST=db | ||||
| DWENGO_DB_PORT=5432 | ||||
| DWENGO_DB_USERNAME=postgres | ||||
| DWENGO_DB_PASSWORD=postgres | ||||
| DWENGO_DB_UPDATE=false | ||||
| 
 | ||||
| DWENGO_AUTH_STUDENT_URL=http://localhost/idp/realms/student | ||||
| DWENGO_AUTH_STUDENT_CLIENT_ID=dwengo | ||||
| DWENGO_AUTH_STUDENT_JWKS_ENDPOINT=http://idp:7080/idp/realms/student/protocol/openid-connect/certs | ||||
| DWENGO_AUTH_TEACHER_URL=http://localhost/idp/realms/teacher | ||||
| DWENGO_AUTH_TEACHER_CLIENT_ID=dwengo | ||||
| DWENGO_AUTH_TEACHER_JWKS_ENDPOINT=http://idp:7080/idp/realms/teacher/protocol/openid-connect/certs | ||||
| 
 | ||||
| # Allow Vite dev-server to access the backend (for testing purposes). Don't forget to remove this in production! | ||||
| #DWENGO_CORS_ALLOWED_ORIGINS=http://localhost/,127.0.0.1:80,http://127.0.0.1,http://localhost:80,http://127.0.0.1:80,localhost | ||||
| DWENGO_CORS_ALLOWED_ORIGINS=http://localhost/*,http://idp:7080,https://idp:7080 | ||||
| 
 | ||||
| # Logging and monitoring | ||||
| 
 | ||||
| LOKI_HOST=http://logging:3102 | ||||
|  | @ -1,3 +1,13 @@ | |||
| PORT=3000 | ||||
| DWENGO_DB_UPDATE=true | ||||
| # | ||||
| # Test environment configuration | ||||
| # | ||||
| # Should not need to be modified. | ||||
| # See .env.example for more information. | ||||
| # | ||||
| 
 | ||||
| ### Dwengo ### | ||||
| 
 | ||||
| DWENGO_PORT=3000 | ||||
| 
 | ||||
| DWENGO_DB_NAME=":memory:" | ||||
| DWENGO_DB_UPDATE=true | ||||
|  |  | |||
|  | @ -1,13 +0,0 @@ | |||
| # | ||||
| # Test environment configuration | ||||
| # | ||||
| # Should not need to be modified. | ||||
| # See .env.example for more information. | ||||
| # | ||||
| 
 | ||||
| ### Dwengo ### | ||||
| 
 | ||||
| DWENGO_PORT=3000 | ||||
| 
 | ||||
| DWENGO_DB_NAME=":memory:" | ||||
| DWENGO_DB_UPDATE=true | ||||
|  | @ -34,7 +34,9 @@ npm run test:unit | |||
| 
 | ||||
| ```shell | ||||
| # Omgevingsvariabelen | ||||
| cp .env.development.example .env | ||||
| cp .env.example .env | ||||
| # Configureer de .env file met de juiste waarden! | ||||
| nano .env | ||||
| 
 | ||||
| npm run build | ||||
| npm run start | ||||
|  |  | |||
|  | @ -1,12 +1,12 @@ | |||
| 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 '@dwengo-1/common/util/language'; | ||||
| import attachmentService from '../services/learning-objects/attachment-service.js'; | ||||
| import { NotFoundError } from '@mikro-orm/core'; | ||||
| import { BadRequestException } from '../exceptions/bad-request-exception.js'; | ||||
| import { FilteredLearningObject, LearningObjectIdentifier, LearningPathIdentifier } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| import { NotFoundException } from '../exceptions/not-found-exception.js'; | ||||
| import { envVars, getEnvVar } from '../util/envVars.js'; | ||||
| 
 | ||||
| function getLearningObjectIdentifierFromRequest(req: Request): LearningObjectIdentifier { | ||||
|     if (!req.params.hruid) { | ||||
|  | @ -47,6 +47,11 @@ export async function getLearningObject(req: Request, res: Response): Promise<vo | |||
|     const learningObjectId = getLearningObjectIdentifierFromRequest(req); | ||||
| 
 | ||||
|     const learningObject = await learningObjectService.getLearningObjectById(learningObjectId); | ||||
| 
 | ||||
|     if (!learningObject) { | ||||
|         throw new NotFoundException('Learning object not found'); | ||||
|     } | ||||
| 
 | ||||
|     res.json(learningObject); | ||||
| } | ||||
| 
 | ||||
|  | @ -63,7 +68,7 @@ export async function getAttachment(req: Request, res: Response): Promise<void> | |||
|     const attachment = await attachmentService.getAttachment(learningObjectId, name); | ||||
| 
 | ||||
|     if (!attachment) { | ||||
|         throw new NotFoundError(`Attachment ${name} not found`); | ||||
|         throw new NotFoundException(`Attachment ${name} not found`); | ||||
|     } | ||||
|     res.setHeader('Content-Type', attachment.mimeType).send(attachment.content); | ||||
| } | ||||
|  |  | |||
|  | @ -4,6 +4,6 @@ export default defineConfig({ | |||
|     test: { | ||||
|         environment: 'node', | ||||
|         globals: true, | ||||
|         testTimeout: 10000, | ||||
|         testTimeout: 100000, | ||||
|     }, | ||||
| }); | ||||
|  |  | |||
		Reference in a new issue
	
	 Gabriellvl
						Gabriellvl