Merge remote-tracking branch 'origin/feat/questions-answers-en-submissions-groep-specifiek-maken-#163' into feat/endpoints-beschermen-met-authenticatie-#105
This commit is contained in:
		
						commit
						bc60c18938
					
				
					 30 changed files with 774 additions and 206 deletions
				
			
		|  | @ -1,11 +1,31 @@ | ||||||
| import { Request, Response } from 'express'; | import { Request, Response } from 'express'; | ||||||
| import { createQuestion, deleteQuestion, getAllQuestions, getAnswersByQuestion, getQuestion } from '../services/questions.js'; | import { | ||||||
|  |     createQuestion, | ||||||
|  |     deleteQuestion, | ||||||
|  |     getAllQuestions, | ||||||
|  |     getAnswersByQuestion, | ||||||
|  |     getQuestion, | ||||||
|  |     getQuestionsAboutLearningObjectInAssignment, | ||||||
|  | } from '../services/questions.js'; | ||||||
| import { FALLBACK_LANG, FALLBACK_SEQ_NUM } from '../config.js'; | import { FALLBACK_LANG, FALLBACK_SEQ_NUM } from '../config.js'; | ||||||
| import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier.js'; | import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier.js'; | ||||||
| import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | ||||||
| import { Language } from '@dwengo-1/common/util/language'; | import { Language } from '@dwengo-1/common/util/language'; | ||||||
|  | import { AnswerDTO, AnswerId } from '@dwengo-1/common/interfaces/answer'; | ||||||
| 
 | 
 | ||||||
| function getObjectId(req: Request, res: Response): LearningObjectIdentifier | null { | interface QuestionPathParams { | ||||||
|  |     hruid: string; | ||||||
|  |     version: string; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | interface QuestionQueryParams { | ||||||
|  |     lang: string; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function getObjectId<ResBody, ReqBody>( | ||||||
|  |     req: Request<QuestionPathParams, ResBody, ReqBody, QuestionQueryParams>, | ||||||
|  |     res: Response | ||||||
|  | ): LearningObjectIdentifier | null { | ||||||
|     const { hruid, version } = req.params; |     const { hruid, version } = req.params; | ||||||
|     const lang = req.query.lang; |     const lang = req.query.lang; | ||||||
| 
 | 
 | ||||||
|  | @ -21,7 +41,13 @@ function getObjectId(req: Request, res: Response): LearningObjectIdentifier | nu | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function getQuestionId(req: Request, res: Response): QuestionId | null { | interface GetQuestionIdPathParams extends QuestionPathParams { | ||||||
|  |     seq: string; | ||||||
|  | } | ||||||
|  | function getQuestionId<ReqBody, ResBody>( | ||||||
|  |     req: Request<GetQuestionIdPathParams, ReqBody, ResBody, QuestionQueryParams>, | ||||||
|  |     res: Response | ||||||
|  | ): QuestionId | null { | ||||||
|     const seq = req.params.seq; |     const seq = req.params.seq; | ||||||
|     const learningObjectIdentifier = getObjectId(req, res); |     const learningObjectIdentifier = getObjectId(req, res); | ||||||
| 
 | 
 | ||||||
|  | @ -35,15 +61,35 @@ function getQuestionId(req: Request, res: Response): QuestionId | null { | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export async function getAllQuestionsHandler(req: Request, res: Response): Promise<void> { | interface GetAllQuestionsQueryParams extends QuestionQueryParams { | ||||||
|  |     classId?: string; | ||||||
|  |     assignmentId?: number; | ||||||
|  |     forStudent?: string; | ||||||
|  |     full?: boolean; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | export async function getAllQuestionsHandler( | ||||||
|  |     req: Request<QuestionPathParams, QuestionDTO[] | QuestionId[], unknown, GetAllQuestionsQueryParams>, | ||||||
|  |     res: Response | ||||||
|  | ): Promise<void> { | ||||||
|     const objectId = getObjectId(req, res); |     const objectId = getObjectId(req, res); | ||||||
|     const full = req.query.full === 'true'; |     const full = req.query.full; | ||||||
| 
 | 
 | ||||||
|     if (!objectId) { |     if (!objectId) { | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 |     let questions: QuestionDTO[] | QuestionId[]; | ||||||
|     const questions = await getAllQuestions(objectId, full); |     if (req.query.classId && req.query.assignmentId) { | ||||||
|  |         questions = await getQuestionsAboutLearningObjectInAssignment( | ||||||
|  |             objectId, | ||||||
|  |             req.query.classId, | ||||||
|  |             req.query.assignmentId, | ||||||
|  |             full ?? false, | ||||||
|  |             req.query.forStudent | ||||||
|  |         ); | ||||||
|  |     } else { | ||||||
|  |         questions = await getAllQuestions(objectId, full ?? false); | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     if (!questions) { |     if (!questions) { | ||||||
|         res.status(404).json({ error: `Questions not found.` }); |         res.status(404).json({ error: `Questions not found.` }); | ||||||
|  | @ -52,7 +98,10 @@ export async function getAllQuestionsHandler(req: Request, res: Response): Promi | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export async function getQuestionHandler(req: Request, res: Response): Promise<void> { | export async function getQuestionHandler( | ||||||
|  |     req: Request<GetQuestionIdPathParams, QuestionDTO[] | QuestionId[], unknown, QuestionQueryParams>, | ||||||
|  |     res: Response | ||||||
|  | ): Promise<void> { | ||||||
|     const questionId = getQuestionId(req, res); |     const questionId = getQuestionId(req, res); | ||||||
| 
 | 
 | ||||||
|     if (!questionId) { |     if (!questionId) { | ||||||
|  | @ -68,9 +117,15 @@ export async function getQuestionHandler(req: Request, res: Response): Promise<v | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export async function getQuestionAnswersHandler(req: Request, res: Response): Promise<void> { | interface GetQuestionAnswersQueryParams extends QuestionQueryParams { | ||||||
|  |     full: boolean; | ||||||
|  | } | ||||||
|  | export async function getQuestionAnswersHandler( | ||||||
|  |     req: Request<GetQuestionIdPathParams, { answers: AnswerDTO[] | AnswerId[] }, unknown, GetQuestionAnswersQueryParams>, | ||||||
|  |     res: Response | ||||||
|  | ): Promise<void> { | ||||||
|     const questionId = getQuestionId(req, res); |     const questionId = getQuestionId(req, res); | ||||||
|     const full = req.query.full === 'true'; |     const full = req.query.full; | ||||||
| 
 | 
 | ||||||
|     if (!questionId) { |     if (!questionId) { | ||||||
|         return; |         return; | ||||||
|  | @ -88,8 +143,8 @@ export async function getQuestionAnswersHandler(req: Request, res: Response): Pr | ||||||
| export async function createQuestionHandler(req: Request, res: Response): Promise<void> { | export async function createQuestionHandler(req: Request, res: Response): Promise<void> { | ||||||
|     const questionDTO = req.body as QuestionDTO; |     const questionDTO = req.body as QuestionDTO; | ||||||
| 
 | 
 | ||||||
|     if (!questionDTO.learningObjectIdentifier || !questionDTO.author || !questionDTO.content) { |     if (!questionDTO.learningObjectIdentifier || !questionDTO.author || !questionDTO.inGroup || !questionDTO.content) { | ||||||
|         res.status(400).json({ error: 'Missing required fields: identifier and content' }); |         res.status(400).json({ error: 'Missing required fields: identifier, author, inGroup, and content' }); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -102,7 +157,10 @@ export async function createQuestionHandler(req: Request, res: Response): Promis | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export async function deleteQuestionHandler(req: Request, res: Response): Promise<void> { | export async function deleteQuestionHandler( | ||||||
|  |     req: Request<GetQuestionIdPathParams, QuestionDTO, unknown, QuestionQueryParams>, | ||||||
|  |     res: Response | ||||||
|  | ): Promise<void> { | ||||||
|     const questionId = getQuestionId(req, res); |     const questionId = getQuestionId(req, res); | ||||||
| 
 | 
 | ||||||
|     if (!questionId) { |     if (!questionId) { | ||||||
|  |  | ||||||
|  | @ -1,13 +1,35 @@ | ||||||
| import { Request, Response } from 'express'; | import { Request, Response } from 'express'; | ||||||
| import { createSubmission, deleteSubmission, getSubmission } from '../services/submissions.js'; | import { createSubmission, deleteSubmission, getSubmission, getSubmissionsForLearningObjectAndAssignment } from '../services/submissions.js'; | ||||||
| import { SubmissionDTO } from '@dwengo-1/common/interfaces/submission'; | import { SubmissionDTO } from '@dwengo-1/common/interfaces/submission'; | ||||||
| import { Language, languageMap } from '@dwengo-1/common/util/language'; | import { Language, languageMap } from '@dwengo-1/common/util/language'; | ||||||
|  | import { Submission } from '../entities/assignments/submission.entity'; | ||||||
| 
 | 
 | ||||||
| interface SubmissionParams { | interface SubmissionParams { | ||||||
|     hruid: string; |     hruid: string; | ||||||
|     id: number; |     id: number; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | interface SubmissionQuery { | ||||||
|  |     language: string; | ||||||
|  |     version: number; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | interface SubmissionsQuery extends SubmissionQuery { | ||||||
|  |     classId: string; | ||||||
|  |     assignmentId: number; | ||||||
|  |     studentUsername?: string; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | export async function getSubmissionsHandler(req: Request<SubmissionParams, Submission[], null, SubmissionsQuery>, res: Response): Promise<void> { | ||||||
|  |     const loHruid = req.params.hruid; | ||||||
|  |     const lang = languageMap[req.query.language] || Language.Dutch; | ||||||
|  |     const version = req.query.version || 1; | ||||||
|  | 
 | ||||||
|  |     const submissions = await getSubmissionsForLearningObjectAndAssignment(loHruid, lang, version, req.query.classId, req.query.assignmentId); | ||||||
|  | 
 | ||||||
|  |     res.json(submissions); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| export async function getSubmissionHandler(req: Request<SubmissionParams>, res: Response): Promise<void> { | export async function getSubmissionHandler(req: Request<SubmissionParams>, res: Response): Promise<void> { | ||||||
|     const lohruid = req.params.hruid; |     const lohruid = req.params.hruid; | ||||||
|     const submissionNumber = Number(req.params.id); |     const submissionNumber = Number(req.params.id); | ||||||
|  |  | ||||||
|  | @ -6,6 +6,22 @@ export class AssignmentRepository extends DwengoEntityRepository<Assignment> { | ||||||
|     public async findByClassAndId(within: Class, id: number): Promise<Assignment | null> { |     public async findByClassAndId(within: Class, id: number): Promise<Assignment | null> { | ||||||
|         return this.findOne({ within: within, id: id }); |         return this.findOne({ within: within, id: id }); | ||||||
|     } |     } | ||||||
|  |     public async findByClassIdAndAssignmentId(withinClass: string, id: number): Promise<Assignment | null> { | ||||||
|  |         return this.findOne({ within: { classId: withinClass }, id: id }); | ||||||
|  |     } | ||||||
|  |     public async findAllByResponsibleTeacher(teacherUsername: string): Promise<Assignment[]> { | ||||||
|  |         return this.findAll({ | ||||||
|  |             where: { | ||||||
|  |                 within: { | ||||||
|  |                     teachers: { | ||||||
|  |                         $some: { | ||||||
|  |                             username: teacherUsername, | ||||||
|  |                         }, | ||||||
|  |                     }, | ||||||
|  |                 }, | ||||||
|  |             }, | ||||||
|  |         }); | ||||||
|  |     } | ||||||
|     public async findAllAssignmentsInClass(within: Class): Promise<Assignment[]> { |     public async findAllAssignmentsInClass(within: Class): Promise<Assignment[]> { | ||||||
|         return this.findAll({ where: { within: within } }); |         return this.findAll({ where: { within: within } }); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -3,6 +3,7 @@ import { Group } from '../../entities/assignments/group.entity.js'; | ||||||
| import { Submission } from '../../entities/assignments/submission.entity.js'; | import { Submission } from '../../entities/assignments/submission.entity.js'; | ||||||
| import { LearningObjectIdentifier } from '../../entities/content/learning-object-identifier.js'; | import { LearningObjectIdentifier } from '../../entities/content/learning-object-identifier.js'; | ||||||
| import { Student } from '../../entities/users/student.entity.js'; | import { Student } from '../../entities/users/student.entity.js'; | ||||||
|  | import { Assignment } from '../../entities/assignments/assignment.entity'; | ||||||
| 
 | 
 | ||||||
| export class SubmissionRepository extends DwengoEntityRepository<Submission> { | export class SubmissionRepository extends DwengoEntityRepository<Submission> { | ||||||
|     public async findSubmissionByLearningObjectAndSubmissionNumber( |     public async findSubmissionByLearningObjectAndSubmissionNumber( | ||||||
|  | @ -42,11 +43,58 @@ export class SubmissionRepository extends DwengoEntityRepository<Submission> { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public async findAllSubmissionsForGroup(group: Group): Promise<Submission[]> { |     public async findAllSubmissionsForGroup(group: Group): Promise<Submission[]> { | ||||||
|         return this.find({ onBehalfOf: group }); |         return this.find( | ||||||
|  |             { onBehalfOf: group }, | ||||||
|  |             { | ||||||
|  |                 populate: ['onBehalfOf.members'], | ||||||
|  |             } | ||||||
|  |         ); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Looks up all submissions for the given learning object which were submitted as part of the given assignment. | ||||||
|  |      * When forStudentUsername is set, only the submissions of the given user's group are shown. | ||||||
|  |      */ | ||||||
|  |     public async findAllSubmissionsForLearningObjectAndAssignment( | ||||||
|  |         loId: LearningObjectIdentifier, | ||||||
|  |         assignment: Assignment, | ||||||
|  |         forStudentUsername?: string | ||||||
|  |     ): Promise<Submission[]> { | ||||||
|  |         const onBehalfOf = forStudentUsername | ||||||
|  |             ? { | ||||||
|  |                   assignment, | ||||||
|  |                   members: { | ||||||
|  |                       $some: { | ||||||
|  |                           username: forStudentUsername, | ||||||
|  |                       }, | ||||||
|  |                   }, | ||||||
|  |               } | ||||||
|  |             : { | ||||||
|  |                   assignment, | ||||||
|  |               }; | ||||||
|  | 
 | ||||||
|  |         return this.findAll({ | ||||||
|  |             where: { | ||||||
|  |                 learningObjectHruid: loId.hruid, | ||||||
|  |                 learningObjectLanguage: loId.language, | ||||||
|  |                 learningObjectVersion: loId.version, | ||||||
|  |                 onBehalfOf, | ||||||
|  |             }, | ||||||
|  |         }); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public async findAllSubmissionsForStudent(student: Student): Promise<Submission[]> { |     public async findAllSubmissionsForStudent(student: Student): Promise<Submission[]> { | ||||||
|         return this.find({ submitter: student }); |         const result = await this.find( | ||||||
|  |             { submitter: student }, | ||||||
|  |             { | ||||||
|  |                 populate: ['onBehalfOf.members'], | ||||||
|  |             } | ||||||
|  |         ); | ||||||
|  | 
 | ||||||
|  |         // Workaround: For some reason, without this MikroORM generates an UPDATE query with a syntax error in some tests
 | ||||||
|  |         this.em.clear(); | ||||||
|  | 
 | ||||||
|  |         return result; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public async deleteSubmissionByLearningObjectAndSubmissionNumber(loId: LearningObjectIdentifier, submissionNumber: number): Promise<void> { |     public async deleteSubmissionByLearningObjectAndSubmissionNumber(loId: LearningObjectIdentifier, submissionNumber: number): Promise<void> { | ||||||
|  |  | ||||||
|  | @ -3,14 +3,17 @@ import { Question } from '../../entities/questions/question.entity.js'; | ||||||
| import { LearningObjectIdentifier } from '../../entities/content/learning-object-identifier.js'; | import { LearningObjectIdentifier } from '../../entities/content/learning-object-identifier.js'; | ||||||
| import { Student } from '../../entities/users/student.entity.js'; | import { Student } from '../../entities/users/student.entity.js'; | ||||||
| import { LearningObject } from '../../entities/content/learning-object.entity.js'; | import { LearningObject } from '../../entities/content/learning-object.entity.js'; | ||||||
|  | import { Group } from '../../entities/assignments/group.entity'; | ||||||
|  | import { Assignment } from '../../entities/assignments/assignment.entity'; | ||||||
| 
 | 
 | ||||||
| export class QuestionRepository extends DwengoEntityRepository<Question> { | export class QuestionRepository extends DwengoEntityRepository<Question> { | ||||||
|     public async createQuestion(question: { loId: LearningObjectIdentifier; author: Student; content: string }): Promise<Question> { |     public async createQuestion(question: { loId: LearningObjectIdentifier; author: Student; inGroup: Group; content: string }): Promise<Question> { | ||||||
|         const questionEntity = this.create({ |         const questionEntity = this.create({ | ||||||
|             learningObjectHruid: question.loId.hruid, |             learningObjectHruid: question.loId.hruid, | ||||||
|             learningObjectLanguage: question.loId.language, |             learningObjectLanguage: question.loId.language, | ||||||
|             learningObjectVersion: question.loId.version, |             learningObjectVersion: question.loId.version, | ||||||
|             author: question.author, |             author: question.author, | ||||||
|  |             inGroup: question.inGroup, | ||||||
|             content: question.content, |             content: question.content, | ||||||
|             timestamp: new Date(), |             timestamp: new Date(), | ||||||
|         }); |         }); | ||||||
|  | @ -18,6 +21,7 @@ export class QuestionRepository extends DwengoEntityRepository<Question> { | ||||||
|         questionEntity.learningObjectLanguage = question.loId.language; |         questionEntity.learningObjectLanguage = question.loId.language; | ||||||
|         questionEntity.learningObjectVersion = question.loId.version; |         questionEntity.learningObjectVersion = question.loId.version; | ||||||
|         questionEntity.author = question.author; |         questionEntity.author = question.author; | ||||||
|  |         questionEntity.inGroup = question.inGroup; | ||||||
|         questionEntity.content = question.content; |         questionEntity.content = question.content; | ||||||
|         return this.insert(questionEntity); |         return this.insert(questionEntity); | ||||||
|     } |     } | ||||||
|  | @ -61,4 +65,36 @@ export class QuestionRepository extends DwengoEntityRepository<Question> { | ||||||
|             orderBy: { timestamp: 'DESC' }, // New to old
 |             orderBy: { timestamp: 'DESC' }, // New to old
 | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Looks up all questions for the given learning object which were asked as part of the given assignment. | ||||||
|  |      * When forStudentUsername is set, only the questions within the given user's group are shown. | ||||||
|  |      */ | ||||||
|  |     public async findAllQuestionsAboutLearningObjectInAssignment( | ||||||
|  |         loId: LearningObjectIdentifier, | ||||||
|  |         assignment: Assignment, | ||||||
|  |         forStudentUsername?: string | ||||||
|  |     ): Promise<Question[]> { | ||||||
|  |         const inGroup = forStudentUsername | ||||||
|  |             ? { | ||||||
|  |                   assignment, | ||||||
|  |                   members: { | ||||||
|  |                       $some: { | ||||||
|  |                           username: forStudentUsername, | ||||||
|  |                       }, | ||||||
|  |                   }, | ||||||
|  |               } | ||||||
|  |             : { | ||||||
|  |                   assignment, | ||||||
|  |               }; | ||||||
|  | 
 | ||||||
|  |         return this.findAll({ | ||||||
|  |             where: { | ||||||
|  |                 learningObjectHruid: loId.hruid, | ||||||
|  |                 learningObjectLanguage: loId.language, | ||||||
|  |                 learningObjectVersion: loId.version, | ||||||
|  |                 inGroup, | ||||||
|  |             }, | ||||||
|  |         }); | ||||||
|  |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| import { Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'; | import { Collection, Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'; | ||||||
| import { Class } from '../classes/class.entity.js'; | import { Class } from '../classes/class.entity.js'; | ||||||
| import { Group } from './group.entity.js'; | import { Group } from './group.entity.js'; | ||||||
| import { Language } from '@dwengo-1/common/util/language'; | import { Language } from '@dwengo-1/common/util/language'; | ||||||
|  | @ -35,5 +35,5 @@ export class Assignment { | ||||||
|         entity: () => Group, |         entity: () => Group, | ||||||
|         mappedBy: 'assignment', |         mappedBy: 'assignment', | ||||||
|     }) |     }) | ||||||
|     groups!: Group[]; |     groups!: Collection<Group>; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| import { Entity, ManyToMany, ManyToOne, PrimaryKey } from '@mikro-orm/core'; | import { Collection, Entity, ManyToMany, ManyToOne, PrimaryKey } from '@mikro-orm/core'; | ||||||
| import { Assignment } from './assignment.entity.js'; | import { Assignment } from './assignment.entity.js'; | ||||||
| import { Student } from '../users/student.entity.js'; | import { Student } from '../users/student.entity.js'; | ||||||
| import { GroupRepository } from '../../data/assignments/group-repository.js'; | import { GroupRepository } from '../../data/assignments/group-repository.js'; | ||||||
|  | @ -19,5 +19,5 @@ export class Group { | ||||||
|     @ManyToMany({ |     @ManyToMany({ | ||||||
|         entity: () => Student, |         entity: () => Student, | ||||||
|     }) |     }) | ||||||
|     members!: Student[]; |     members!: Collection<Student>; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -21,6 +21,11 @@ export class Submission { | ||||||
|     @PrimaryKey({ type: 'integer', autoincrement: true }) |     @PrimaryKey({ type: 'integer', autoincrement: true }) | ||||||
|     submissionNumber?: number; |     submissionNumber?: number; | ||||||
| 
 | 
 | ||||||
|  |     @ManyToOne({ | ||||||
|  |         entity: () => Group, | ||||||
|  |     }) | ||||||
|  |     onBehalfOf!: Group; | ||||||
|  | 
 | ||||||
|     @ManyToOne({ |     @ManyToOne({ | ||||||
|         entity: () => Student, |         entity: () => Student, | ||||||
|     }) |     }) | ||||||
|  | @ -29,12 +34,6 @@ export class Submission { | ||||||
|     @Property({ type: 'datetime' }) |     @Property({ type: 'datetime' }) | ||||||
|     submissionTime!: Date; |     submissionTime!: Date; | ||||||
| 
 | 
 | ||||||
|     @ManyToOne({ |  | ||||||
|         entity: () => Group, |  | ||||||
|         nullable: true, |  | ||||||
|     }) |  | ||||||
|     onBehalfOf?: Group; |  | ||||||
| 
 |  | ||||||
|     @Property({ type: 'json' }) |     @Property({ type: 'json' }) | ||||||
|     content!: string; |     content!: string; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -2,6 +2,7 @@ import { Entity, Enum, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'; | ||||||
| import { Student } from '../users/student.entity.js'; | import { Student } from '../users/student.entity.js'; | ||||||
| import { QuestionRepository } from '../../data/questions/question-repository.js'; | import { QuestionRepository } from '../../data/questions/question-repository.js'; | ||||||
| import { Language } from '@dwengo-1/common/util/language'; | import { Language } from '@dwengo-1/common/util/language'; | ||||||
|  | import { Group } from '../assignments/group.entity'; | ||||||
| 
 | 
 | ||||||
| @Entity({ repository: () => QuestionRepository }) | @Entity({ repository: () => QuestionRepository }) | ||||||
| export class Question { | export class Question { | ||||||
|  | @ -20,6 +21,9 @@ export class Question { | ||||||
|     @PrimaryKey({ type: 'integer', autoincrement: true }) |     @PrimaryKey({ type: 'integer', autoincrement: true }) | ||||||
|     sequenceNumber?: number; |     sequenceNumber?: number; | ||||||
| 
 | 
 | ||||||
|  |     @ManyToOne({ entity: () => Group }) | ||||||
|  |     inGroup!: Group; | ||||||
|  | 
 | ||||||
|     @ManyToOne({ |     @ManyToOne({ | ||||||
|         entity: () => Student, |         entity: () => Student, | ||||||
|     }) |     }) | ||||||
|  |  | ||||||
|  | @ -1,7 +1,21 @@ | ||||||
| import { Group } from '../entities/assignments/group.entity.js'; | import { Group } from '../entities/assignments/group.entity.js'; | ||||||
| import { mapToAssignmentDTO } from './assignment.js'; | import { mapToAssignment, mapToAssignmentDTO, mapToAssignmentDTOId } from './assignment.js'; | ||||||
| import { mapToStudentDTO } from './student.js'; | import { mapToStudent, mapToStudentDTO } from './student.js'; | ||||||
| import { GroupDTO } from '@dwengo-1/common/interfaces/group'; | import { GroupDTO } from '@dwengo-1/common/interfaces/group'; | ||||||
|  | import { getGroupRepository } from '../data/repositories'; | ||||||
|  | import { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment'; | ||||||
|  | import { Class } from '../entities/classes/class.entity'; | ||||||
|  | import { StudentDTO } from '@dwengo-1/common/interfaces/student'; | ||||||
|  | 
 | ||||||
|  | export function mapToGroup(groupDto: GroupDTO, clazz: Class): Group { | ||||||
|  |     const assignmentDto = groupDto.assignment as AssignmentDTO; | ||||||
|  | 
 | ||||||
|  |     return getGroupRepository().create({ | ||||||
|  |         groupNumber: groupDto.groupNumber, | ||||||
|  |         assignment: mapToAssignment(assignmentDto, clazz), | ||||||
|  |         members: groupDto.members!.map((studentDto) => mapToStudent(studentDto as StudentDTO)), | ||||||
|  |     }); | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| export function mapToGroupDTO(group: Group): GroupDTO { | export function mapToGroupDTO(group: Group): GroupDTO { | ||||||
|     return { |     return { | ||||||
|  | @ -12,6 +26,16 @@ export function mapToGroupDTO(group: Group): GroupDTO { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function mapToGroupDTOId(group: Group): GroupDTO { | export function mapToGroupDTOId(group: Group): GroupDTO { | ||||||
|  |     return { | ||||||
|  |         assignment: mapToAssignmentDTOId(group.assignment), | ||||||
|  |         groupNumber: group.groupNumber!, | ||||||
|  |     }; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Map to group DTO where other objects are only referenced by their id. | ||||||
|  |  */ | ||||||
|  | export function mapToShallowGroupDTO(group: Group): GroupDTO { | ||||||
|     return { |     return { | ||||||
|         assignment: group.assignment.id!, |         assignment: group.assignment.id!, | ||||||
|         groupNumber: group.groupNumber!, |         groupNumber: group.groupNumber!, | ||||||
|  |  | ||||||
|  | @ -2,6 +2,7 @@ import { Question } from '../entities/questions/question.entity.js'; | ||||||
| import { mapToStudentDTO } from './student.js'; | import { mapToStudentDTO } from './student.js'; | ||||||
| import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | ||||||
| import { LearningObjectIdentifier } from '@dwengo-1/common/interfaces/learning-content'; | import { LearningObjectIdentifier } from '@dwengo-1/common/interfaces/learning-content'; | ||||||
|  | import { mapToGroupDTOId } from './group'; | ||||||
| 
 | 
 | ||||||
| function getLearningObjectIdentifier(question: Question): LearningObjectIdentifier { | function getLearningObjectIdentifier(question: Question): LearningObjectIdentifier { | ||||||
|     return { |     return { | ||||||
|  | @ -21,6 +22,7 @@ export function mapToQuestionDTO(question: Question): QuestionDTO { | ||||||
|         learningObjectIdentifier, |         learningObjectIdentifier, | ||||||
|         sequenceNumber: question.sequenceNumber!, |         sequenceNumber: question.sequenceNumber!, | ||||||
|         author: mapToStudentDTO(question.author), |         author: mapToStudentDTO(question.author), | ||||||
|  |         inGroup: mapToGroupDTOId(question.inGroup), | ||||||
|         timestamp: question.timestamp.toISOString(), |         timestamp: question.timestamp.toISOString(), | ||||||
|         content: question.content, |         content: question.content, | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
|  | @ -14,7 +14,7 @@ export function mapToSubmissionDTO(submission: Submission): SubmissionDTO { | ||||||
|         submissionNumber: submission.submissionNumber, |         submissionNumber: submission.submissionNumber, | ||||||
|         submitter: mapToStudentDTO(submission.submitter), |         submitter: mapToStudentDTO(submission.submitter), | ||||||
|         time: submission.submissionTime, |         time: submission.submissionTime, | ||||||
|         group: submission.onBehalfOf ? mapToGroupDTO(submission.onBehalfOf) : undefined, |         group: mapToGroupDTO(submission.onBehalfOf), | ||||||
|         content: submission.content, |         content: submission.content, | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
|  | @ -38,7 +38,6 @@ export function mapToSubmission(submissionDTO: SubmissionDTO): Submission { | ||||||
|     submission.submitter = mapToStudent(submissionDTO.submitter); |     submission.submitter = mapToStudent(submissionDTO.submitter); | ||||||
|     // Submission.submissionTime = submissionDTO.time;
 |     // Submission.submissionTime = submissionDTO.time;
 | ||||||
|     // Submission.onBehalfOf =  submissionDTO.group!;
 |     // Submission.onBehalfOf =  submissionDTO.group!;
 | ||||||
|     // TODO fix group
 |  | ||||||
|     submission.content = submissionDTO.content; |     submission.content = submissionDTO.content; | ||||||
| 
 | 
 | ||||||
|     return submission; |     return submission; | ||||||
|  |  | ||||||
|  | @ -1,13 +1,9 @@ | ||||||
| import express from 'express'; | import express from 'express'; | ||||||
| import { createSubmissionHandler, deleteSubmissionHandler, getSubmissionHandler } from '../controllers/submissions.js'; | import { createSubmissionHandler, deleteSubmissionHandler, getSubmissionHandler, getSubmissionsHandler } from '../controllers/submissions.js'; | ||||||
| const router = express.Router({ mergeParams: true }); | const router = express.Router({ mergeParams: true }); | ||||||
| 
 | 
 | ||||||
| // Root endpoint used to search objects
 | // Root endpoint used to search objects
 | ||||||
| router.get('/', (_req, res) => { | router.get('/', getSubmissionsHandler); | ||||||
|     res.json({ |  | ||||||
|         submissions: ['0', '1'], |  | ||||||
|     }); |  | ||||||
| }); |  | ||||||
| 
 | 
 | ||||||
| router.post('/:id', createSubmissionHandler); | router.post('/:id', createSubmissionHandler); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -6,7 +6,7 @@ import { | ||||||
|     getSubmissionRepository, |     getSubmissionRepository, | ||||||
| } from '../data/repositories.js'; | } from '../data/repositories.js'; | ||||||
| import { Group } from '../entities/assignments/group.entity.js'; | import { Group } from '../entities/assignments/group.entity.js'; | ||||||
| import { mapToGroupDTO, mapToGroupDTOId } from '../interfaces/group.js'; | import { mapToGroupDTO, mapToShallowGroupDTO } from '../interfaces/group.js'; | ||||||
| import { mapToSubmissionDTO, mapToSubmissionDTOId } from '../interfaces/submission.js'; | import { mapToSubmissionDTO, mapToSubmissionDTOId } from '../interfaces/submission.js'; | ||||||
| import { GroupDTO } from '@dwengo-1/common/interfaces/group'; | import { GroupDTO } from '@dwengo-1/common/interfaces/group'; | ||||||
| import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; | import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; | ||||||
|  | @ -38,7 +38,7 @@ export async function getGroup(classId: string, assignmentNumber: number, groupN | ||||||
|         return mapToGroupDTO(group); |         return mapToGroupDTO(group); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return mapToGroupDTOId(group); |     return mapToShallowGroupDTO(group); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export async function createGroup(groupData: GroupDTO, classid: string, assignmentNumber: number): Promise<Group | null> { | export async function createGroup(groupData: GroupDTO, classid: string, assignmentNumber: number): Promise<Group | null> { | ||||||
|  | @ -103,7 +103,7 @@ export async function getAllGroups(classId: string, assignmentNumber: number, fu | ||||||
|         return groups.map(mapToGroupDTO); |         return groups.map(mapToGroupDTO); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return groups.map(mapToGroupDTOId); |     return groups.map(mapToShallowGroupDTO); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export async function getGroupSubmissions( | export async function getGroupSubmissions( | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| import { getAnswerRepository, getQuestionRepository } from '../data/repositories.js'; | import { getAnswerRepository, getAssignmentRepository, getClassRepository, getGroupRepository, getQuestionRepository } from '../data/repositories.js'; | ||||||
| import { mapToQuestionDTO, mapToQuestionDTOId } from '../interfaces/question.js'; | import { mapToQuestionDTO, mapToQuestionDTOId } from '../interfaces/question.js'; | ||||||
| import { Question } from '../entities/questions/question.entity.js'; | import { Question } from '../entities/questions/question.entity.js'; | ||||||
| import { Answer } from '../entities/questions/answer.entity.js'; | import { Answer } from '../entities/questions/answer.entity.js'; | ||||||
|  | @ -8,6 +8,25 @@ import { LearningObjectIdentifier } from '../entities/content/learning-object-id | ||||||
| import { mapToStudent } from '../interfaces/student.js'; | import { mapToStudent } from '../interfaces/student.js'; | ||||||
| import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | ||||||
| import { AnswerDTO, AnswerId } from '@dwengo-1/common/interfaces/answer'; | import { AnswerDTO, AnswerId } from '@dwengo-1/common/interfaces/answer'; | ||||||
|  | import { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment'; | ||||||
|  | import { mapToAssignment } from '../interfaces/assignment'; | ||||||
|  | 
 | ||||||
|  | export async function getQuestionsAboutLearningObjectInAssignment( | ||||||
|  |     loId: LearningObjectIdentifier, | ||||||
|  |     classId: string, | ||||||
|  |     assignmentId: number, | ||||||
|  |     full: boolean, | ||||||
|  |     studentUsername?: string | ||||||
|  | ): Promise<QuestionDTO[] | QuestionId[]> { | ||||||
|  |     const assignment = await getAssignmentRepository().findByClassIdAndAssignmentId(classId, assignmentId); | ||||||
|  | 
 | ||||||
|  |     const questions = await getQuestionRepository().findAllQuestionsAboutLearningObjectInAssignment(loId, assignment!, studentUsername); | ||||||
|  | 
 | ||||||
|  |     if (full) { | ||||||
|  |         return questions.map((q) => mapToQuestionDTO(q)); | ||||||
|  |     } | ||||||
|  |     return questions.map((q) => mapToQuestionDTOId(q)); | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| export async function getAllQuestions(id: LearningObjectIdentifier, full: boolean): Promise<QuestionDTO[] | QuestionId[]> { | export async function getAllQuestions(id: LearningObjectIdentifier, full: boolean): Promise<QuestionDTO[] | QuestionId[]> { | ||||||
|     const questionRepository: QuestionRepository = getQuestionRepository(); |     const questionRepository: QuestionRepository = getQuestionRepository(); | ||||||
|  | @ -76,10 +95,15 @@ export async function createQuestion(questionDTO: QuestionDTO): Promise<Question | ||||||
|         version: questionDTO.learningObjectIdentifier.version ?? 1, |         version: questionDTO.learningObjectIdentifier.version ?? 1, | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  |     const clazz = await getClassRepository().findById((questionDTO.inGroup.assignment as AssignmentDTO).class); | ||||||
|  |     const assignment = mapToAssignment(questionDTO.inGroup.assignment as AssignmentDTO, clazz!); | ||||||
|  |     const inGroup = await getGroupRepository().findByAssignmentAndGroupNumber(assignment, questionDTO.inGroup.groupNumber); | ||||||
|  | 
 | ||||||
|     try { |     try { | ||||||
|         await questionRepository.createQuestion({ |         await questionRepository.createQuestion({ | ||||||
|             loId, |             loId, | ||||||
|             author, |             author, | ||||||
|  |             inGroup: inGroup!, | ||||||
|             content: questionDTO.content, |             content: questionDTO.content, | ||||||
|         }); |         }); | ||||||
|     } catch (_) { |     } catch (_) { | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ import { | ||||||
|     getSubmissionRepository, |     getSubmissionRepository, | ||||||
| } from '../data/repositories.js'; | } from '../data/repositories.js'; | ||||||
| import { mapToClassDTO } from '../interfaces/class.js'; | import { mapToClassDTO } from '../interfaces/class.js'; | ||||||
| import { mapToGroupDTO, mapToGroupDTOId } from '../interfaces/group.js'; | import { mapToGroupDTO, mapToShallowGroupDTO } from '../interfaces/group.js'; | ||||||
| import { mapToStudent, mapToStudentDTO } from '../interfaces/student.js'; | import { mapToStudent, mapToStudentDTO } from '../interfaces/student.js'; | ||||||
| import { mapToSubmissionDTO, mapToSubmissionDTOId } from '../interfaces/submission.js'; | import { mapToSubmissionDTO, mapToSubmissionDTOId } from '../interfaces/submission.js'; | ||||||
| import { getAllAssignments } from './assignments.js'; | import { getAllAssignments } from './assignments.js'; | ||||||
|  | @ -23,6 +23,7 @@ import { GroupDTO } from '@dwengo-1/common/interfaces/group'; | ||||||
| import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; | import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; | ||||||
| import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | ||||||
| import { ClassJoinRequestDTO } from '@dwengo-1/common/interfaces/class-join-request'; | import { ClassJoinRequestDTO } from '@dwengo-1/common/interfaces/class-join-request'; | ||||||
|  | import { Submission } from '../entities/assignments/submission.entity'; | ||||||
| 
 | 
 | ||||||
| export async function getAllStudents(full: boolean): Promise<StudentDTO[] | string[]> { | export async function getAllStudents(full: boolean): Promise<StudentDTO[] | string[]> { | ||||||
|     const studentRepository = getStudentRepository(); |     const studentRepository = getStudentRepository(); | ||||||
|  | @ -100,14 +101,15 @@ export async function getStudentGroups(username: string, full: boolean): Promise | ||||||
|         return groups.map(mapToGroupDTO); |         return groups.map(mapToGroupDTO); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return groups.map(mapToGroupDTOId); |     return groups.map(mapToShallowGroupDTO); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export async function getStudentSubmissions(username: string, full: boolean): Promise<SubmissionDTO[] | SubmissionDTOId[]> { | export async function getStudentSubmissions(username: string, full: boolean): Promise<SubmissionDTO[] | SubmissionDTOId[]> { | ||||||
|     const student = await fetchStudent(username); |     const student = await fetchStudent(username); | ||||||
| 
 | 
 | ||||||
|     const submissionRepository = getSubmissionRepository(); |     const submissionRepository = getSubmissionRepository(); | ||||||
|     const submissions = await submissionRepository.findAllSubmissionsForStudent(student); | 
 | ||||||
|  |     const submissions: Submission[] = await submissionRepository.findAllSubmissionsForStudent(student); | ||||||
| 
 | 
 | ||||||
|     if (full) { |     if (full) { | ||||||
|         return submissions.map(mapToSubmissionDTO); |         return submissions.map(mapToSubmissionDTO); | ||||||
|  |  | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| import { getSubmissionRepository } from '../data/repositories.js'; | import { getAssignmentRepository, getSubmissionRepository } from '../data/repositories.js'; | ||||||
| import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier.js'; | import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier.js'; | ||||||
| import { mapToSubmission, mapToSubmissionDTO } from '../interfaces/submission.js'; | import { mapToSubmission, mapToSubmissionDTO } from '../interfaces/submission.js'; | ||||||
| import { SubmissionDTO } from '@dwengo-1/common/interfaces/submission'; | import { SubmissionDTO } from '@dwengo-1/common/interfaces/submission'; | ||||||
|  | @ -55,3 +55,22 @@ export async function deleteSubmission( | ||||||
| 
 | 
 | ||||||
|     return submission; |     return submission; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * Returns all the submissions made by on behalf of any group the given student is in. | ||||||
|  |  */ | ||||||
|  | export async function getSubmissionsForLearningObjectAndAssignment( | ||||||
|  |     learningObjectHruid: string, | ||||||
|  |     language: Language, | ||||||
|  |     version: number, | ||||||
|  |     classId: string, | ||||||
|  |     assignmentId: number, | ||||||
|  |     studentUsername?: string | ||||||
|  | ): Promise<SubmissionDTO[]> { | ||||||
|  |     const loId = new LearningObjectIdentifier(learningObjectHruid, language, version); | ||||||
|  |     const assignment = await getAssignmentRepository().findByClassIdAndAssignmentId(classId, assignmentId); | ||||||
|  | 
 | ||||||
|  |     const submissions = await getSubmissionRepository().findAllSubmissionsForLearningObjectAndAssignment(loId, assignment!, studentUsername); | ||||||
|  | 
 | ||||||
|  |     return submissions.map((s) => mapToSubmissionDTO(s)); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -31,6 +31,13 @@ describe('AssignmentRepository', () => { | ||||||
|         expect(assignments[0].title).toBe('tool'); |         expect(assignments[0].title).toBe('tool'); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  |     it('should find all by username of the responsible teacher', async () => { | ||||||
|  |         const result = await assignmentRepository.findAllByResponsibleTeacher('FooFighters'); | ||||||
|  |         const resultIds = result.map((it) => it.id).sort((a, b) => (a ?? 0) - (b ?? 0)); | ||||||
|  | 
 | ||||||
|  |         expect(resultIds).toEqual([1, 3, 4]); | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|     it('should not find removed assignment', async () => { |     it('should not find removed assignment', async () => { | ||||||
|         const class_ = await classRepository.findById('id01'); |         const class_ = await classRepository.findById('id01'); | ||||||
|         await assignmentRepository.deleteByClassAndId(class_!, 3); |         await assignmentRepository.deleteByClassAndId(class_!, 3); | ||||||
|  |  | ||||||
|  | @ -14,6 +14,9 @@ import { StudentRepository } from '../../../src/data/users/student-repository'; | ||||||
| import { GroupRepository } from '../../../src/data/assignments/group-repository'; | import { GroupRepository } from '../../../src/data/assignments/group-repository'; | ||||||
| import { AssignmentRepository } from '../../../src/data/assignments/assignment-repository'; | import { AssignmentRepository } from '../../../src/data/assignments/assignment-repository'; | ||||||
| import { ClassRepository } from '../../../src/data/classes/class-repository'; | import { ClassRepository } from '../../../src/data/classes/class-repository'; | ||||||
|  | import { Submission } from '../../../src/entities/assignments/submission.entity'; | ||||||
|  | import { Class } from '../../../src/entities/classes/class.entity'; | ||||||
|  | import { Assignment } from '../../../src/entities/assignments/assignment.entity'; | ||||||
| 
 | 
 | ||||||
| describe('SubmissionRepository', () => { | describe('SubmissionRepository', () => { | ||||||
|     let submissionRepository: SubmissionRepository; |     let submissionRepository: SubmissionRepository; | ||||||
|  | @ -59,6 +62,49 @@ describe('SubmissionRepository', () => { | ||||||
|         expect(submission?.submissionTime.getDate()).toBe(25); |         expect(submission?.submissionTime.getDate()).toBe(25); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  |     let clazz: Class | null; | ||||||
|  |     let assignment: Assignment | null; | ||||||
|  |     let loId: LearningObjectIdentifier; | ||||||
|  |     it('should find all submissions for a certain learning object and assignment', async () => { | ||||||
|  |         clazz = await classRepository.findById('id01'); | ||||||
|  |         assignment = await assignmentRepository.findByClassAndId(clazz!, 1); | ||||||
|  |         loId = { | ||||||
|  |             hruid: 'id02', | ||||||
|  |             language: Language.English, | ||||||
|  |             version: 1, | ||||||
|  |         }; | ||||||
|  |         const result = await submissionRepository.findAllSubmissionsForLearningObjectAndAssignment(loId, assignment!); | ||||||
|  |         sortSubmissions(result); | ||||||
|  | 
 | ||||||
|  |         expect(result).toHaveLength(3); | ||||||
|  | 
 | ||||||
|  |         // Submission3 should be found (for learning object 'id02' by group #1 for Assignment #1 in class 'id01')
 | ||||||
|  |         expect(result[0].learningObjectHruid).toBe(loId.hruid); | ||||||
|  |         expect(result[0].submissionNumber).toBe(1); | ||||||
|  | 
 | ||||||
|  |         // Submission4 should be found (for learning object 'id02' by group #1 for Assignment #1 in class 'id01')
 | ||||||
|  |         expect(result[1].learningObjectHruid).toBe(loId.hruid); | ||||||
|  |         expect(result[1].submissionNumber).toBe(2); | ||||||
|  | 
 | ||||||
|  |         // Submission8 should be found (for learning object 'id02' by group #2 for Assignment #1 in class 'id01')
 | ||||||
|  |         expect(result[2].learningObjectHruid).toBe(loId.hruid); | ||||||
|  |         expect(result[2].submissionNumber).toBe(3); | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     it("should find only the submissions for a certain learning object and assignment made for the user's group", async () => { | ||||||
|  |         const result = await submissionRepository.findAllSubmissionsForLearningObjectAndAssignment(loId, assignment!, 'Tool'); | ||||||
|  |         // (student Tool is in group #2)
 | ||||||
|  | 
 | ||||||
|  |         expect(result).toHaveLength(1); | ||||||
|  | 
 | ||||||
|  |         // Submission8 should be found (for learning object 'id02' by group #2 for Assignment #1 in class 'id01')
 | ||||||
|  |         expect(result[0].learningObjectHruid).toBe(loId.hruid); | ||||||
|  |         expect(result[0].submissionNumber).toBe(3); | ||||||
|  | 
 | ||||||
|  |         // The other submissions found in the previous test case should not be found anymore as they were made on
 | ||||||
|  |         // Behalf of group #1 which Tool is no member of.
 | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|     it('should not find a deleted submission', async () => { |     it('should not find a deleted submission', async () => { | ||||||
|         const id = new LearningObjectIdentifier('id01', Language.English, 1); |         const id = new LearningObjectIdentifier('id01', Language.English, 1); | ||||||
|         await submissionRepository.deleteSubmissionByLearningObjectAndSubmissionNumber(id, 1); |         await submissionRepository.deleteSubmissionByLearningObjectAndSubmissionNumber(id, 1); | ||||||
|  | @ -68,3 +114,15 @@ describe('SubmissionRepository', () => { | ||||||
|         expect(submission).toBeNull(); |         expect(submission).toBeNull(); | ||||||
|     }); |     }); | ||||||
| }); | }); | ||||||
|  | 
 | ||||||
|  | function sortSubmissions(submissions: Submission[]): void { | ||||||
|  |     submissions.sort((a, b) => { | ||||||
|  |         if (a.learningObjectHruid < b.learningObjectHruid) { | ||||||
|  |             return -1; | ||||||
|  |         } | ||||||
|  |         if (a.learningObjectHruid > b.learningObjectHruid) { | ||||||
|  |             return 1; | ||||||
|  |         } | ||||||
|  |         return a.submissionNumber! - b.submissionNumber!; | ||||||
|  |     }); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -1,10 +1,19 @@ | ||||||
| import { beforeAll, describe, expect, it } from 'vitest'; | import { beforeAll, describe, expect, it } from 'vitest'; | ||||||
| import { setupTestApp } from '../../setup-tests'; | import { setupTestApp } from '../../setup-tests'; | ||||||
| import { QuestionRepository } from '../../../src/data/questions/question-repository'; | import { QuestionRepository } from '../../../src/data/questions/question-repository'; | ||||||
| import { getQuestionRepository, getStudentRepository } from '../../../src/data/repositories'; | import { | ||||||
|  |     getAssignmentRepository, | ||||||
|  |     getClassRepository, | ||||||
|  |     getGroupRepository, | ||||||
|  |     getQuestionRepository, | ||||||
|  |     getStudentRepository, | ||||||
|  | } from '../../../src/data/repositories'; | ||||||
| import { StudentRepository } from '../../../src/data/users/student-repository'; | import { StudentRepository } from '../../../src/data/users/student-repository'; | ||||||
| import { LearningObjectIdentifier } from '../../../src/entities/content/learning-object-identifier'; | import { LearningObjectIdentifier } from '../../../src/entities/content/learning-object-identifier'; | ||||||
| import { Language } from '@dwengo-1/common/util/language'; | import { Language } from '@dwengo-1/common/util/language'; | ||||||
|  | import { Question } from '../../../src/entities/questions/question.entity'; | ||||||
|  | import { Class } from '../../../src/entities/classes/class.entity'; | ||||||
|  | import { Assignment } from '../../../src/entities/assignments/assignment.entity'; | ||||||
| 
 | 
 | ||||||
| describe('QuestionRepository', () => { | describe('QuestionRepository', () => { | ||||||
|     let questionRepository: QuestionRepository; |     let questionRepository: QuestionRepository; | ||||||
|  | @ -21,14 +30,19 @@ describe('QuestionRepository', () => { | ||||||
|         const questions = await questionRepository.findAllQuestionsAboutLearningObject(id); |         const questions = await questionRepository.findAllQuestionsAboutLearningObject(id); | ||||||
| 
 | 
 | ||||||
|         expect(questions).toBeTruthy(); |         expect(questions).toBeTruthy(); | ||||||
|         expect(questions).toHaveLength(2); |         expect(questions).toHaveLength(4); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     it('should create new question', async () => { |     it('should create new question', async () => { | ||||||
|         const id = new LearningObjectIdentifier('id03', Language.English, 1); |         const id = new LearningObjectIdentifier('id03', Language.English, 1); | ||||||
|         const student = await studentRepository.findByUsername('Noordkaap'); |         const student = await studentRepository.findByUsername('Noordkaap'); | ||||||
|  | 
 | ||||||
|  |         const clazz = await getClassRepository().findById('id01'); | ||||||
|  |         const assignment = await getAssignmentRepository().findByClassAndId(clazz!, 1); | ||||||
|  |         const group = await getGroupRepository().findByAssignmentAndGroupNumber(assignment!, 1); | ||||||
|         await questionRepository.createQuestion({ |         await questionRepository.createQuestion({ | ||||||
|             loId: id, |             loId: id, | ||||||
|  |             inGroup: group!, | ||||||
|             author: student!, |             author: student!, | ||||||
|             content: 'question?', |             content: 'question?', | ||||||
|         }); |         }); | ||||||
|  | @ -38,6 +52,52 @@ describe('QuestionRepository', () => { | ||||||
|         expect(question).toHaveLength(1); |         expect(question).toHaveLength(1); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  |     let clazz: Class | null; | ||||||
|  |     let assignment: Assignment | null; | ||||||
|  |     let loId: LearningObjectIdentifier; | ||||||
|  |     it('should find all questions for a certain learning object and assignment', async () => { | ||||||
|  |         clazz = await getClassRepository().findById('id01'); | ||||||
|  |         assignment = await getAssignmentRepository().findByClassAndId(clazz!, 1); | ||||||
|  |         loId = { | ||||||
|  |             hruid: 'id05', | ||||||
|  |             language: Language.English, | ||||||
|  |             version: 1, | ||||||
|  |         }; | ||||||
|  |         const result = await questionRepository.findAllQuestionsAboutLearningObjectInAssignment(loId, assignment!); | ||||||
|  |         sortQuestions(result); | ||||||
|  | 
 | ||||||
|  |         expect(result).toHaveLength(3); | ||||||
|  | 
 | ||||||
|  |         // Question01: About learning object 'id05', in group #1 for Assignment #1 in class 'id01'
 | ||||||
|  |         expect(result[0].learningObjectHruid).toEqual(loId.hruid); | ||||||
|  |         expect(result[0].sequenceNumber).toEqual(1); | ||||||
|  | 
 | ||||||
|  |         // Question02: About learning object 'id05', in group #1 for Assignment #1 in class 'id01'
 | ||||||
|  |         expect(result[1].learningObjectHruid).toEqual(loId.hruid); | ||||||
|  |         expect(result[1].sequenceNumber).toEqual(2); | ||||||
|  | 
 | ||||||
|  |         // Question05: About learning object 'id05', in group #2 for Assignment #1 in class 'id01'
 | ||||||
|  |         expect(result[2].learningObjectHruid).toEqual(loId.hruid); | ||||||
|  |         expect(result[2].sequenceNumber).toEqual(3); | ||||||
|  | 
 | ||||||
|  |         // Question06: About learning object 'id05', but for Assignment #2 in class 'id01' => not expected.
 | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     it("should find only the questions for a certain learning object and assignment asked by the user's group", async () => { | ||||||
|  |         const result = await questionRepository.findAllQuestionsAboutLearningObjectInAssignment(loId, assignment!, 'Tool'); | ||||||
|  |         // (student Tool is in group #2)
 | ||||||
|  | 
 | ||||||
|  |         expect(result).toHaveLength(1); | ||||||
|  | 
 | ||||||
|  |         // Question01 and question02 are in group #1 => not displayed.
 | ||||||
|  | 
 | ||||||
|  |         // Question05: About learning object 'id05', in group #2 for Assignment #1 in class 'id01'
 | ||||||
|  |         expect(result[0].learningObjectHruid).toEqual(loId.hruid); | ||||||
|  |         expect(result[0].sequenceNumber).toEqual(3); | ||||||
|  | 
 | ||||||
|  |         // Question06: About learning object 'id05', but for Assignment #2 in class 'id01' => not expected.
 | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|     it('should not find removed question', async () => { |     it('should not find removed question', async () => { | ||||||
|         const id = new LearningObjectIdentifier('id04', Language.English, 1); |         const id = new LearningObjectIdentifier('id04', Language.English, 1); | ||||||
|         await questionRepository.removeQuestionByLearningObjectAndSequenceNumber(id, 1); |         await questionRepository.removeQuestionByLearningObjectAndSequenceNumber(id, 1); | ||||||
|  | @ -47,3 +107,14 @@ describe('QuestionRepository', () => { | ||||||
|         expect(question).toHaveLength(0); |         expect(question).toHaveLength(0); | ||||||
|     }); |     }); | ||||||
| }); | }); | ||||||
|  | 
 | ||||||
|  | function sortQuestions(questions: Question[]): void { | ||||||
|  |     questions.sort((a, b) => { | ||||||
|  |         if (a.learningObjectHruid < b.learningObjectHruid) { | ||||||
|  |             return -1; | ||||||
|  |         } else if (a.learningObjectHruid > b.learningObjectHruid) { | ||||||
|  |             return 1; | ||||||
|  |         } | ||||||
|  |         return a.sequenceNumber! - b.sequenceNumber!; | ||||||
|  |     }); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -3,6 +3,9 @@ import { LearningObject } from '../../../src/entities/content/learning-object.en | ||||||
| import { setupTestApp } from '../../setup-tests.js'; | import { setupTestApp } from '../../setup-tests.js'; | ||||||
| import { LearningPath } from '../../../src/entities/content/learning-path.entity.js'; | import { LearningPath } from '../../../src/entities/content/learning-path.entity.js'; | ||||||
| import { | import { | ||||||
|  |     getAssignmentRepository, | ||||||
|  |     getClassRepository, | ||||||
|  |     getGroupRepository, | ||||||
|     getLearningObjectRepository, |     getLearningObjectRepository, | ||||||
|     getLearningPathRepository, |     getLearningPathRepository, | ||||||
|     getStudentRepository, |     getStudentRepository, | ||||||
|  | @ -22,6 +25,10 @@ import { Student } from '../../../src/entities/users/student.entity.js'; | ||||||
| 
 | 
 | ||||||
| import { LearningObjectNode, LearningPathResponse } from '@dwengo-1/common/interfaces/learning-content'; | import { LearningObjectNode, LearningPathResponse } from '@dwengo-1/common/interfaces/learning-content'; | ||||||
| 
 | 
 | ||||||
|  | const STUDENT_A_USERNAME = 'student_a'; | ||||||
|  | const STUDENT_B_USERNAME = 'student_b'; | ||||||
|  | const CLASS_NAME = 'test_class'; | ||||||
|  | 
 | ||||||
| async function initExampleData(): Promise<{ learningObject: LearningObject; learningPath: LearningPath }> { | async function initExampleData(): Promise<{ learningObject: LearningObject; learningPath: LearningPath }> { | ||||||
|     const learningObjectRepo = getLearningObjectRepository(); |     const learningObjectRepo = getLearningObjectRepository(); | ||||||
|     const learningPathRepo = getLearningPathRepository(); |     const learningPathRepo = getLearningPathRepository(); | ||||||
|  | @ -38,6 +45,9 @@ async function initPersonalizationTestData(): Promise<{ | ||||||
|     studentB: Student; |     studentB: Student; | ||||||
| }> { | }> { | ||||||
|     const studentRepo = getStudentRepository(); |     const studentRepo = getStudentRepository(); | ||||||
|  |     const classRepo = getClassRepository(); | ||||||
|  |     const assignmentRepo = getAssignmentRepository(); | ||||||
|  |     const groupRepo = getGroupRepository(); | ||||||
|     const submissionRepo = getSubmissionRepository(); |     const submissionRepo = getSubmissionRepository(); | ||||||
|     const learningPathRepo = getLearningPathRepository(); |     const learningPathRepo = getLearningPathRepository(); | ||||||
|     const learningObjectRepo = getLearningObjectRepository(); |     const learningObjectRepo = getLearningObjectRepository(); | ||||||
|  | @ -47,32 +57,69 @@ async function initPersonalizationTestData(): Promise<{ | ||||||
|     await learningObjectRepo.save(learningContent.extraExerciseObject); |     await learningObjectRepo.save(learningContent.extraExerciseObject); | ||||||
|     await learningPathRepo.save(learningContent.learningPath); |     await learningPathRepo.save(learningContent.learningPath); | ||||||
| 
 | 
 | ||||||
|  |     // Create students
 | ||||||
|     const studentA = studentRepo.create({ |     const studentA = studentRepo.create({ | ||||||
|         username: 'student_a', |         username: STUDENT_A_USERNAME, | ||||||
|         firstName: 'Aron', |         firstName: 'Aron', | ||||||
|         lastName: 'Student', |         lastName: 'Student', | ||||||
|     }); |     }); | ||||||
|     await studentRepo.save(studentA); |     await studentRepo.save(studentA); | ||||||
|  | 
 | ||||||
|  |     const studentB = studentRepo.create({ | ||||||
|  |         username: STUDENT_B_USERNAME, | ||||||
|  |         firstName: 'Bill', | ||||||
|  |         lastName: 'Student', | ||||||
|  |     }); | ||||||
|  |     await studentRepo.save(studentB); | ||||||
|  | 
 | ||||||
|  |     // Create class for students
 | ||||||
|  |     const testClass = classRepo.create({ | ||||||
|  |         classId: CLASS_NAME, | ||||||
|  |         displayName: 'Test class', | ||||||
|  |     }); | ||||||
|  |     await classRepo.save(testClass); | ||||||
|  | 
 | ||||||
|  |     // Create assignment for students and assign them to different groups
 | ||||||
|  |     const assignment = assignmentRepo.create({ | ||||||
|  |         id: 0, | ||||||
|  |         title: 'Test assignment', | ||||||
|  |         description: 'Test description', | ||||||
|  |         learningPathHruid: learningContent.learningPath.hruid, | ||||||
|  |         learningPathLanguage: learningContent.learningPath.language, | ||||||
|  |         within: testClass, | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const groupA = groupRepo.create({ | ||||||
|  |         groupNumber: 0, | ||||||
|  |         members: [studentA], | ||||||
|  |         assignment, | ||||||
|  |     }); | ||||||
|  |     await groupRepo.save(groupA); | ||||||
|  | 
 | ||||||
|  |     const groupB = groupRepo.create({ | ||||||
|  |         groupNumber: 1, | ||||||
|  |         members: [studentB], | ||||||
|  |         assignment, | ||||||
|  |     }); | ||||||
|  |     await groupRepo.save(groupB); | ||||||
|  | 
 | ||||||
|  |     // Let each of the students make a submission in his own group.
 | ||||||
|     const submissionA = submissionRepo.create({ |     const submissionA = submissionRepo.create({ | ||||||
|         learningObjectHruid: learningContent.branchingObject.hruid, |         learningObjectHruid: learningContent.branchingObject.hruid, | ||||||
|         learningObjectLanguage: learningContent.branchingObject.language, |         learningObjectLanguage: learningContent.branchingObject.language, | ||||||
|         learningObjectVersion: learningContent.branchingObject.version, |         learningObjectVersion: learningContent.branchingObject.version, | ||||||
|  |         onBehalfOf: groupA, | ||||||
|         submitter: studentA, |         submitter: studentA, | ||||||
|         submissionTime: new Date(), |         submissionTime: new Date(), | ||||||
|         content: '[0]', |         content: '[0]', | ||||||
|     }); |     }); | ||||||
|     await submissionRepo.save(submissionA); |     await submissionRepo.save(submissionA); | ||||||
| 
 | 
 | ||||||
|     const studentB = studentRepo.create({ |  | ||||||
|         username: 'student_b', |  | ||||||
|         firstName: 'Bill', |  | ||||||
|         lastName: 'Student', |  | ||||||
|     }); |  | ||||||
|     await studentRepo.save(studentB); |  | ||||||
|     const submissionB = submissionRepo.create({ |     const submissionB = submissionRepo.create({ | ||||||
|         learningObjectHruid: learningContent.branchingObject.hruid, |         learningObjectHruid: learningContent.branchingObject.hruid, | ||||||
|         learningObjectLanguage: learningContent.branchingObject.language, |         learningObjectLanguage: learningContent.branchingObject.language, | ||||||
|         learningObjectVersion: learningContent.branchingObject.version, |         learningObjectVersion: learningContent.branchingObject.version, | ||||||
|  |         onBehalfOf: groupA, | ||||||
|         submitter: studentB, |         submitter: studentB, | ||||||
|         submissionTime: new Date(), |         submissionTime: new Date(), | ||||||
|         content: '[1]', |         content: '[1]', | ||||||
|  |  | ||||||
|  | @ -37,7 +37,7 @@ export async function setupTestApp(): Promise<void> { | ||||||
| 
 | 
 | ||||||
|     learningObjects[1].attachments = attachments; |     learningObjects[1].attachments = attachments; | ||||||
| 
 | 
 | ||||||
|     const questions = makeTestQuestions(em, students); |     const questions = makeTestQuestions(em, students, groups); | ||||||
|     const answers = makeTestAnswers(em, teachers, questions); |     const answers = makeTestAnswers(em, teachers, questions); | ||||||
|     const submissions = makeTestSubmissions(em, students, groups); |     const submissions = makeTestSubmissions(em, students, groups); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -34,5 +34,15 @@ export function makeTestAssignemnts(em: EntityManager, classes: Class[]): Assign | ||||||
|         groups: [], |         groups: [], | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     return [assignment01, assignment02, assignment03]; |     const assignment04 = em.create(Assignment, { | ||||||
|  |         within: classes[0], | ||||||
|  |         id: 4, | ||||||
|  |         title: 'another assignment', | ||||||
|  |         description: 'with a description', | ||||||
|  |         learningPathHruid: 'id01', | ||||||
|  |         learningPathLanguage: Language.English, | ||||||
|  |         groups: [], | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     return [assignment01, assignment02, assignment03, assignment04]; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -4,29 +4,55 @@ import { Assignment } from '../../../src/entities/assignments/assignment.entity' | ||||||
| import { Student } from '../../../src/entities/users/student.entity'; | import { Student } from '../../../src/entities/users/student.entity'; | ||||||
| 
 | 
 | ||||||
| export function makeTestGroups(em: EntityManager, students: Student[], assignments: Assignment[]): Group[] { | export function makeTestGroups(em: EntityManager, students: Student[], assignments: Assignment[]): Group[] { | ||||||
|  |     /* | ||||||
|  |      * Group #1 for Assignment #1 in class 'id01' | ||||||
|  |      * => Assigned to do learning path 'id02' | ||||||
|  |      */ | ||||||
|     const group01 = em.create(Group, { |     const group01 = em.create(Group, { | ||||||
|         assignment: assignments[0], |         assignment: assignments[0], | ||||||
|         groupNumber: 1, |         groupNumber: 1, | ||||||
|         members: students.slice(0, 2), |         members: students.slice(0, 2), | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  |     /* | ||||||
|  |      * Group #2 for Assignment #1 in class 'id01' | ||||||
|  |      * => Assigned to do learning path 'id02' | ||||||
|  |      */ | ||||||
|     const group02 = em.create(Group, { |     const group02 = em.create(Group, { | ||||||
|         assignment: assignments[0], |         assignment: assignments[0], | ||||||
|         groupNumber: 2, |         groupNumber: 2, | ||||||
|         members: students.slice(2, 4), |         members: students.slice(2, 4), | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  |     /* | ||||||
|  |      * Group #3 for Assignment #1 in class 'id01' | ||||||
|  |      * => Assigned to do learning path 'id02' | ||||||
|  |      */ | ||||||
|     const group03 = em.create(Group, { |     const group03 = em.create(Group, { | ||||||
|         assignment: assignments[0], |         assignment: assignments[0], | ||||||
|         groupNumber: 3, |         groupNumber: 3, | ||||||
|         members: students.slice(4, 6), |         members: students.slice(4, 6), | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  |     /* | ||||||
|  |      * Group #4 for Assignment #2 in class 'id02' | ||||||
|  |      * => Assigned to do learning path 'id01' | ||||||
|  |      */ | ||||||
|     const group04 = em.create(Group, { |     const group04 = em.create(Group, { | ||||||
|         assignment: assignments[1], |         assignment: assignments[1], | ||||||
|         groupNumber: 4, |         groupNumber: 4, | ||||||
|         members: students.slice(3, 4), |         members: students.slice(3, 4), | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     return [group01, group02, group03, group04]; |     /* | ||||||
|  |      * Group #5 for Assignment #4 in class 'id01' | ||||||
|  |      * => Assigned to do learning path 'id01' | ||||||
|  |      */ | ||||||
|  |     const group05 = em.create(Group, { | ||||||
|  |         assignment: assignments[3], | ||||||
|  |         groupNumber: 1, | ||||||
|  |         members: students.slice(0, 2), | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     return [group01, group02, group03, group04, group05]; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -12,7 +12,7 @@ export function makeTestSubmissions(em: EntityManager, students: Student[], grou | ||||||
|         submissionNumber: 1, |         submissionNumber: 1, | ||||||
|         submitter: students[0], |         submitter: students[0], | ||||||
|         submissionTime: new Date(2025, 2, 20), |         submissionTime: new Date(2025, 2, 20), | ||||||
|         onBehalfOf: groups[0], |         onBehalfOf: groups[0], // Group #1 for Assignment #1 in class 'id01'
 | ||||||
|         content: 'sub1', |         content: 'sub1', | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  | @ -23,7 +23,7 @@ export function makeTestSubmissions(em: EntityManager, students: Student[], grou | ||||||
|         submissionNumber: 2, |         submissionNumber: 2, | ||||||
|         submitter: students[0], |         submitter: students[0], | ||||||
|         submissionTime: new Date(2025, 2, 25), |         submissionTime: new Date(2025, 2, 25), | ||||||
|         onBehalfOf: groups[0], |         onBehalfOf: groups[0], // Group #1 for Assignment #1 in class 'id01'
 | ||||||
|         content: '', |         content: '', | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  | @ -34,6 +34,7 @@ export function makeTestSubmissions(em: EntityManager, students: Student[], grou | ||||||
|         submissionNumber: 1, |         submissionNumber: 1, | ||||||
|         submitter: students[0], |         submitter: students[0], | ||||||
|         submissionTime: new Date(2025, 2, 20), |         submissionTime: new Date(2025, 2, 20), | ||||||
|  |         onBehalfOf: groups[0], // Group #1 for Assignment #1 in class 'id01'
 | ||||||
|         content: '', |         content: '', | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  | @ -44,6 +45,7 @@ export function makeTestSubmissions(em: EntityManager, students: Student[], grou | ||||||
|         submissionNumber: 2, |         submissionNumber: 2, | ||||||
|         submitter: students[0], |         submitter: students[0], | ||||||
|         submissionTime: new Date(2025, 2, 25), |         submissionTime: new Date(2025, 2, 25), | ||||||
|  |         onBehalfOf: groups[0], // Group #1 for Assignment #1 in class 'id01'
 | ||||||
|         content: '', |         content: '', | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|  | @ -54,8 +56,42 @@ export function makeTestSubmissions(em: EntityManager, students: Student[], grou | ||||||
|         submissionNumber: 1, |         submissionNumber: 1, | ||||||
|         submitter: students[1], |         submitter: students[1], | ||||||
|         submissionTime: new Date(2025, 2, 20), |         submissionTime: new Date(2025, 2, 20), | ||||||
|  |         onBehalfOf: groups[1], // Group #2 for Assignment #1 in class 'id01'
 | ||||||
|         content: '', |         content: '', | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     return [submission01, submission02, submission03, submission04, submission05]; |     const submission06 = em.create(Submission, { | ||||||
|  |         learningObjectHruid: 'id01', | ||||||
|  |         learningObjectLanguage: Language.English, | ||||||
|  |         learningObjectVersion: 1, | ||||||
|  |         submissionNumber: 2, | ||||||
|  |         submitter: students[1], | ||||||
|  |         submissionTime: new Date(2025, 2, 25), | ||||||
|  |         onBehalfOf: groups[4], // Group #5 for Assignment #4 in class 'id01'
 | ||||||
|  |         content: '', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const submission07 = em.create(Submission, { | ||||||
|  |         learningObjectHruid: 'id01', | ||||||
|  |         learningObjectLanguage: Language.English, | ||||||
|  |         learningObjectVersion: 1, | ||||||
|  |         submissionNumber: 3, | ||||||
|  |         submitter: students[3], | ||||||
|  |         submissionTime: new Date(2025, 3, 25), | ||||||
|  |         onBehalfOf: groups[3], // Group #4 for Assignment #2 in class 'id02'
 | ||||||
|  |         content: '', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const submission08 = em.create(Submission, { | ||||||
|  |         learningObjectHruid: 'id02', | ||||||
|  |         learningObjectLanguage: Language.English, | ||||||
|  |         learningObjectVersion: 1, | ||||||
|  |         submissionNumber: 3, | ||||||
|  |         submitter: students[1], | ||||||
|  |         submissionTime: new Date(2025, 4, 7), | ||||||
|  |         onBehalfOf: groups[1], // Group #2 for Assignment #1 in class 'id01'
 | ||||||
|  |         content: '', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     return [submission01, submission02, submission03, submission04, submission05, submission06, submission07, submission08]; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -2,12 +2,14 @@ import { EntityManager } from '@mikro-orm/core'; | ||||||
| import { Question } from '../../../src/entities/questions/question.entity'; | import { Question } from '../../../src/entities/questions/question.entity'; | ||||||
| import { Language } from '@dwengo-1/common/util/language'; | import { Language } from '@dwengo-1/common/util/language'; | ||||||
| import { Student } from '../../../src/entities/users/student.entity'; | import { Student } from '../../../src/entities/users/student.entity'; | ||||||
|  | import { Group } from '../../../src/entities/assignments/group.entity'; | ||||||
| 
 | 
 | ||||||
| export function makeTestQuestions(em: EntityManager, students: Student[]): Question[] { | export function makeTestQuestions(em: EntityManager, students: Student[], groups: Group[]): Question[] { | ||||||
|     const question01 = em.create(Question, { |     const question01 = em.create(Question, { | ||||||
|         learningObjectLanguage: Language.English, |         learningObjectLanguage: Language.English, | ||||||
|         learningObjectVersion: 1, |         learningObjectVersion: 1, | ||||||
|         learningObjectHruid: 'id05', |         learningObjectHruid: 'id05', | ||||||
|  |         inGroup: groups[0], // Group #1 for Assignment #1 in class 'id01'
 | ||||||
|         sequenceNumber: 1, |         sequenceNumber: 1, | ||||||
|         author: students[0], |         author: students[0], | ||||||
|         timestamp: new Date(), |         timestamp: new Date(), | ||||||
|  | @ -18,6 +20,7 @@ export function makeTestQuestions(em: EntityManager, students: Student[]): Quest | ||||||
|         learningObjectLanguage: Language.English, |         learningObjectLanguage: Language.English, | ||||||
|         learningObjectVersion: 1, |         learningObjectVersion: 1, | ||||||
|         learningObjectHruid: 'id05', |         learningObjectHruid: 'id05', | ||||||
|  |         inGroup: groups[0], // Group #1 for Assignment #1 in class 'id01'
 | ||||||
|         sequenceNumber: 2, |         sequenceNumber: 2, | ||||||
|         author: students[2], |         author: students[2], | ||||||
|         timestamp: new Date(), |         timestamp: new Date(), | ||||||
|  | @ -30,6 +33,7 @@ export function makeTestQuestions(em: EntityManager, students: Student[]): Quest | ||||||
|         learningObjectHruid: 'id04', |         learningObjectHruid: 'id04', | ||||||
|         sequenceNumber: 1, |         sequenceNumber: 1, | ||||||
|         author: students[0], |         author: students[0], | ||||||
|  |         inGroup: groups[0], // Group #1 for Assignment #1 in class 'id01'
 | ||||||
|         timestamp: new Date(), |         timestamp: new Date(), | ||||||
|         content: 'question', |         content: 'question', | ||||||
|     }); |     }); | ||||||
|  | @ -40,9 +44,32 @@ export function makeTestQuestions(em: EntityManager, students: Student[]): Quest | ||||||
|         learningObjectHruid: 'id01', |         learningObjectHruid: 'id01', | ||||||
|         sequenceNumber: 1, |         sequenceNumber: 1, | ||||||
|         author: students[1], |         author: students[1], | ||||||
|  |         inGroup: groups[1], // Group #2 for Assignment #1 in class 'id01'
 | ||||||
|         timestamp: new Date(), |         timestamp: new Date(), | ||||||
|         content: 'question', |         content: 'question', | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     return [question01, question02, question03, question04]; |     const question05 = em.create(Question, { | ||||||
|  |         learningObjectLanguage: Language.English, | ||||||
|  |         learningObjectVersion: 1, | ||||||
|  |         learningObjectHruid: 'id05', | ||||||
|  |         sequenceNumber: 3, | ||||||
|  |         author: students[1], | ||||||
|  |         inGroup: groups[1], // Group #2 for Assignment #1 in class 'id01'
 | ||||||
|  |         timestamp: new Date(), | ||||||
|  |         content: 'question', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     const question06 = em.create(Question, { | ||||||
|  |         learningObjectLanguage: Language.English, | ||||||
|  |         learningObjectVersion: 1, | ||||||
|  |         learningObjectHruid: 'id05', | ||||||
|  |         sequenceNumber: 4, | ||||||
|  |         author: students[2], | ||||||
|  |         inGroup: groups[3], // Group #4 for Assignment #2 in class 'id02'
 | ||||||
|  |         timestamp: new Date(), | ||||||
|  |         content: 'question', | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     return [question01, question02, question03, question04, question05, question06]; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -4,5 +4,5 @@ import { StudentDTO } from './student'; | ||||||
| export interface GroupDTO { | export interface GroupDTO { | ||||||
|     assignment: number | AssignmentDTO; |     assignment: number | AssignmentDTO; | ||||||
|     groupNumber: number; |     groupNumber: number; | ||||||
|     members: string[] | StudentDTO[]; |     members?: string[] | StudentDTO[]; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,10 +1,12 @@ | ||||||
| import { LearningObjectIdentifier } from './learning-content'; | import { LearningObjectIdentifier } from './learning-content'; | ||||||
| import { StudentDTO } from './student'; | import { StudentDTO } from './student'; | ||||||
|  | import { GroupDTO } from './group'; | ||||||
| 
 | 
 | ||||||
| export interface QuestionDTO { | export interface QuestionDTO { | ||||||
|     learningObjectIdentifier: LearningObjectIdentifier; |     learningObjectIdentifier: LearningObjectIdentifier; | ||||||
|     sequenceNumber?: number; |     sequenceNumber?: number; | ||||||
|     author: StudentDTO; |     author: StudentDTO; | ||||||
|  |     inGroup: GroupDTO; | ||||||
|     timestamp?: string; |     timestamp?: string; | ||||||
|     content: string; |     content: string; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -9,7 +9,7 @@ export interface SubmissionDTO { | ||||||
|     submissionNumber?: number; |     submissionNumber?: number; | ||||||
|     submitter: StudentDTO; |     submitter: StudentDTO; | ||||||
|     time?: Date; |     time?: Date; | ||||||
|     group?: GroupDTO; |     group: GroupDTO; | ||||||
|     content: string; |     content: string; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										319
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										319
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							|  | @ -72,6 +72,133 @@ | ||||||
|                 "vitest": "^3.0.6" |                 "vitest": "^3.0.6" | ||||||
|             } |             } | ||||||
|         }, |         }, | ||||||
|  |         "backend/node_modules/@mikro-orm/cli": { | ||||||
|  |             "version": "6.4.9", | ||||||
|  |             "resolved": "https://registry.npmjs.org/@mikro-orm/cli/-/cli-6.4.9.tgz", | ||||||
|  |             "integrity": "sha512-LQzVsmar/0DoJkPGyz3OpB8pa9BCQtvYreEC71h0O+RcizppJjgBQNTkj5tJd2Iqvh4hSaMv6qTv0l5UK6F2Vw==", | ||||||
|  |             "dev": true, | ||||||
|  |             "license": "MIT", | ||||||
|  |             "dependencies": { | ||||||
|  |                 "@jercle/yargonaut": "1.1.5", | ||||||
|  |                 "@mikro-orm/core": "6.4.9", | ||||||
|  |                 "@mikro-orm/knex": "6.4.9", | ||||||
|  |                 "fs-extra": "11.3.0", | ||||||
|  |                 "tsconfig-paths": "4.2.0", | ||||||
|  |                 "yargs": "17.7.2" | ||||||
|  |             }, | ||||||
|  |             "bin": { | ||||||
|  |                 "mikro-orm": "cli", | ||||||
|  |                 "mikro-orm-esm": "esm" | ||||||
|  |             }, | ||||||
|  |             "engines": { | ||||||
|  |                 "node": ">= 18.12.0" | ||||||
|  |             } | ||||||
|  |         }, | ||||||
|  |         "backend/node_modules/@mikro-orm/core": { | ||||||
|  |             "version": "6.4.9", | ||||||
|  |             "resolved": "https://registry.npmjs.org/@mikro-orm/core/-/core-6.4.9.tgz", | ||||||
|  |             "integrity": "sha512-osB2TbvSH4ZL1s62LCBQFAnxPqLycX5fakPHOoztudixqfbVD5QQydeGizJXMMh2zKP6vRCwIJy3MeSuFxPjHg==", | ||||||
|  |             "license": "MIT", | ||||||
|  |             "dependencies": { | ||||||
|  |                 "dataloader": "2.2.3", | ||||||
|  |                 "dotenv": "16.4.7", | ||||||
|  |                 "esprima": "4.0.1", | ||||||
|  |                 "fs-extra": "11.3.0", | ||||||
|  |                 "globby": "11.1.0", | ||||||
|  |                 "mikro-orm": "6.4.9", | ||||||
|  |                 "reflect-metadata": "0.2.2" | ||||||
|  |             }, | ||||||
|  |             "engines": { | ||||||
|  |                 "node": ">= 18.12.0" | ||||||
|  |             }, | ||||||
|  |             "funding": { | ||||||
|  |                 "url": "https://github.com/sponsors/b4nan" | ||||||
|  |             } | ||||||
|  |         }, | ||||||
|  |         "backend/node_modules/@mikro-orm/knex": { | ||||||
|  |             "version": "6.4.9", | ||||||
|  |             "resolved": "https://registry.npmjs.org/@mikro-orm/knex/-/knex-6.4.9.tgz", | ||||||
|  |             "integrity": "sha512-iGXJfe/TziVOQsWuxMIqkOpurysWzQA6kj3+FDtOkHJAijZhqhjSBnfUVHHY/JzU9o0M0rgLrDVJFry/uEaJEA==", | ||||||
|  |             "license": "MIT", | ||||||
|  |             "dependencies": { | ||||||
|  |                 "fs-extra": "11.3.0", | ||||||
|  |                 "knex": "3.1.0", | ||||||
|  |                 "sqlstring": "2.3.3" | ||||||
|  |             }, | ||||||
|  |             "engines": { | ||||||
|  |                 "node": ">= 18.12.0" | ||||||
|  |             }, | ||||||
|  |             "peerDependencies": { | ||||||
|  |                 "@mikro-orm/core": "^6.0.0", | ||||||
|  |                 "better-sqlite3": "*", | ||||||
|  |                 "libsql": "*", | ||||||
|  |                 "mariadb": "*" | ||||||
|  |             }, | ||||||
|  |             "peerDependenciesMeta": { | ||||||
|  |                 "better-sqlite3": { | ||||||
|  |                     "optional": true | ||||||
|  |                 }, | ||||||
|  |                 "libsql": { | ||||||
|  |                     "optional": true | ||||||
|  |                 }, | ||||||
|  |                 "mariadb": { | ||||||
|  |                     "optional": true | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         }, | ||||||
|  |         "backend/node_modules/@mikro-orm/postgresql": { | ||||||
|  |             "version": "6.4.9", | ||||||
|  |             "resolved": "https://registry.npmjs.org/@mikro-orm/postgresql/-/postgresql-6.4.9.tgz", | ||||||
|  |             "integrity": "sha512-ZdVVFAL/TSbzpEmChGdH0oUpy2KiHLjNIeItZHRQgInn1X9p0qx28VVDR78p8qgRGkQ3LquxGTkvmWI0w7qi3A==", | ||||||
|  |             "license": "MIT", | ||||||
|  |             "dependencies": { | ||||||
|  |                 "@mikro-orm/knex": "6.4.9", | ||||||
|  |                 "pg": "8.13.3", | ||||||
|  |                 "postgres-array": "3.0.4", | ||||||
|  |                 "postgres-date": "2.1.0", | ||||||
|  |                 "postgres-interval": "4.0.2" | ||||||
|  |             }, | ||||||
|  |             "engines": { | ||||||
|  |                 "node": ">= 18.12.0" | ||||||
|  |             }, | ||||||
|  |             "peerDependencies": { | ||||||
|  |                 "@mikro-orm/core": "^6.0.0" | ||||||
|  |             } | ||||||
|  |         }, | ||||||
|  |         "backend/node_modules/@mikro-orm/reflection": { | ||||||
|  |             "version": "6.4.9", | ||||||
|  |             "resolved": "https://registry.npmjs.org/@mikro-orm/reflection/-/reflection-6.4.9.tgz", | ||||||
|  |             "integrity": "sha512-fgY7yLrcZm3J/8dv9reUC4PQo7C2muImU31jmzz1SxmNKPJFDJl7OzcDZlM5NOisXzsWUBrcNdCyuQiWViVc3A==", | ||||||
|  |             "license": "MIT", | ||||||
|  |             "dependencies": { | ||||||
|  |                 "globby": "11.1.0", | ||||||
|  |                 "ts-morph": "25.0.1" | ||||||
|  |             }, | ||||||
|  |             "engines": { | ||||||
|  |                 "node": ">= 18.12.0" | ||||||
|  |             }, | ||||||
|  |             "peerDependencies": { | ||||||
|  |                 "@mikro-orm/core": "^6.0.0" | ||||||
|  |             } | ||||||
|  |         }, | ||||||
|  |         "backend/node_modules/@mikro-orm/sqlite": { | ||||||
|  |             "version": "6.4.9", | ||||||
|  |             "resolved": "https://registry.npmjs.org/@mikro-orm/sqlite/-/sqlite-6.4.9.tgz", | ||||||
|  |             "integrity": "sha512-O7Jy/5DrTWpJI/3qkhRJHl+OcECx1N625LHDODAAauOK3+MJB/bj80TrvQhe6d/CHZMmvxZ7m2GzaL1NulKxRw==", | ||||||
|  |             "license": "MIT", | ||||||
|  |             "dependencies": { | ||||||
|  |                 "@mikro-orm/knex": "6.4.9", | ||||||
|  |                 "fs-extra": "11.3.0", | ||||||
|  |                 "sqlite3": "5.1.7", | ||||||
|  |                 "sqlstring-sqlite": "0.1.1" | ||||||
|  |             }, | ||||||
|  |             "engines": { | ||||||
|  |                 "node": ">= 18.12.0" | ||||||
|  |             }, | ||||||
|  |             "peerDependencies": { | ||||||
|  |                 "@mikro-orm/core": "^6.0.0" | ||||||
|  |             } | ||||||
|  |         }, | ||||||
|         "backend/node_modules/globals": { |         "backend/node_modules/globals": { | ||||||
|             "version": "15.15.0", |             "version": "15.15.0", | ||||||
|             "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz", |             "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz", | ||||||
|  | @ -85,6 +212,48 @@ | ||||||
|                 "url": "https://github.com/sponsors/sindresorhus" |                 "url": "https://github.com/sponsors/sindresorhus" | ||||||
|             } |             } | ||||||
|         }, |         }, | ||||||
|  |         "backend/node_modules/mikro-orm": { | ||||||
|  |             "version": "6.4.9", | ||||||
|  |             "resolved": "https://registry.npmjs.org/mikro-orm/-/mikro-orm-6.4.9.tgz", | ||||||
|  |             "integrity": "sha512-XwVrWNT4NNwS6kHIKFNDfvy8L1eWcBBEHeTVzFFYcnb2ummATaLxqeVkNEmKA68jmdtfQdUmWBqGdbcIPwtL2Q==", | ||||||
|  |             "license": "MIT", | ||||||
|  |             "engines": { | ||||||
|  |                 "node": ">= 18.12.0" | ||||||
|  |             } | ||||||
|  |         }, | ||||||
|  |         "backend/node_modules/pg": { | ||||||
|  |             "version": "8.13.3", | ||||||
|  |             "resolved": "https://registry.npmjs.org/pg/-/pg-8.13.3.tgz", | ||||||
|  |             "integrity": "sha512-P6tPt9jXbL9HVu/SSRERNYaYG++MjnscnegFh9pPHihfoBSujsrka0hyuymMzeJKFWrcG8wvCKy8rCe8e5nDUQ==", | ||||||
|  |             "license": "MIT", | ||||||
|  |             "dependencies": { | ||||||
|  |                 "pg-connection-string": "^2.7.0", | ||||||
|  |                 "pg-pool": "^3.7.1", | ||||||
|  |                 "pg-protocol": "^1.7.1", | ||||||
|  |                 "pg-types": "^2.1.0", | ||||||
|  |                 "pgpass": "1.x" | ||||||
|  |             }, | ||||||
|  |             "engines": { | ||||||
|  |                 "node": ">= 8.0.0" | ||||||
|  |             }, | ||||||
|  |             "optionalDependencies": { | ||||||
|  |                 "pg-cloudflare": "^1.1.1" | ||||||
|  |             }, | ||||||
|  |             "peerDependencies": { | ||||||
|  |                 "pg-native": ">=3.0.1" | ||||||
|  |             }, | ||||||
|  |             "peerDependenciesMeta": { | ||||||
|  |                 "pg-native": { | ||||||
|  |                     "optional": true | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         }, | ||||||
|  |         "backend/node_modules/pg-connection-string": { | ||||||
|  |             "version": "2.7.0", | ||||||
|  |             "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.7.0.tgz", | ||||||
|  |             "integrity": "sha512-PI2W9mv53rXJQEOb8xNR8lH7Hr+EKa6oJa38zsK0S/ky2er16ios1wLKhZyxzD7jUReiWokc9WK5nxSnC7W1TA==", | ||||||
|  |             "license": "MIT" | ||||||
|  |         }, | ||||||
|         "common": { |         "common": { | ||||||
|             "name": "@dwengo-1/common", |             "name": "@dwengo-1/common", | ||||||
|             "version": "0.1.1" |             "version": "0.1.1" | ||||||
|  | @ -1816,133 +1985,6 @@ | ||||||
|                 "jsep": "^0.4.0||^1.0.0" |                 "jsep": "^0.4.0||^1.0.0" | ||||||
|             } |             } | ||||||
|         }, |         }, | ||||||
|         "node_modules/@mikro-orm/cli": { |  | ||||||
|             "version": "6.4.9", |  | ||||||
|             "resolved": "https://registry.npmjs.org/@mikro-orm/cli/-/cli-6.4.9.tgz", |  | ||||||
|             "integrity": "sha512-LQzVsmar/0DoJkPGyz3OpB8pa9BCQtvYreEC71h0O+RcizppJjgBQNTkj5tJd2Iqvh4hSaMv6qTv0l5UK6F2Vw==", |  | ||||||
|             "dev": true, |  | ||||||
|             "license": "MIT", |  | ||||||
|             "dependencies": { |  | ||||||
|                 "@jercle/yargonaut": "1.1.5", |  | ||||||
|                 "@mikro-orm/core": "6.4.9", |  | ||||||
|                 "@mikro-orm/knex": "6.4.9", |  | ||||||
|                 "fs-extra": "11.3.0", |  | ||||||
|                 "tsconfig-paths": "4.2.0", |  | ||||||
|                 "yargs": "17.7.2" |  | ||||||
|             }, |  | ||||||
|             "bin": { |  | ||||||
|                 "mikro-orm": "cli", |  | ||||||
|                 "mikro-orm-esm": "esm" |  | ||||||
|             }, |  | ||||||
|             "engines": { |  | ||||||
|                 "node": ">= 18.12.0" |  | ||||||
|             } |  | ||||||
|         }, |  | ||||||
|         "node_modules/@mikro-orm/core": { |  | ||||||
|             "version": "6.4.9", |  | ||||||
|             "resolved": "https://registry.npmjs.org/@mikro-orm/core/-/core-6.4.9.tgz", |  | ||||||
|             "integrity": "sha512-osB2TbvSH4ZL1s62LCBQFAnxPqLycX5fakPHOoztudixqfbVD5QQydeGizJXMMh2zKP6vRCwIJy3MeSuFxPjHg==", |  | ||||||
|             "license": "MIT", |  | ||||||
|             "dependencies": { |  | ||||||
|                 "dataloader": "2.2.3", |  | ||||||
|                 "dotenv": "16.4.7", |  | ||||||
|                 "esprima": "4.0.1", |  | ||||||
|                 "fs-extra": "11.3.0", |  | ||||||
|                 "globby": "11.1.0", |  | ||||||
|                 "mikro-orm": "6.4.9", |  | ||||||
|                 "reflect-metadata": "0.2.2" |  | ||||||
|             }, |  | ||||||
|             "engines": { |  | ||||||
|                 "node": ">= 18.12.0" |  | ||||||
|             }, |  | ||||||
|             "funding": { |  | ||||||
|                 "url": "https://github.com/sponsors/b4nan" |  | ||||||
|             } |  | ||||||
|         }, |  | ||||||
|         "node_modules/@mikro-orm/knex": { |  | ||||||
|             "version": "6.4.9", |  | ||||||
|             "resolved": "https://registry.npmjs.org/@mikro-orm/knex/-/knex-6.4.9.tgz", |  | ||||||
|             "integrity": "sha512-iGXJfe/TziVOQsWuxMIqkOpurysWzQA6kj3+FDtOkHJAijZhqhjSBnfUVHHY/JzU9o0M0rgLrDVJFry/uEaJEA==", |  | ||||||
|             "license": "MIT", |  | ||||||
|             "dependencies": { |  | ||||||
|                 "fs-extra": "11.3.0", |  | ||||||
|                 "knex": "3.1.0", |  | ||||||
|                 "sqlstring": "2.3.3" |  | ||||||
|             }, |  | ||||||
|             "engines": { |  | ||||||
|                 "node": ">= 18.12.0" |  | ||||||
|             }, |  | ||||||
|             "peerDependencies": { |  | ||||||
|                 "@mikro-orm/core": "^6.0.0", |  | ||||||
|                 "better-sqlite3": "*", |  | ||||||
|                 "libsql": "*", |  | ||||||
|                 "mariadb": "*" |  | ||||||
|             }, |  | ||||||
|             "peerDependenciesMeta": { |  | ||||||
|                 "better-sqlite3": { |  | ||||||
|                     "optional": true |  | ||||||
|                 }, |  | ||||||
|                 "libsql": { |  | ||||||
|                     "optional": true |  | ||||||
|                 }, |  | ||||||
|                 "mariadb": { |  | ||||||
|                     "optional": true |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         }, |  | ||||||
|         "node_modules/@mikro-orm/postgresql": { |  | ||||||
|             "version": "6.4.9", |  | ||||||
|             "resolved": "https://registry.npmjs.org/@mikro-orm/postgresql/-/postgresql-6.4.9.tgz", |  | ||||||
|             "integrity": "sha512-ZdVVFAL/TSbzpEmChGdH0oUpy2KiHLjNIeItZHRQgInn1X9p0qx28VVDR78p8qgRGkQ3LquxGTkvmWI0w7qi3A==", |  | ||||||
|             "license": "MIT", |  | ||||||
|             "dependencies": { |  | ||||||
|                 "@mikro-orm/knex": "6.4.9", |  | ||||||
|                 "pg": "8.13.3", |  | ||||||
|                 "postgres-array": "3.0.4", |  | ||||||
|                 "postgres-date": "2.1.0", |  | ||||||
|                 "postgres-interval": "4.0.2" |  | ||||||
|             }, |  | ||||||
|             "engines": { |  | ||||||
|                 "node": ">= 18.12.0" |  | ||||||
|             }, |  | ||||||
|             "peerDependencies": { |  | ||||||
|                 "@mikro-orm/core": "^6.0.0" |  | ||||||
|             } |  | ||||||
|         }, |  | ||||||
|         "node_modules/@mikro-orm/reflection": { |  | ||||||
|             "version": "6.4.9", |  | ||||||
|             "resolved": "https://registry.npmjs.org/@mikro-orm/reflection/-/reflection-6.4.9.tgz", |  | ||||||
|             "integrity": "sha512-fgY7yLrcZm3J/8dv9reUC4PQo7C2muImU31jmzz1SxmNKPJFDJl7OzcDZlM5NOisXzsWUBrcNdCyuQiWViVc3A==", |  | ||||||
|             "license": "MIT", |  | ||||||
|             "dependencies": { |  | ||||||
|                 "globby": "11.1.0", |  | ||||||
|                 "ts-morph": "25.0.1" |  | ||||||
|             }, |  | ||||||
|             "engines": { |  | ||||||
|                 "node": ">= 18.12.0" |  | ||||||
|             }, |  | ||||||
|             "peerDependencies": { |  | ||||||
|                 "@mikro-orm/core": "^6.0.0" |  | ||||||
|             } |  | ||||||
|         }, |  | ||||||
|         "node_modules/@mikro-orm/sqlite": { |  | ||||||
|             "version": "6.4.9", |  | ||||||
|             "resolved": "https://registry.npmjs.org/@mikro-orm/sqlite/-/sqlite-6.4.9.tgz", |  | ||||||
|             "integrity": "sha512-O7Jy/5DrTWpJI/3qkhRJHl+OcECx1N625LHDODAAauOK3+MJB/bj80TrvQhe6d/CHZMmvxZ7m2GzaL1NulKxRw==", |  | ||||||
|             "license": "MIT", |  | ||||||
|             "dependencies": { |  | ||||||
|                 "@mikro-orm/knex": "6.4.9", |  | ||||||
|                 "fs-extra": "11.3.0", |  | ||||||
|                 "sqlite3": "5.1.7", |  | ||||||
|                 "sqlstring-sqlite": "0.1.1" |  | ||||||
|             }, |  | ||||||
|             "engines": { |  | ||||||
|                 "node": ">= 18.12.0" |  | ||||||
|             }, |  | ||||||
|             "peerDependencies": { |  | ||||||
|                 "@mikro-orm/core": "^6.0.0" |  | ||||||
|             } |  | ||||||
|         }, |  | ||||||
|         "node_modules/@napi-rs/snappy-android-arm-eabi": { |         "node_modules/@napi-rs/snappy-android-arm-eabi": { | ||||||
|             "version": "7.2.2", |             "version": "7.2.2", | ||||||
|             "resolved": "https://registry.npmjs.org/@napi-rs/snappy-android-arm-eabi/-/snappy-android-arm-eabi-7.2.2.tgz", |             "resolved": "https://registry.npmjs.org/@napi-rs/snappy-android-arm-eabi/-/snappy-android-arm-eabi-7.2.2.tgz", | ||||||
|  | @ -7849,15 +7891,6 @@ | ||||||
|                 "node": ">=8.6" |                 "node": ">=8.6" | ||||||
|             } |             } | ||||||
|         }, |         }, | ||||||
|         "node_modules/mikro-orm": { |  | ||||||
|             "version": "6.4.9", |  | ||||||
|             "resolved": "https://registry.npmjs.org/mikro-orm/-/mikro-orm-6.4.9.tgz", |  | ||||||
|             "integrity": "sha512-XwVrWNT4NNwS6kHIKFNDfvy8L1eWcBBEHeTVzFFYcnb2ummATaLxqeVkNEmKA68jmdtfQdUmWBqGdbcIPwtL2Q==", |  | ||||||
|             "license": "MIT", |  | ||||||
|             "engines": { |  | ||||||
|                 "node": ">= 18.12.0" |  | ||||||
|             } |  | ||||||
|         }, |  | ||||||
|         "node_modules/mime-db": { |         "node_modules/mime-db": { | ||||||
|             "version": "1.54.0", |             "version": "1.54.0", | ||||||
|             "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", |             "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", | ||||||
|  | @ -8649,14 +8682,15 @@ | ||||||
|             "license": "MIT" |             "license": "MIT" | ||||||
|         }, |         }, | ||||||
|         "node_modules/pg": { |         "node_modules/pg": { | ||||||
|             "version": "8.13.3", |             "version": "8.14.1", | ||||||
|             "resolved": "https://registry.npmjs.org/pg/-/pg-8.13.3.tgz", |             "resolved": "https://registry.npmjs.org/pg/-/pg-8.14.1.tgz", | ||||||
|             "integrity": "sha512-P6tPt9jXbL9HVu/SSRERNYaYG++MjnscnegFh9pPHihfoBSujsrka0hyuymMzeJKFWrcG8wvCKy8rCe8e5nDUQ==", |             "integrity": "sha512-0TdbqfjwIun9Fm/r89oB7RFQ0bLgduAhiIqIXOsyKoiC/L54DbuAAzIEN/9Op0f1Po9X7iCPXGoa/Ah+2aI8Xw==", | ||||||
|             "license": "MIT", |             "license": "MIT", | ||||||
|  |             "peer": true, | ||||||
|             "dependencies": { |             "dependencies": { | ||||||
|                 "pg-connection-string": "^2.7.0", |                 "pg-connection-string": "^2.7.0", | ||||||
|                 "pg-pool": "^3.7.1", |                 "pg-pool": "^3.8.0", | ||||||
|                 "pg-protocol": "^1.7.1", |                 "pg-protocol": "^1.8.0", | ||||||
|                 "pg-types": "^2.1.0", |                 "pg-types": "^2.1.0", | ||||||
|                 "pgpass": "1.x" |                 "pgpass": "1.x" | ||||||
|             }, |             }, | ||||||
|  | @ -8762,7 +8796,8 @@ | ||||||
|             "version": "2.7.0", |             "version": "2.7.0", | ||||||
|             "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.7.0.tgz", |             "resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.7.0.tgz", | ||||||
|             "integrity": "sha512-PI2W9mv53rXJQEOb8xNR8lH7Hr+EKa6oJa38zsK0S/ky2er16ios1wLKhZyxzD7jUReiWokc9WK5nxSnC7W1TA==", |             "integrity": "sha512-PI2W9mv53rXJQEOb8xNR8lH7Hr+EKa6oJa38zsK0S/ky2er16ios1wLKhZyxzD7jUReiWokc9WK5nxSnC7W1TA==", | ||||||
|             "license": "MIT" |             "license": "MIT", | ||||||
|  |             "peer": true | ||||||
|         }, |         }, | ||||||
|         "node_modules/pgpass": { |         "node_modules/pgpass": { | ||||||
|             "version": "1.0.5", |             "version": "1.0.5", | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Gerald Schmittinger
						Gerald Schmittinger