From 69659426dee62396a9f5a976a9f3bf52cade151f Mon Sep 17 00:00:00 2001 From: Adriaan Jacquet Date: Wed, 9 Apr 2025 18:31:06 +0200 Subject: [PATCH 01/22] fix: werkende aan assignment fix --- backend/src/controllers/assignments.ts | 6 +++++ .../data/assignments/assignment-repository.ts | 4 +-- .../entities/assignments/assignment.entity.ts | 2 +- backend/src/interfaces/assignment.ts | 24 +++++++++-------- backend/src/services/assignments.ts | 27 ++++++++++++++----- common/src/interfaces/assignment.ts | 2 +- 6 files changed, 44 insertions(+), 21 deletions(-) diff --git a/backend/src/controllers/assignments.ts b/backend/src/controllers/assignments.ts index 2ecb35cb..adb0e479 100644 --- a/backend/src/controllers/assignments.ts +++ b/backend/src/controllers/assignments.ts @@ -12,6 +12,8 @@ import { requireFields } from './error-helper.js'; import { BadRequestException } from '../exceptions/bad-request-exception.js'; import { Assignment } from '../entities/assignments/assignment.entity.js'; import { EntityDTO } from '@mikro-orm/core'; +import { createGroup } from '../services/groups.js'; +import { getLogger } from '../logging/initalize.js'; export async function getAllAssignmentsHandler(req: Request, res: Response): Promise { const classId = req.params.classid; @@ -32,8 +34,12 @@ export async function createAssignmentHandler(req: Request, res: Response): Prom requireFields({ description, language, learningPath, title }); const assignmentData = req.body as AssignmentDTO; + Object.entries(assignmentData).forEach(getLogger().info); const assignment = await createAssignment(classid, assignmentData); + // should probably use Promise.all + //assignmentData.groups.forEach(group => await createGroup({}, classid, assignment.id)); + res.json({ assignment }); } diff --git a/backend/src/data/assignments/assignment-repository.ts b/backend/src/data/assignments/assignment-repository.ts index 3de5031d..2645de1e 100644 --- a/backend/src/data/assignments/assignment-repository.ts +++ b/backend/src/data/assignments/assignment-repository.ts @@ -4,10 +4,10 @@ import { Class } from '../../entities/classes/class.entity.js'; export class AssignmentRepository extends DwengoEntityRepository { public async findByClassAndId(within: Class, id: number): Promise { - return this.findOne({ within: within, id: id }); + return this.findOne({ within: within, id: id }, { populate: [ "groups" ]}); } public async findAllAssignmentsInClass(within: Class): Promise { - return this.findAll({ where: { within: within } }); + return this.findAll({ where: { within: within }, populate: [ "groups" ] }); } public async deleteByClassAndId(within: Class, id: number): Promise { return this.deleteWhere({ within: within, id: id }); diff --git a/backend/src/entities/assignments/assignment.entity.ts b/backend/src/entities/assignments/assignment.entity.ts index 36b24344..14d22756 100644 --- a/backend/src/entities/assignments/assignment.entity.ts +++ b/backend/src/entities/assignments/assignment.entity.ts @@ -14,7 +14,7 @@ export class Assignment { }) within!: Class; - @PrimaryKey({ type: 'number', autoincrement: true }) + @PrimaryKey({ type: 'integer', autoincrement: true }) id?: number; @Property({ type: 'string' }) diff --git a/backend/src/interfaces/assignment.ts b/backend/src/interfaces/assignment.ts index 7abb3d3c..a3c41e48 100644 --- a/backend/src/interfaces/assignment.ts +++ b/backend/src/interfaces/assignment.ts @@ -4,6 +4,9 @@ import { Assignment } from '../entities/assignments/assignment.entity.js'; import { Class } from '../entities/classes/class.entity.js'; import { getLogger } from '../logging/initalize.js'; import { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment'; +import { mapToGroupDTO, mapToGroupDTOId } from './group.js'; +import { getAssignmentHandler } from '../controllers/assignments.js'; +import { getAssignmentRepository, getClassRepository } from '../data/repositories.js'; export function mapToAssignmentDTOId(assignment: Assignment): AssignmentDTO { return { @@ -13,6 +16,7 @@ export function mapToAssignmentDTOId(assignment: Assignment): AssignmentDTO { description: assignment.description, learningPath: assignment.learningPathHruid, language: assignment.learningPathLanguage, + groups: assignment.groups.map(mapToGroupDTOId), }; } @@ -24,19 +28,17 @@ export function mapToAssignmentDTO(assignment: Assignment): AssignmentDTO { description: assignment.description, learningPath: assignment.learningPathHruid, language: assignment.learningPathLanguage, - // Groups: assignment.groups.map(mapToGroupDTO), + groups: assignment.groups.map(mapToGroupDTO), }; } export function mapToAssignment(assignmentData: AssignmentDTO, cls: Class): Assignment { - const assignment = new Assignment(); - assignment.title = assignmentData.title; - assignment.description = assignmentData.description; - assignment.learningPathHruid = assignmentData.learningPath; - assignment.learningPathLanguage = languageMap[assignmentData.language] || FALLBACK_LANG; - assignment.within = cls; - - getLogger().debug(assignment); - - return assignment; + return getAssignmentRepository().create({ + within: cls, + title: assignmentData.title, + description: assignmentData.description, + learningPathHruid: assignmentData.learningPath, + learningPathLanguage: languageMap[assignmentData.language], + groups: [], + }) } diff --git a/backend/src/services/assignments.ts b/backend/src/services/assignments.ts index 5fd8f67f..99b6e20b 100644 --- a/backend/src/services/assignments.ts +++ b/backend/src/services/assignments.ts @@ -14,8 +14,10 @@ import { mapToSubmissionDTO, mapToSubmissionDTOId } from '../interfaces/submissi import { fetchClass } from './classes.js'; import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; -import { EntityDTO } from '@mikro-orm/core'; +import { assign, EntityDTO } from '@mikro-orm/core'; import { putObject } from './service-helper.js'; +import { getLogger } from '../logging/initalize.js'; +import { languageMap } from '@dwengo-1/common/util/language'; export async function fetchAssignment(classid: string, assignmentNumber: number): Promise { const classRepository = getClassRepository(); @@ -51,13 +53,26 @@ export async function getAllAssignments(classid: string, full: boolean): Promise export async function createAssignment(classid: string, assignmentData: AssignmentDTO): Promise { const cls = await fetchClass(classid); - const assignment = mapToAssignment(assignmentData, cls); - const assignmentRepository = getAssignmentRepository(); - const newAssignment = assignmentRepository.create(assignment); - await assignmentRepository.save(newAssignment, { preventOverwrite: true }); + const assignment = assignmentRepository.create({ + within: cls, + title: assignmentData.title, + description: assignmentData.description, + learningPathHruid: assignmentData.learningPath, + learningPathLanguage: languageMap[assignmentData.language], + groups: [], + }) + // const assignment = mapToAssignment(assignmentData, cls); + Object.entries(assignmentData).forEach(getLogger().info); - return mapToAssignmentDTO(newAssignment); + try { + await assignmentRepository.save(assignment, { preventOverwrite: true }); + } catch(e) { + getLogger().error(e); + } + + getLogger().info(`Saved assignment ${assignment.id}`); + return mapToAssignmentDTO(assignment); } export async function getAssignment(classid: string, id: number): Promise { diff --git a/common/src/interfaces/assignment.ts b/common/src/interfaces/assignment.ts index 5cb8feff..b5fe8a79 100644 --- a/common/src/interfaces/assignment.ts +++ b/common/src/interfaces/assignment.ts @@ -7,5 +7,5 @@ export interface AssignmentDTO { description: string; learningPath: string; language: string; - groups?: GroupDTO[] | string[]; // TODO + groups: GroupDTO[] | string[]; } From c4729156ba138abfed72b60a3e18a92c41442c43 Mon Sep 17 00:00:00 2001 From: Adriaan Jacquet Date: Sat, 12 Apr 2025 16:38:16 +0200 Subject: [PATCH 02/22] fix: werkende aan 183 fix ([] vervangen door Collection<> in group en assignment) --- backend/src/controllers/assignments.ts | 6 +-- backend/src/controllers/groups.ts | 4 +- .../src/entities/assignments/group.entity.ts | 4 +- backend/src/services/assignments.ts | 39 ++++++++++++------- backend/src/services/groups.ts | 7 ++++ common/src/interfaces/assignment.ts | 2 +- 6 files changed, 38 insertions(+), 24 deletions(-) diff --git a/backend/src/controllers/assignments.ts b/backend/src/controllers/assignments.ts index adb0e479..03b0d83b 100644 --- a/backend/src/controllers/assignments.ts +++ b/backend/src/controllers/assignments.ts @@ -21,6 +21,8 @@ export async function getAllAssignmentsHandler(req: Request, res: Response): Pro const assignments = await getAllAssignments(classId, full); + console.log(JSON.stringify(assignments)); + res.json({ assignments }); } @@ -34,12 +36,8 @@ export async function createAssignmentHandler(req: Request, res: Response): Prom requireFields({ description, language, learningPath, title }); const assignmentData = req.body as AssignmentDTO; - Object.entries(assignmentData).forEach(getLogger().info); const assignment = await createAssignment(classid, assignmentData); - // should probably use Promise.all - //assignmentData.groups.forEach(group => await createGroup({}, classid, assignment.id)); - res.json({ assignment }); } diff --git a/backend/src/controllers/groups.ts b/backend/src/controllers/groups.ts index ec177dcc..53bc96ec 100644 --- a/backend/src/controllers/groups.ts +++ b/backend/src/controllers/groups.ts @@ -69,8 +69,8 @@ export async function getAllGroupsHandler(req: Request, res: Response): Promise< export async function createGroupHandler(req: Request, res: Response): Promise { const classid = req.params.classid; const assignmentId = Number(req.params.assignmentid); - - requireFields({ classid, assignmentId }); + const members = req.body.members; + requireFields({ classid, assignmentId, members }); if (isNaN(assignmentId)) { throw new BadRequestException('Assignment id must be a number'); diff --git a/backend/src/entities/assignments/group.entity.ts b/backend/src/entities/assignments/group.entity.ts index cfe21f7f..55770b7f 100644 --- a/backend/src/entities/assignments/group.entity.ts +++ b/backend/src/entities/assignments/group.entity.ts @@ -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 { Student } from '../users/student.entity.js'; import { GroupRepository } from '../../data/assignments/group-repository.js'; @@ -19,5 +19,5 @@ export class Group { @ManyToMany({ entity: () => Student, }) - members!: Student[]; + members!: Collection; } diff --git a/backend/src/services/assignments.ts b/backend/src/services/assignments.ts index 99b6e20b..dfc81357 100644 --- a/backend/src/services/assignments.ts +++ b/backend/src/services/assignments.ts @@ -4,6 +4,7 @@ import { getClassRepository, getGroupRepository, getQuestionRepository, + getStudentRepository, getSubmissionRepository, } from '../data/repositories.js'; import { Assignment } from '../entities/assignments/assignment.entity.js'; @@ -18,6 +19,8 @@ import { assign, EntityDTO } from '@mikro-orm/core'; import { putObject } from './service-helper.js'; import { getLogger } from '../logging/initalize.js'; import { languageMap } from '@dwengo-1/common/util/language'; +import { createGroup } from './groups.js'; +import { GroupDTO } from 'dwengo-1-common/interfaces/group'; export async function fetchAssignment(classid: string, assignmentNumber: number): Promise { const classRepository = getClassRepository(); @@ -54,24 +57,30 @@ export async function createAssignment(classid: string, assignmentData: Assignme const cls = await fetchClass(classid); const assignmentRepository = getAssignmentRepository(); - const assignment = assignmentRepository.create({ - within: cls, - title: assignmentData.title, - description: assignmentData.description, - learningPathHruid: assignmentData.learningPath, - learningPathLanguage: languageMap[assignmentData.language], - groups: [], - }) - // const assignment = mapToAssignment(assignmentData, cls); - Object.entries(assignmentData).forEach(getLogger().info); + const assignment = mapToAssignment(assignmentData, cls); + await assignmentRepository.save(assignment); - try { - await assignmentRepository.save(assignment, { preventOverwrite: true }); - } catch(e) { - getLogger().error(e); + /* + if (assignmentData.groups) { + const groupRepository = getGroupRepository(); + const studentRepository = getStudentRepository(); + + (assignmentData.groups as string[][]).forEach(async (memberUsernames) => { + const members = (await Promise.all(memberUsernames.map(async (id) => studentRepository.findByUsername(id)))).filter( + (student) => student !== null + ); + + const newGroup = groupRepository.create({ + assignment: assignment, + members: members, + }); + await groupRepository.save(newGroup); + console.log('NEW GROUP'); + console.log(newGroup); + }); } + */ - getLogger().info(`Saved assignment ${assignment.id}`); return mapToAssignmentDTO(assignment); } diff --git a/backend/src/services/groups.ts b/backend/src/services/groups.ts index 95b1b7d4..9cffbe08 100644 --- a/backend/src/services/groups.ts +++ b/backend/src/services/groups.ts @@ -66,15 +66,22 @@ export async function createGroup(groupData: GroupDTO, classid: string, assignme (student) => student !== null ); + console.log(members); + const assignment = await fetchAssignment(classid, assignmentNumber); + console.log(assignment); + const groupRepository = getGroupRepository(); const newGroup = groupRepository.create({ assignment: assignment, members: members, }); + console.log(newGroup.assignment); await groupRepository.save(newGroup); + console.log(newGroup.assignment); + return mapToGroupDTO(newGroup); } diff --git a/common/src/interfaces/assignment.ts b/common/src/interfaces/assignment.ts index b5fe8a79..3e7e6a5d 100644 --- a/common/src/interfaces/assignment.ts +++ b/common/src/interfaces/assignment.ts @@ -7,5 +7,5 @@ export interface AssignmentDTO { description: string; learningPath: string; language: string; - groups: GroupDTO[] | string[]; + groups: GroupDTO[] | string[][]; } From 8c096ffa15a86321076782378f4f7819a4c497bd Mon Sep 17 00:00:00 2001 From: Adriaan Jacquet Date: Sat, 12 Apr 2025 17:45:22 +0200 Subject: [PATCH 03/22] fix: nog steeds werkende aan 183 fix, probleem komt mogelijks door het feit dat group niet automatisch een groupNummer krijgt --- .../entities/assignments/assignment.entity.ts | 4 +- .../src/entities/assignments/group.entity.ts | 2 +- backend/src/interfaces/assignment.ts | 4 +- backend/src/interfaces/group.ts | 9 ++-- backend/src/services/groups.ts | 43 +++++++++++-------- backend/src/services/submissions.ts | 4 +- 6 files changed, 38 insertions(+), 28 deletions(-) diff --git a/backend/src/entities/assignments/assignment.entity.ts b/backend/src/entities/assignments/assignment.entity.ts index 14d22756..d532acef 100644 --- a/backend/src/entities/assignments/assignment.entity.ts +++ b/backend/src/entities/assignments/assignment.entity.ts @@ -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 { Group } from './group.entity.js'; import { Language } from '@dwengo-1/common/util/language'; @@ -35,5 +35,5 @@ export class Assignment { entity: () => Group, mappedBy: 'assignment', }) - groups!: Group[]; + groups!: Collection; } diff --git a/backend/src/entities/assignments/group.entity.ts b/backend/src/entities/assignments/group.entity.ts index 55770b7f..213e0f38 100644 --- a/backend/src/entities/assignments/group.entity.ts +++ b/backend/src/entities/assignments/group.entity.ts @@ -19,5 +19,5 @@ export class Group { @ManyToMany({ entity: () => Student, }) - members!: Collection; + members!: Student[]; } diff --git a/backend/src/interfaces/assignment.ts b/backend/src/interfaces/assignment.ts index a3c41e48..510635ab 100644 --- a/backend/src/interfaces/assignment.ts +++ b/backend/src/interfaces/assignment.ts @@ -16,7 +16,7 @@ export function mapToAssignmentDTOId(assignment: Assignment): AssignmentDTO { description: assignment.description, learningPath: assignment.learningPathHruid, language: assignment.learningPathLanguage, - groups: assignment.groups.map(mapToGroupDTOId), + groups: assignment.groups.map(group => mapToGroupDTOId(group, assignment.within)), }; } @@ -28,7 +28,7 @@ export function mapToAssignmentDTO(assignment: Assignment): AssignmentDTO { description: assignment.description, learningPath: assignment.learningPathHruid, language: assignment.learningPathLanguage, - groups: assignment.groups.map(mapToGroupDTO), + groups: assignment.groups.map(group => mapToGroupDTO(group, assignment.within)), }; } diff --git a/backend/src/interfaces/group.ts b/backend/src/interfaces/group.ts index ac0efa64..467fd3e6 100644 --- a/backend/src/interfaces/group.ts +++ b/backend/src/interfaces/group.ts @@ -1,21 +1,22 @@ import { Group } from '../entities/assignments/group.entity.js'; +import { Class } from '../entities/classes/class.entity.js'; import { mapToAssignmentDTO } from './assignment.js'; import { mapToClassDTO } from './class.js'; import { mapToStudentDTO } from './student.js'; import { GroupDTO } from '@dwengo-1/common/interfaces/group'; -export function mapToGroupDTO(group: Group): GroupDTO { +export function mapToGroupDTO(group: Group, cls: Class): GroupDTO { return { - class: mapToClassDTO(group.assignment.within), + class: mapToClassDTO(cls), assignment: mapToAssignmentDTO(group.assignment), groupNumber: group.groupNumber!, members: group.members.map(mapToStudentDTO), }; } -export function mapToGroupDTOId(group: Group): GroupDTO { +export function mapToGroupDTOId(group: Group, cls: Class): GroupDTO { return { - class: group.assignment.within.classId!, + class: cls.classId!, assignment: group.assignment.id!, groupNumber: group.groupNumber!, members: group.members.map((member) => member.username), diff --git a/backend/src/services/groups.ts b/backend/src/services/groups.ts index 9cffbe08..393268c1 100644 --- a/backend/src/services/groups.ts +++ b/backend/src/services/groups.ts @@ -1,4 +1,4 @@ -import { EntityDTO } from '@mikro-orm/core'; +import { Collection, EntityDTO } from '@mikro-orm/core'; import { getGroupRepository, getStudentRepository, getSubmissionRepository } from '../data/repositories.js'; import { Group } from '../entities/assignments/group.entity.js'; import { mapToGroupDTO, mapToGroupDTOId } from '../interfaces/group.js'; @@ -8,6 +8,9 @@ import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/subm import { fetchAssignment } from './assignments.js'; import { NotFoundException } from '../exceptions/not-found-exception.js'; import { putObject } from './service-helper.js'; +import { Student } from '../entities/users/student.entity.js'; +import { GroupRepository } from '../data/assignments/group-repository.js'; +import { assert } from 'console'; export async function fetchGroup(classId: string, assignmentNumber: number, groupNumber: number): Promise { const assignment = await fetchAssignment(classId, assignmentNumber); @@ -24,7 +27,7 @@ export async function fetchGroup(classId: string, assignmentNumber: number, grou export async function getGroup(classId: string, assignmentNumber: number, groupNumber: number): Promise { const group = await fetchGroup(classId, assignmentNumber, groupNumber); - return mapToGroupDTO(group); + return mapToGroupDTO(group, group.assignment.within); } export async function putGroup( @@ -37,7 +40,7 @@ export async function putGroup( await putObject(group, groupData, getGroupRepository()); - return mapToGroupDTO(group); + return mapToGroupDTO(group, group.assignment.within); } export async function deleteGroup(classId: string, assignmentNumber: number, groupNumber: number): Promise { @@ -47,7 +50,7 @@ export async function deleteGroup(classId: string, assignmentNumber: number, gro const groupRepository = getGroupRepository(); await groupRepository.deleteByAssignmentAndGroupNumber(assignment, groupNumber); - return mapToGroupDTO(group); + return mapToGroupDTO(group, assignment.within); } export async function getExistingGroupFromGroupDTO(groupData: GroupDTO): Promise { @@ -62,27 +65,31 @@ export async function createGroup(groupData: GroupDTO, classid: string, assignme const studentRepository = getStudentRepository(); const memberUsernames = (groupData.members as string[]) || []; - const members = (await Promise.all([...memberUsernames].map(async (id) => studentRepository.findByUsername(id)))).filter( - (student) => student !== null - ); - - console.log(members); + const members = ( + await Promise.all( + memberUsernames.map(async (id) => studentRepository.findByUsername(id)) + ) + ).filter((student): student is Student => student !== null); const assignment = await fetchAssignment(classid, assignmentNumber); - - console.log(assignment); - + const groupRepository = getGroupRepository(); const newGroup = groupRepository.create({ assignment: assignment, members: members, }); - console.log(newGroup.assignment); - await groupRepository.save(newGroup); - console.log(newGroup.assignment); + assert(newGroup.groupNumber !== undefined, "NO GROUPNUMBER WAS ASSIGNED"); - return mapToGroupDTO(newGroup); + console.log(newGroup); + + try { + await groupRepository.save(newGroup); + } catch(e) { + console.log(e); + } + + return mapToGroupDTO(newGroup, newGroup.assignment.within); } export async function getAllGroups(classId: string, assignmentNumber: number, full: boolean): Promise { @@ -92,10 +99,10 @@ export async function getAllGroups(classId: string, assignmentNumber: number, fu const groups = await groupRepository.findAllGroupsForAssignment(assignment); if (full) { - return groups.map(mapToGroupDTO); + return groups.map(group => mapToGroupDTO(group, assignment.within)); } - return groups.map(mapToGroupDTOId); + return groups.map(group => mapToGroupDTOId(group, assignment.within)); } export async function getGroupSubmissions( diff --git a/backend/src/services/submissions.ts b/backend/src/services/submissions.ts index c7daff74..eb7b9a3b 100644 --- a/backend/src/services/submissions.ts +++ b/backend/src/services/submissions.ts @@ -32,7 +32,9 @@ export async function getAllSubmissions(loId: LearningObjectIdentifier): Promise export async function createSubmission(submissionDTO: SubmissionDTO): Promise { const submitter = await fetchStudent(submissionDTO.submitter.username); - const group = submissionDTO.group ? await getExistingGroupFromGroupDTO(submissionDTO.group) : undefined; + // TODO: fix + // const group = submissionDTO.group ? await getExistingGroupFromGroupDTO(submissionDTO.group) : undefined; + const group = undefined; const submissionRepository = getSubmissionRepository(); const submission = mapToSubmission(submissionDTO, submitter, group); From f4fda7db5d9d3b786623790ee5c08b92bffe6a60 Mon Sep 17 00:00:00 2001 From: Gerald Schmittinger Date: Mon, 14 Apr 2025 18:56:32 +0200 Subject: [PATCH 04/22] fix(backend): Fouten resulterend uit refactoring opgelost. --- backend/src/data/questions/question-repository.ts | 3 ++- backend/src/interfaces/submission.ts | 2 +- backend/src/services/students.ts | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/src/data/questions/question-repository.ts b/backend/src/data/questions/question-repository.ts index 01e38df2..14db8c88 100644 --- a/backend/src/data/questions/question-repository.ts +++ b/backend/src/data/questions/question-repository.ts @@ -5,6 +5,7 @@ import { Student } from '../../entities/users/student.entity.js'; import { LearningObject } from '../../entities/content/learning-object.entity.js'; import { Assignment } from '../../entities/assignments/assignment.entity.js'; import { Loaded } from '@mikro-orm/core'; +import {Group} from "../../entities/assignments/group.entity"; export class QuestionRepository extends DwengoEntityRepository { public async createQuestion(question: { loId: LearningObjectIdentifier; author: Student; content: string }): Promise { @@ -59,7 +60,7 @@ export class QuestionRepository extends DwengoEntityRepository { public async findAllByAssignment(assignment: Assignment): Promise { return this.find({ - author: assignment.groups.flatMap((group) => group.members), + author: assignment.groups.toArray().flatMap((group) => group.members), learningObjectHruid: assignment.learningPathHruid, learningObjectLanguage: assignment.learningPathLanguage, }); diff --git a/backend/src/interfaces/submission.ts b/backend/src/interfaces/submission.ts index 91882c35..b9eb0802 100644 --- a/backend/src/interfaces/submission.ts +++ b/backend/src/interfaces/submission.ts @@ -17,7 +17,7 @@ export function mapToSubmissionDTO(submission: Submission): SubmissionDTO { submissionNumber: submission.submissionNumber, submitter: mapToStudentDTO(submission.submitter), time: submission.submissionTime, - group: submission.onBehalfOf ? mapToGroupDTO(submission.onBehalfOf) : undefined, + group: submission.onBehalfOf ? mapToGroupDTO(submission.onBehalfOf, submission.onBehalfOf.assignment.within) : undefined, content: submission.content, }; } diff --git a/backend/src/services/students.ts b/backend/src/services/students.ts index 6cfbbd5b..121b382e 100644 --- a/backend/src/services/students.ts +++ b/backend/src/services/students.ts @@ -98,10 +98,10 @@ export async function getStudentGroups(username: string, full: boolean): Promise const groups = await groupRepository.findAllGroupsWithStudent(student); if (full) { - return groups.map(mapToGroupDTO); + return groups.map(group => mapToGroupDTO(group, group.assignment.within)); } - return groups.map(mapToGroupDTOId); + return groups.map(group => mapToGroupDTOId(group, group.assignment.within)); } export async function getStudentSubmissions(username: string, full: boolean): Promise { From 451ac7546fa4408aba86a4b47a8a4c2960ed5ed7 Mon Sep 17 00:00:00 2001 From: Gerald Schmittinger Date: Tue, 15 Apr 2025 08:45:12 +0200 Subject: [PATCH 05/22] fix(backend): Modellering van ManyToMany-relationships verbeterd --- backend/src/entities/assignments/group.entity.ts | 4 +++- backend/src/entities/classes/class.entity.ts | 4 ++-- backend/src/entities/users/student.entity.ts | 6 +++--- backend/src/entities/users/teacher.entity.ts | 2 +- .../src/middleware/error-handling/error-handler.ts | 2 +- backend/src/services/groups.ts | 12 +++--------- 6 files changed, 13 insertions(+), 17 deletions(-) diff --git a/backend/src/entities/assignments/group.entity.ts b/backend/src/entities/assignments/group.entity.ts index 213e0f38..e26dcbe1 100644 --- a/backend/src/entities/assignments/group.entity.ts +++ b/backend/src/entities/assignments/group.entity.ts @@ -18,6 +18,8 @@ export class Group { @ManyToMany({ entity: () => Student, + owner: true, + inversedBy: "groups" }) - members!: Student[]; + members: Collection = new Collection(this); } diff --git a/backend/src/entities/classes/class.entity.ts b/backend/src/entities/classes/class.entity.ts index 63315304..7ad66c52 100644 --- a/backend/src/entities/classes/class.entity.ts +++ b/backend/src/entities/classes/class.entity.ts @@ -14,9 +14,9 @@ export class Class { @Property({ type: 'string' }) displayName!: string; - @ManyToMany(() => Teacher) + @ManyToMany({entity: () => Teacher, owner: true, inversedBy: 'classes'}) teachers!: Collection; - @ManyToMany(() => Student) + @ManyToMany({entity: () => Student, owner: true, inversedBy: 'classes'}) students!: Collection; } diff --git a/backend/src/entities/users/student.entity.ts b/backend/src/entities/users/student.entity.ts index 58e82765..2c4cfb68 100644 --- a/backend/src/entities/users/student.entity.ts +++ b/backend/src/entities/users/student.entity.ts @@ -8,9 +8,9 @@ import { StudentRepository } from '../../data/users/student-repository.js'; repository: () => StudentRepository, }) export class Student extends User { - @ManyToMany(() => Class) + @ManyToMany({entity: () => Class, mappedBy: 'students'}) classes!: Collection; - @ManyToMany(() => Group) - groups!: Collection; + @ManyToMany({entity: () => Group, mappedBy: 'members'}) + groups: Collection = new Collection(this); } diff --git a/backend/src/entities/users/teacher.entity.ts b/backend/src/entities/users/teacher.entity.ts index d53ca603..900e3610 100644 --- a/backend/src/entities/users/teacher.entity.ts +++ b/backend/src/entities/users/teacher.entity.ts @@ -5,6 +5,6 @@ import { TeacherRepository } from '../../data/users/teacher-repository.js'; @Entity({ repository: () => TeacherRepository }) export class Teacher extends User { - @ManyToMany(() => Class) + @ManyToMany({entity: () => Class, mappedBy: 'teachers'}) classes!: Collection; } diff --git a/backend/src/middleware/error-handling/error-handler.ts b/backend/src/middleware/error-handling/error-handler.ts index d7315603..ff3add3a 100644 --- a/backend/src/middleware/error-handling/error-handler.ts +++ b/backend/src/middleware/error-handling/error-handler.ts @@ -9,7 +9,7 @@ export function errorHandler(err: unknown, _req: Request, res: Response, _: Next logger.warn(`An error occurred while handling a request: ${err} (-> HTTP ${err.status})`); res.status(err.status).json(err); } else { - logger.error(`Unexpected error occurred while handing a request: ${JSON.stringify(err)}`); + logger.error(`Unexpected error occurred while handing a request: ${err}`); res.status(500).json(err); } } diff --git a/backend/src/services/groups.ts b/backend/src/services/groups.ts index 393268c1..ec152da4 100644 --- a/backend/src/services/groups.ts +++ b/backend/src/services/groups.ts @@ -1,4 +1,4 @@ -import { Collection, EntityDTO } from '@mikro-orm/core'; +import { EntityDTO } from '@mikro-orm/core'; import { getGroupRepository, getStudentRepository, getSubmissionRepository } from '../data/repositories.js'; import { Group } from '../entities/assignments/group.entity.js'; import { mapToGroupDTO, mapToGroupDTOId } from '../interfaces/group.js'; @@ -9,8 +9,6 @@ import { fetchAssignment } from './assignments.js'; import { NotFoundException } from '../exceptions/not-found-exception.js'; import { putObject } from './service-helper.js'; import { Student } from '../entities/users/student.entity.js'; -import { GroupRepository } from '../data/assignments/group-repository.js'; -import { assert } from 'console'; export async function fetchGroup(classId: string, assignmentNumber: number, groupNumber: number): Promise { const assignment = await fetchAssignment(classId, assignmentNumber); @@ -72,17 +70,13 @@ export async function createGroup(groupData: GroupDTO, classid: string, assignme ).filter((student): student is Student => student !== null); const assignment = await fetchAssignment(classid, assignmentNumber); - + const groupRepository = getGroupRepository(); const newGroup = groupRepository.create({ assignment: assignment, - members: members, + members: members }); - assert(newGroup.groupNumber !== undefined, "NO GROUPNUMBER WAS ASSIGNED"); - - console.log(newGroup); - try { await groupRepository.save(newGroup); } catch(e) { From 9c638b11f60b92f106a874dd39c68d0ddc5faaae Mon Sep 17 00:00:00 2001 From: Gerald Schmittinger Date: Tue, 15 Apr 2025 11:03:41 +0200 Subject: [PATCH 06/22] fix(backend): Update MikroORM, Fix voor 'pks not iterable' problem in Groups --- backend/package.json | 12 +-- .../entities/assignments/assignment.entity.ts | 2 +- .../src/entities/assignments/group.entity.ts | 16 ++-- backend/src/interfaces/group.ts | 4 +- package-lock.json | 76 +++++++++---------- 5 files changed, 57 insertions(+), 53 deletions(-) diff --git a/backend/package.json b/backend/package.json index 3a89eb87..31e00f15 100644 --- a/backend/package.json +++ b/backend/package.json @@ -16,11 +16,11 @@ "test:unit": "vitest --run" }, "dependencies": { - "@mikro-orm/core": "6.4.9", - "@mikro-orm/knex": "6.4.9", - "@mikro-orm/postgresql": "6.4.9", - "@mikro-orm/reflection": "6.4.9", - "@mikro-orm/sqlite": "6.4.9", + "@mikro-orm/core": "6.4.12", + "@mikro-orm/knex": "6.4.12", + "@mikro-orm/postgresql": "6.4.12", + "@mikro-orm/reflection": "6.4.12", + "@mikro-orm/sqlite": "6.4.12", "axios": "^1.8.2", "cors": "^2.8.5", "cross": "^1.0.0", @@ -43,7 +43,7 @@ "winston-loki": "^6.1.3" }, "devDependencies": { - "@mikro-orm/cli": "6.4.9", + "@mikro-orm/cli": "6.4.12", "@types/cors": "^2.8.17", "@types/express": "^5.0.0", "@types/js-yaml": "^4.0.9", diff --git a/backend/src/entities/assignments/assignment.entity.ts b/backend/src/entities/assignments/assignment.entity.ts index d532acef..ed8745f6 100644 --- a/backend/src/entities/assignments/assignment.entity.ts +++ b/backend/src/entities/assignments/assignment.entity.ts @@ -35,5 +35,5 @@ export class Assignment { entity: () => Group, mappedBy: 'assignment', }) - groups!: Collection; + groups: Collection = new Collection(this); } diff --git a/backend/src/entities/assignments/group.entity.ts b/backend/src/entities/assignments/group.entity.ts index e26dcbe1..d27821c3 100644 --- a/backend/src/entities/assignments/group.entity.ts +++ b/backend/src/entities/assignments/group.entity.ts @@ -7,15 +7,19 @@ import { GroupRepository } from '../../data/assignments/group-repository.js'; repository: () => GroupRepository, }) export class Group { - @ManyToOne({ - entity: () => Assignment, - primary: true, - }) - assignment!: Assignment; - + /* + WARNING: Don't move the definition of groupNumber! If it does not come before the definition of assignment, + creating groups fails because of a MikroORM bug! + */ @PrimaryKey({ type: 'integer', autoincrement: true }) groupNumber?: number; + @ManyToOne({ + entity: () => Assignment, + primary: true + }) + assignment!: Assignment; + @ManyToMany({ entity: () => Student, owner: true, diff --git a/backend/src/interfaces/group.ts b/backend/src/interfaces/group.ts index 467fd3e6..9fd753e8 100644 --- a/backend/src/interfaces/group.ts +++ b/backend/src/interfaces/group.ts @@ -1,6 +1,6 @@ import { Group } from '../entities/assignments/group.entity.js'; import { Class } from '../entities/classes/class.entity.js'; -import { mapToAssignmentDTO } from './assignment.js'; +import {mapToAssignmentDTOId} from './assignment.js'; import { mapToClassDTO } from './class.js'; import { mapToStudentDTO } from './student.js'; import { GroupDTO } from '@dwengo-1/common/interfaces/group'; @@ -8,7 +8,7 @@ import { GroupDTO } from '@dwengo-1/common/interfaces/group'; export function mapToGroupDTO(group: Group, cls: Class): GroupDTO { return { class: mapToClassDTO(cls), - assignment: mapToAssignmentDTO(group.assignment), + assignment: mapToAssignmentDTOId(group.assignment), groupNumber: group.groupNumber!, members: group.members.map(mapToStudentDTO), }; diff --git a/package-lock.json b/package-lock.json index 27d261cb..dad1dd44 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,11 +31,11 @@ "name": "@dwengo-1/backend", "version": "0.1.1", "dependencies": { - "@mikro-orm/core": "6.4.9", - "@mikro-orm/knex": "6.4.9", - "@mikro-orm/postgresql": "6.4.9", - "@mikro-orm/reflection": "6.4.9", - "@mikro-orm/sqlite": "6.4.9", + "@mikro-orm/core": "6.4.12", + "@mikro-orm/knex": "6.4.12", + "@mikro-orm/postgresql": "6.4.12", + "@mikro-orm/reflection": "6.4.12", + "@mikro-orm/sqlite": "6.4.12", "axios": "^1.8.2", "cors": "^2.8.5", "cross": "^1.0.0", @@ -58,7 +58,7 @@ "winston-loki": "^6.1.3" }, "devDependencies": { - "@mikro-orm/cli": "6.4.9", + "@mikro-orm/cli": "6.4.12", "@types/cors": "^2.8.17", "@types/express": "^5.0.0", "@types/js-yaml": "^4.0.9", @@ -1817,15 +1817,15 @@ } }, "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==", + "version": "6.4.12", + "resolved": "https://registry.npmjs.org/@mikro-orm/cli/-/cli-6.4.12.tgz", + "integrity": "sha512-7rKtrR4GAmeHOCSIPqtL1rtKdAQFvuCghiNxbL2+ck7d5SHRLG/pSCmnW70p5160a9mJ8uCl8vfWIQNOsX94Sw==", "dev": true, "license": "MIT", "dependencies": { "@jercle/yargonaut": "1.1.5", - "@mikro-orm/core": "6.4.9", - "@mikro-orm/knex": "6.4.9", + "@mikro-orm/core": "6.4.12", + "@mikro-orm/knex": "6.4.12", "fs-extra": "11.3.0", "tsconfig-paths": "4.2.0", "yargs": "17.7.2" @@ -1839,9 +1839,9 @@ } }, "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==", + "version": "6.4.12", + "resolved": "https://registry.npmjs.org/@mikro-orm/core/-/core-6.4.12.tgz", + "integrity": "sha512-TzJJCFZCdyrVPt/K3UHdao8Iyj4xJSj2r0tYUCY4zNKwuUw6K3RlEYcWGUf85FWIAZJPpYqbv83WTb/H9OiyyQ==", "license": "MIT", "dependencies": { "dataloader": "2.2.3", @@ -1849,7 +1849,7 @@ "esprima": "4.0.1", "fs-extra": "11.3.0", "globby": "11.1.0", - "mikro-orm": "6.4.9", + "mikro-orm": "6.4.12", "reflect-metadata": "0.2.2" }, "engines": { @@ -1860,9 +1860,9 @@ } }, "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==", + "version": "6.4.12", + "resolved": "https://registry.npmjs.org/@mikro-orm/knex/-/knex-6.4.12.tgz", + "integrity": "sha512-KMocJ4fdAbf52I/K25eV+dZDWXdVJpiIaBuIRt04m+SiJ7HZPP0OTDt/mexX3WHWW2m/d1byDNIZecjmV0eRSA==", "license": "MIT", "dependencies": { "fs-extra": "11.3.0", @@ -1891,13 +1891,13 @@ } }, "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==", + "version": "6.4.12", + "resolved": "https://registry.npmjs.org/@mikro-orm/postgresql/-/postgresql-6.4.12.tgz", + "integrity": "sha512-qWO2oerG2A9Jf6dCP/3tvnwxB/Y7gZGXOByG/iMlnQHeHEZ95G5GDe1TSZ/5Ho52wGoq3Vn3xzeKZwJdajbcEw==", "license": "MIT", "dependencies": { - "@mikro-orm/knex": "6.4.9", - "pg": "8.13.3", + "@mikro-orm/knex": "6.4.12", + "pg": "8.14.1", "postgres-array": "3.0.4", "postgres-date": "2.1.0", "postgres-interval": "4.0.2" @@ -1910,9 +1910,9 @@ } }, "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==", + "version": "6.4.12", + "resolved": "https://registry.npmjs.org/@mikro-orm/reflection/-/reflection-6.4.12.tgz", + "integrity": "sha512-RZAMFAwe+yBylbiaHTyBDXDZWkqcLVv6IxRAc/YGBhD+Z1NjZbrFRrNg7OQryEW13OUIuIrXTCgKb9C0Mem0cQ==", "license": "MIT", "dependencies": { "globby": "11.1.0", @@ -1926,12 +1926,12 @@ } }, "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==", + "version": "6.4.12", + "resolved": "https://registry.npmjs.org/@mikro-orm/sqlite/-/sqlite-6.4.12.tgz", + "integrity": "sha512-fIR/AkgUxOEKCiGxes8BrkNm86iP7eB0ZhvDjrRbinYxarGHtPIUEub0tY0jvQNbXo4s/GwRIPhA178pr5xEFA==", "license": "MIT", "dependencies": { - "@mikro-orm/knex": "6.4.9", + "@mikro-orm/knex": "6.4.12", "fs-extra": "11.3.0", "sqlite3": "5.1.7", "sqlstring-sqlite": "0.1.1" @@ -7850,9 +7850,9 @@ } }, "node_modules/mikro-orm": { - "version": "6.4.9", - "resolved": "https://registry.npmjs.org/mikro-orm/-/mikro-orm-6.4.9.tgz", - "integrity": "sha512-XwVrWNT4NNwS6kHIKFNDfvy8L1eWcBBEHeTVzFFYcnb2ummATaLxqeVkNEmKA68jmdtfQdUmWBqGdbcIPwtL2Q==", + "version": "6.4.12", + "resolved": "https://registry.npmjs.org/mikro-orm/-/mikro-orm-6.4.12.tgz", + "integrity": "sha512-uOJdx0q9Hg0SKYtHeJ73Iu2PhlU8LoyhaMm2PH9n1kvqpyoqUme2vKpwWywELFpZKgXwtkeIA8Ce56caYb593Q==", "license": "MIT", "engines": { "node": ">= 18.12.0" @@ -8649,14 +8649,14 @@ "license": "MIT" }, "node_modules/pg": { - "version": "8.13.3", - "resolved": "https://registry.npmjs.org/pg/-/pg-8.13.3.tgz", - "integrity": "sha512-P6tPt9jXbL9HVu/SSRERNYaYG++MjnscnegFh9pPHihfoBSujsrka0hyuymMzeJKFWrcG8wvCKy8rCe8e5nDUQ==", + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/pg/-/pg-8.14.1.tgz", + "integrity": "sha512-0TdbqfjwIun9Fm/r89oB7RFQ0bLgduAhiIqIXOsyKoiC/L54DbuAAzIEN/9Op0f1Po9X7iCPXGoa/Ah+2aI8Xw==", "license": "MIT", "dependencies": { "pg-connection-string": "^2.7.0", - "pg-pool": "^3.7.1", - "pg-protocol": "^1.7.1", + "pg-pool": "^3.8.0", + "pg-protocol": "^1.8.0", "pg-types": "^2.1.0", "pgpass": "1.x" }, From 94a8456bdd58cb3cb9a369790d9f7bea1ac8ceab Mon Sep 17 00:00:00 2001 From: Adriaan Jacquet Date: Tue, 15 Apr 2025 19:54:43 +0200 Subject: [PATCH 07/22] feat: server error exception type toegevoegd --- backend/src/exceptions/server-error-exception.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 backend/src/exceptions/server-error-exception.ts diff --git a/backend/src/exceptions/server-error-exception.ts b/backend/src/exceptions/server-error-exception.ts new file mode 100644 index 00000000..76850a50 --- /dev/null +++ b/backend/src/exceptions/server-error-exception.ts @@ -0,0 +1,12 @@ +import { ExceptionWithHttpState } from "./exception-with-http-state"; + +/** + * Exception for HTTP 500 Internal Server Error + */ +export class ServerErrorException extends ExceptionWithHttpState { + status = 500; + + constructor(message = 'Internal server error, something went wrong') { + super(500, message); + } +} From 0ceb6761d7d54c2c7dc36948c179bae71d64b741 Mon Sep 17 00:00:00 2001 From: Adriaan Jacquet Date: Tue, 15 Apr 2025 19:55:18 +0200 Subject: [PATCH 08/22] feat: groupDTOId en assignmentDTOId toegevoegd --- common/src/interfaces/assignment.ts | 5 +++++ common/src/interfaces/group.ts | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/common/src/interfaces/assignment.ts b/common/src/interfaces/assignment.ts index 3e7e6a5d..fb7dfbf0 100644 --- a/common/src/interfaces/assignment.ts +++ b/common/src/interfaces/assignment.ts @@ -9,3 +9,8 @@ export interface AssignmentDTO { language: string; groups: GroupDTO[] | string[][]; } + +export interface AssignmentDTOId { + id: number; + within: string; +} diff --git a/common/src/interfaces/group.ts b/common/src/interfaces/group.ts index 742f2c75..a9f68398 100644 --- a/common/src/interfaces/group.ts +++ b/common/src/interfaces/group.ts @@ -8,3 +8,9 @@ export interface GroupDTO { groupNumber: number; members: string[] | StudentDTO[]; } + +export interface GroupDTOId { + class: string, + assignment: number, + groupNumber: number, +} \ No newline at end of file From e3fc4b72a7e7473ea47bc9a130a68a4c92e4d048 Mon Sep 17 00:00:00 2001 From: Adriaan Jacquet Date: Tue, 15 Apr 2025 19:56:09 +0200 Subject: [PATCH 09/22] fix+feat: error bij het toevegoen van groups na het aanmaken van een assignment gefixt, group & assignment DTO Id toegevoegd --- .../data/assignments/assignment-repository.ts | 4 +-- backend/src/interfaces/assignment.ts | 19 +++++-------- backend/src/interfaces/group.ts | 27 ++++++++++--------- backend/src/services/assignments.ts | 27 ++++++++++++------- backend/src/services/groups.ts | 10 +++---- backend/src/services/students.ts | 8 +++--- frontend/src/controllers/assignments.ts | 4 +-- frontend/src/controllers/groups.ts | 4 +-- 8 files changed, 53 insertions(+), 50 deletions(-) diff --git a/backend/src/data/assignments/assignment-repository.ts b/backend/src/data/assignments/assignment-repository.ts index 2645de1e..8b9ebe22 100644 --- a/backend/src/data/assignments/assignment-repository.ts +++ b/backend/src/data/assignments/assignment-repository.ts @@ -4,10 +4,10 @@ import { Class } from '../../entities/classes/class.entity.js'; export class AssignmentRepository extends DwengoEntityRepository { public async findByClassAndId(within: Class, id: number): Promise { - return this.findOne({ within: within, id: id }, { populate: [ "groups" ]}); + return this.findOne({ within: within, id: id }, { populate: [ "groups", "groups.members" ]}); } public async findAllAssignmentsInClass(within: Class): Promise { - return this.findAll({ where: { within: within }, populate: [ "groups" ] }); + return this.findAll({ where: { within: within }, populate: [ "groups", "groups.members" ] }); } public async deleteByClassAndId(within: Class, id: number): Promise { return this.deleteWhere({ within: within, id: id }); diff --git a/backend/src/interfaces/assignment.ts b/backend/src/interfaces/assignment.ts index 510635ab..2df9d8bd 100644 --- a/backend/src/interfaces/assignment.ts +++ b/backend/src/interfaces/assignment.ts @@ -3,22 +3,17 @@ import { FALLBACK_LANG } from '../config.js'; import { Assignment } from '../entities/assignments/assignment.entity.js'; import { Class } from '../entities/classes/class.entity.js'; import { getLogger } from '../logging/initalize.js'; -import { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment'; +import { AssignmentDTO, AssignmentDTOId } from '@dwengo-1/common/interfaces/assignment'; import { mapToGroupDTO, mapToGroupDTOId } from './group.js'; import { getAssignmentHandler } from '../controllers/assignments.js'; import { getAssignmentRepository, getClassRepository } from '../data/repositories.js'; -export function mapToAssignmentDTOId(assignment: Assignment): AssignmentDTO { - return { - id: assignment.id!, - within: assignment.within.classId!, - title: assignment.title, - description: assignment.description, - learningPath: assignment.learningPathHruid, - language: assignment.learningPathLanguage, - groups: assignment.groups.map(group => mapToGroupDTOId(group, assignment.within)), - }; -} +export function mapToAssignmentDTOId(assignment: Assignment): AssignmentDTOId { + return { + id: assignment.id!, + within: assignment.within.classId!, + }; + } export function mapToAssignmentDTO(assignment: Assignment): AssignmentDTO { return { diff --git a/backend/src/interfaces/group.ts b/backend/src/interfaces/group.ts index 9fd753e8..08a2adfc 100644 --- a/backend/src/interfaces/group.ts +++ b/backend/src/interfaces/group.ts @@ -3,22 +3,25 @@ import { Class } from '../entities/classes/class.entity.js'; import {mapToAssignmentDTOId} from './assignment.js'; import { mapToClassDTO } from './class.js'; import { mapToStudentDTO } from './student.js'; -import { GroupDTO } from '@dwengo-1/common/interfaces/group'; +import { GroupDTO, GroupDTOId } from '@dwengo-1/common/interfaces/group'; -export function mapToGroupDTO(group: Group, cls: Class): GroupDTO { - return { - class: mapToClassDTO(cls), - assignment: mapToAssignmentDTOId(group.assignment), - groupNumber: group.groupNumber!, - members: group.members.map(mapToStudentDTO), - }; -} - -export function mapToGroupDTOId(group: Group, cls: Class): GroupDTO { +export function mapToGroupDTO(group: Group, cls: Class, options?: { expandStudents: boolean }): GroupDTO { + return { + class: cls.classId!, + assignment: group.assignment.id!, + groupNumber: group.groupNumber!, + members: + options?.expandStudents + ? group.members.map(mapToStudentDTO) + : group.members.map((student) => student.username) + + }; +} + +export function mapToGroupDTOId(group: Group, cls: Class): GroupDTOId { return { class: cls.classId!, assignment: group.assignment.id!, groupNumber: group.groupNumber!, - members: group.members.map((member) => member.username), }; } diff --git a/backend/src/services/assignments.ts b/backend/src/services/assignments.ts index dfc81357..2e0d7b6d 100644 --- a/backend/src/services/assignments.ts +++ b/backend/src/services/assignments.ts @@ -1,4 +1,4 @@ -import { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment'; +import { AssignmentDTO, AssignmentDTOId } from '@dwengo-1/common/interfaces/assignment'; import { getAssignmentRepository, getClassRepository, @@ -21,6 +21,9 @@ import { getLogger } from '../logging/initalize.js'; import { languageMap } from '@dwengo-1/common/util/language'; import { createGroup } from './groups.js'; import { GroupDTO } from 'dwengo-1-common/interfaces/group'; +import { fetchStudent } from './students.js'; +import { assert } from 'console'; +import { ServerErrorException } from '../exceptions/server-error-exception.js'; export async function fetchAssignment(classid: string, assignmentNumber: number): Promise { const classRepository = getClassRepository(); @@ -40,7 +43,7 @@ export async function fetchAssignment(classid: string, assignmentNumber: number) return assignment; } -export async function getAllAssignments(classid: string, full: boolean): Promise { +export async function getAllAssignments(classid: string, full: boolean): Promise { const cls = await fetchClass(classid); const assignmentRepository = getAssignmentRepository(); @@ -60,26 +63,32 @@ export async function createAssignment(classid: string, assignmentData: Assignme const assignment = mapToAssignment(assignmentData, cls); await assignmentRepository.save(assignment); - /* + if (assignmentData.groups) { + /* + For some reason when trying to add groups, it does not work when using the original assignment variable. + The assignment needs to be refetched in order for it to work. + */ + const assignmentCopy = await assignmentRepository.findByClassAndId(cls, assignment.id!); + + if (assignmentCopy === null) { + throw new ServerErrorException("Something has gone horribly wrong. Could not find newly added assignment which is needed to add groups."); + } + const groupRepository = getGroupRepository(); - const studentRepository = getStudentRepository(); (assignmentData.groups as string[][]).forEach(async (memberUsernames) => { - const members = (await Promise.all(memberUsernames.map(async (id) => studentRepository.findByUsername(id)))).filter( + const members = (await Promise.all(memberUsernames.map(async (id) => fetchStudent(id)))).filter( (student) => student !== null ); const newGroup = groupRepository.create({ - assignment: assignment, + assignment: assignmentCopy!, members: members, }); await groupRepository.save(newGroup); - console.log('NEW GROUP'); - console.log(newGroup); }); } - */ return mapToAssignmentDTO(assignment); } diff --git a/backend/src/services/groups.ts b/backend/src/services/groups.ts index ec152da4..5fceb67f 100644 --- a/backend/src/services/groups.ts +++ b/backend/src/services/groups.ts @@ -3,7 +3,7 @@ import { getGroupRepository, getStudentRepository, getSubmissionRepository } fro import { Group } from '../entities/assignments/group.entity.js'; import { mapToGroupDTO, mapToGroupDTOId } from '../interfaces/group.js'; import { mapToSubmissionDTO, mapToSubmissionDTOId } from '../interfaces/submission.js'; -import { GroupDTO } from '@dwengo-1/common/interfaces/group'; +import { GroupDTO, GroupDTOId } from '@dwengo-1/common/interfaces/group'; import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; import { fetchAssignment } from './assignments.js'; import { NotFoundException } from '../exceptions/not-found-exception.js'; @@ -77,16 +77,12 @@ export async function createGroup(groupData: GroupDTO, classid: string, assignme members: members }); - try { - await groupRepository.save(newGroup); - } catch(e) { - console.log(e); - } + await groupRepository.save(newGroup); return mapToGroupDTO(newGroup, newGroup.assignment.within); } -export async function getAllGroups(classId: string, assignmentNumber: number, full: boolean): Promise { +export async function getAllGroups(classId: string, assignmentNumber: number, full: boolean): Promise { const assignment = await fetchAssignment(classId, assignmentNumber); const groupRepository = getGroupRepository(); diff --git a/backend/src/services/students.ts b/backend/src/services/students.ts index 121b382e..a585a85e 100644 --- a/backend/src/services/students.ts +++ b/backend/src/services/students.ts @@ -18,8 +18,8 @@ import { NotFoundException } from '../exceptions/not-found-exception.js'; import { fetchClass } from './classes.js'; import { StudentDTO } from '@dwengo-1/common/interfaces/student'; import { ClassDTO } from '@dwengo-1/common/interfaces/class'; -import { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment'; -import { GroupDTO } from '@dwengo-1/common/interfaces/group'; +import { AssignmentDTO, AssignmentDTOId } from '@dwengo-1/common/interfaces/assignment'; +import { GroupDTO, GroupDTOId } from '@dwengo-1/common/interfaces/group'; import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; import { ClassJoinRequestDTO } from '@dwengo-1/common/interfaces/class-join-request'; @@ -82,7 +82,7 @@ export async function getStudentClasses(username: string, full: boolean): Promis return classes.map((cls) => cls.classId!); } -export async function getStudentAssignments(username: string, full: boolean): Promise { +export async function getStudentAssignments(username: string, full: boolean): Promise { const student = await fetchStudent(username); const classRepository = getClassRepository(); @@ -91,7 +91,7 @@ export async function getStudentAssignments(username: string, full: boolean): Pr return (await Promise.all(classes.map(async (cls) => await getAllAssignments(cls.classId!, full)))).flat(); } -export async function getStudentGroups(username: string, full: boolean): Promise { +export async function getStudentGroups(username: string, full: boolean): Promise { const student = await fetchStudent(username); const groupRepository = getGroupRepository(); diff --git a/frontend/src/controllers/assignments.ts b/frontend/src/controllers/assignments.ts index a66f8e84..0d46e311 100644 --- a/frontend/src/controllers/assignments.ts +++ b/frontend/src/controllers/assignments.ts @@ -1,11 +1,11 @@ import { BaseController } from "./base-controller"; -import type { AssignmentDTO } from "@dwengo-1/common/interfaces/assignment"; +import type { AssignmentDTO, AssignmentDTOId } from "@dwengo-1/common/interfaces/assignment"; import type { SubmissionsResponse } from "./submissions"; import type { QuestionsResponse } from "./questions"; import type { GroupsResponse } from "./groups"; export interface AssignmentsResponse { - assignments: AssignmentDTO[] | string[]; + assignments: AssignmentDTO[] | AssignmentDTOId[]; } export interface AssignmentResponse { diff --git a/frontend/src/controllers/groups.ts b/frontend/src/controllers/groups.ts index de6592b5..70359eb6 100644 --- a/frontend/src/controllers/groups.ts +++ b/frontend/src/controllers/groups.ts @@ -1,10 +1,10 @@ import { BaseController } from "./base-controller"; -import type { GroupDTO } from "@dwengo-1/common/interfaces/group"; +import type { GroupDTO, GroupDTOId } from "@dwengo-1/common/interfaces/group"; import type { SubmissionsResponse } from "./submissions"; import type { QuestionsResponse } from "./questions"; export interface GroupsResponse { - groups: GroupDTO[]; + groups: GroupDTO[] | GroupDTOId[]; } export interface GroupResponse { From ba9906eb9308b3c4f6ad0a29838c7ff7a188f939 Mon Sep 17 00:00:00 2001 From: Adriaan Jacquet Date: Thu, 17 Apr 2025 12:20:36 +0200 Subject: [PATCH 10/22] fix: fixed groups in return van createAssignment --- backend/src/interfaces/group.ts | 2 -- backend/src/services/assignments.ts | 21 +++++++++------------ backend/src/services/groups.ts | 12 +++--------- backend/src/services/students.ts | 5 +++++ 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/backend/src/interfaces/group.ts b/backend/src/interfaces/group.ts index 08a2adfc..2d7f9afa 100644 --- a/backend/src/interfaces/group.ts +++ b/backend/src/interfaces/group.ts @@ -1,7 +1,5 @@ import { Group } from '../entities/assignments/group.entity.js'; import { Class } from '../entities/classes/class.entity.js'; -import {mapToAssignmentDTOId} from './assignment.js'; -import { mapToClassDTO } from './class.js'; import { mapToStudentDTO } from './student.js'; import { GroupDTO, GroupDTOId } from '@dwengo-1/common/interfaces/group'; diff --git a/backend/src/services/assignments.ts b/backend/src/services/assignments.ts index 2e0d7b6d..ce6c248d 100644 --- a/backend/src/services/assignments.ts +++ b/backend/src/services/assignments.ts @@ -15,14 +15,9 @@ import { mapToSubmissionDTO, mapToSubmissionDTOId } from '../interfaces/submissi import { fetchClass } from './classes.js'; import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; -import { assign, EntityDTO } from '@mikro-orm/core'; +import { EntityDTO } from '@mikro-orm/core'; import { putObject } from './service-helper.js'; -import { getLogger } from '../logging/initalize.js'; -import { languageMap } from '@dwengo-1/common/util/language'; -import { createGroup } from './groups.js'; -import { GroupDTO } from 'dwengo-1-common/interfaces/group'; -import { fetchStudent } from './students.js'; -import { assert } from 'console'; +import { fetchStudents } from './students.js'; import { ServerErrorException } from '../exceptions/server-error-exception.js'; export async function fetchAssignment(classid: string, assignmentNumber: number): Promise { @@ -69,8 +64,9 @@ export async function createAssignment(classid: string, assignmentData: Assignme For some reason when trying to add groups, it does not work when using the original assignment variable. The assignment needs to be refetched in order for it to work. */ + const assignmentCopy = await assignmentRepository.findByClassAndId(cls, assignment.id!); - + if (assignmentCopy === null) { throw new ServerErrorException("Something has gone horribly wrong. Could not find newly added assignment which is needed to add groups."); } @@ -78,9 +74,7 @@ export async function createAssignment(classid: string, assignmentData: Assignme const groupRepository = getGroupRepository(); (assignmentData.groups as string[][]).forEach(async (memberUsernames) => { - const members = (await Promise.all(memberUsernames.map(async (id) => fetchStudent(id)))).filter( - (student) => student !== null - ); + const members = await fetchStudents(memberUsernames); const newGroup = groupRepository.create({ assignment: assignmentCopy!, @@ -90,7 +84,10 @@ export async function createAssignment(classid: string, assignmentData: Assignme }); } - return mapToAssignmentDTO(assignment); + /* Need to refetch the assignment here again such that the groups are added. */ + const assignmentWithGroups = await fetchAssignment(classid, assignment.id!); + + return mapToAssignmentDTO(assignmentWithGroups); } export async function getAssignment(classid: string, id: number): Promise { diff --git a/backend/src/services/groups.ts b/backend/src/services/groups.ts index 5fceb67f..f9889416 100644 --- a/backend/src/services/groups.ts +++ b/backend/src/services/groups.ts @@ -1,5 +1,5 @@ import { EntityDTO } from '@mikro-orm/core'; -import { getGroupRepository, getStudentRepository, getSubmissionRepository } from '../data/repositories.js'; +import { getGroupRepository, getSubmissionRepository } from '../data/repositories.js'; import { Group } from '../entities/assignments/group.entity.js'; import { mapToGroupDTO, mapToGroupDTOId } from '../interfaces/group.js'; import { mapToSubmissionDTO, mapToSubmissionDTOId } from '../interfaces/submission.js'; @@ -8,7 +8,7 @@ import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/subm import { fetchAssignment } from './assignments.js'; import { NotFoundException } from '../exceptions/not-found-exception.js'; import { putObject } from './service-helper.js'; -import { Student } from '../entities/users/student.entity.js'; +import { fetchStudents } from './students.js'; export async function fetchGroup(classId: string, assignmentNumber: number, groupNumber: number): Promise { const assignment = await fetchAssignment(classId, assignmentNumber); @@ -60,14 +60,8 @@ export async function getExistingGroupFromGroupDTO(groupData: GroupDTO): Promise } export async function createGroup(groupData: GroupDTO, classid: string, assignmentNumber: number): Promise { - const studentRepository = getStudentRepository(); - const memberUsernames = (groupData.members as string[]) || []; - const members = ( - await Promise.all( - memberUsernames.map(async (id) => studentRepository.findByUsername(id)) - ) - ).filter((student): student is Student => student !== null); + const members = await fetchStudents(memberUsernames); const assignment = await fetchAssignment(classid, assignmentNumber); diff --git a/backend/src/services/students.ts b/backend/src/services/students.ts index a585a85e..d8a06514 100644 --- a/backend/src/services/students.ts +++ b/backend/src/services/students.ts @@ -47,6 +47,11 @@ export async function fetchStudent(username: string): Promise { return user; } +export async function fetchStudents(usernames: string[]): Promise { + const members = await Promise.all(usernames.map(async (username) => await fetchStudent(username))); + return members; +} + export async function getStudent(username: string): Promise { const user = await fetchStudent(username); return mapToStudentDTO(user); From 01a0e7125a6ebc8f5b2aef84f814a0c3cd04e917 Mon Sep 17 00:00:00 2001 From: Adriaan Jacquet Date: Thu, 17 Apr 2025 18:58:33 +0200 Subject: [PATCH 11/22] fix: resterende merge errors gefixt --- backend/src/interfaces/question.ts | 2 +- package-lock.json | 1089 +--------------------------- 2 files changed, 2 insertions(+), 1089 deletions(-) diff --git a/backend/src/interfaces/question.ts b/backend/src/interfaces/question.ts index 50a61301..98e6f33c 100644 --- a/backend/src/interfaces/question.ts +++ b/backend/src/interfaces/question.ts @@ -31,7 +31,7 @@ export function mapToQuestionDTO(question: Question): QuestionDTO { learningObjectIdentifier, sequenceNumber: question.sequenceNumber!, author: mapToStudentDTO(question.author), - inGroup: mapToGroupDTOId(question.inGroup), + inGroup: mapToGroupDTOId(question.inGroup, question.inGroup.assignment?.within), timestamp: question.timestamp.toISOString(), content: question.content, }; diff --git a/package-lock.json b/package-lock.json index 2daddbda..0ffcd552 100644 --- a/package-lock.json +++ b/package-lock.json @@ -72,133 +72,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": { "version": "15.15.0", "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz", @@ -212,48 +85,6 @@ "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": { "name": "@dwengo-1/common", "version": "0.1.1" @@ -1027,294 +858,6 @@ "resolved": "common", "link": true }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.2.tgz", - "integrity": "sha512-wCIboOL2yXZym2cgm6mlA742s9QeJ8DjGVaL39dLN4rRwrOgOyYSnOaFPhKZGLb2ngj4EyfAFjsNJwPXZvseag==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.2.tgz", - "integrity": "sha512-NQhH7jFstVY5x8CKbcfa166GoV0EFkaPkCKBQkdPJFvo5u+nGXLEH/ooniLb3QI8Fk58YAx7nsPLozUWfCBOJA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.2.tgz", - "integrity": "sha512-5ZAX5xOmTligeBaeNEPnPaeEuah53Id2tX4c2CVP3JaROTH+j4fnfHCkr1PjXMd78hMst+TlkfKcW/DlTq0i4w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.2.tgz", - "integrity": "sha512-Ffcx+nnma8Sge4jzddPHCZVRvIfQ0kMsUsCMcJRHkGJ1cDmhe4SsrYIjLUKn1xpHZybmOqCWwB0zQvsjdEHtkg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.2.tgz", - "integrity": "sha512-MpM6LUVTXAzOvN4KbjzU/q5smzryuoNjlriAIx+06RpecwCkL9JpenNzpKd2YMzLJFOdPqBpuub6eVRP5IgiSA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.2.tgz", - "integrity": "sha512-5eRPrTX7wFyuWe8FqEFPG2cU0+butQQVNcT4sVipqjLYQjjh8a8+vUTfgBKM88ObB85ahsnTwF7PSIt6PG+QkA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.2.tgz", - "integrity": "sha512-mLwm4vXKiQ2UTSX4+ImyiPdiHjiZhIaE9QvC7sw0tZ6HoNMjYAqQpGyui5VRIi5sGd+uWq940gdCbY3VLvsO1w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.2.tgz", - "integrity": "sha512-6qyyn6TjayJSwGpm8J9QYYGQcRgc90nmfdUb0O7pp1s4lTY+9D0H9O02v5JqGApUyiHOtkz6+1hZNvNtEhbwRQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.2.tgz", - "integrity": "sha512-UHBRgJcmjJv5oeQF8EpTRZs/1knq6loLxTsjc3nxO9eXAPDLcWW55flrMVc97qFPbmZP31ta1AZVUKQzKTzb0g==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.2.tgz", - "integrity": "sha512-gq/sjLsOyMT19I8obBISvhoYiZIAaGF8JpeXu1u8yPv8BE5HlWYobmlsfijFIZ9hIVGYkbdFhEqC0NvM4kNO0g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.2.tgz", - "integrity": "sha512-bBYCv9obgW2cBP+2ZWfjYTU+f5cxRoGGQ5SeDbYdFCAZpYWrfjjfYwvUpP8MlKbP0nwZ5gyOU/0aUzZ5HWPuvQ==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.2.tgz", - "integrity": "sha512-SHNGiKtvnU2dBlM5D8CXRFdd+6etgZ9dXfaPCeJtz+37PIUlixvlIhI23L5khKXs3DIzAn9V8v+qb1TRKrgT5w==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.2.tgz", - "integrity": "sha512-hDDRlzE6rPeoj+5fsADqdUZl1OzqDYow4TB4Y/3PlKBD0ph1e6uPHzIQcv2Z65u2K0kpeByIyAjCmjn1hJgG0Q==", - "cpu": [ - "mips64el" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.2.tgz", - "integrity": "sha512-tsHu2RRSWzipmUi9UBDEzc0nLc4HtpZEI5Ba+Omms5456x5WaNuiG3u7xh5AO6sipnJ9r4cRWQB2tUjPyIkc6g==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.2.tgz", - "integrity": "sha512-k4LtpgV7NJQOml/10uPU0s4SAXGnowi5qBSjaLWMojNCUICNu7TshqHLAEbkBdAszL5TabfvQ48kK84hyFzjnw==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.2.tgz", - "integrity": "sha512-GRa4IshOdvKY7M/rDpRR3gkiTNp34M0eLTaC1a08gNrh4u488aPhuZOCpkF6+2wl3zAN7L7XIpOFBhnaE3/Q8Q==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, "node_modules/@esbuild/linux-x64": { "version": "0.25.2", "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.2.tgz", @@ -1333,150 +876,6 @@ "node": ">=18" } }, - "node_modules/@esbuild/netbsd-arm64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.2.tgz", - "integrity": "sha512-talAIBoY5M8vHc6EeI2WW9d/CkiO9MQJ0IOWX8hrLhxGbro/vBXJvaQXefW2cP0z0nQVTdQ/eNyGFV1GSKrxfw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.2.tgz", - "integrity": "sha512-voZT9Z+tpOxrvfKFyfDYPc4DO4rk06qamv1a/fkuzHpiVBMOhpjK+vBmWM8J1eiB3OLSMFYNaOaBNLXGChf5tg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.2.tgz", - "integrity": "sha512-dcXYOC6NXOqcykeDlwId9kB6OkPUxOEqU+rkrYVqJbK2hagWOMrsTGsMr8+rW02M+d5Op5NNlgMmjzecaRf7Tg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.2.tgz", - "integrity": "sha512-t/TkWwahkH0Tsgoq1Ju7QfgGhArkGLkF1uYz8nQS/PPFlXbP5YgRpqQR3ARRiC2iXoLTWFxc6DJMSK10dVXluw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.2.tgz", - "integrity": "sha512-cfZH1co2+imVdWCjd+D1gf9NjkchVhhdpgb1q5y6Hcv9TP6Zi9ZG/beI3ig8TvwT9lH9dlxLq5MQBBgwuj4xvA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.2.tgz", - "integrity": "sha512-7Loyjh+D/Nx/sOTzV8vfbB3GJuHdOQyrOryFdZvPHLf42Tk9ivBU5Aedi7iyX+x6rbn2Mh68T4qq1SDqJBQO5Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.2.tgz", - "integrity": "sha512-WRJgsz9un0nqZJ4MfhabxaD9Ft8KioqU3JMinOTvobbX6MOSUigSBlogP8QB3uxpJDsFS6yN+3FDBdqE5lg9kg==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.25.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.2.tgz", - "integrity": "sha512-kM3HKb16VIXZyIeVrM1ygYmZBKybX8N4p754bw390wGO3Tf2j4L2/WYL+4suWujpgf6GBYs3jv7TyUivdd05JA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "peer": true, - "engines": { - "node": ">=18" - } - }, "node_modules/@eslint-community/eslint-utils": { "version": "4.5.1", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.5.1.tgz", @@ -1991,7 +1390,6 @@ "resolved": "https://registry.npmjs.org/@mikro-orm/cli/-/cli-6.4.12.tgz", "integrity": "sha512-7rKtrR4GAmeHOCSIPqtL1rtKdAQFvuCghiNxbL2+ck7d5SHRLG/pSCmnW70p5160a9mJ8uCl8vfWIQNOsX94Sw==", "dev": true, - "license": "MIT", "dependencies": { "@jercle/yargonaut": "1.1.5", "@mikro-orm/core": "6.4.12", @@ -2012,7 +1410,6 @@ "version": "6.4.12", "resolved": "https://registry.npmjs.org/@mikro-orm/core/-/core-6.4.12.tgz", "integrity": "sha512-TzJJCFZCdyrVPt/K3UHdao8Iyj4xJSj2r0tYUCY4zNKwuUw6K3RlEYcWGUf85FWIAZJPpYqbv83WTb/H9OiyyQ==", - "license": "MIT", "dependencies": { "dataloader": "2.2.3", "dotenv": "16.4.7", @@ -2033,7 +1430,6 @@ "version": "6.4.12", "resolved": "https://registry.npmjs.org/@mikro-orm/knex/-/knex-6.4.12.tgz", "integrity": "sha512-KMocJ4fdAbf52I/K25eV+dZDWXdVJpiIaBuIRt04m+SiJ7HZPP0OTDt/mexX3WHWW2m/d1byDNIZecjmV0eRSA==", - "license": "MIT", "dependencies": { "fs-extra": "11.3.0", "knex": "3.1.0", @@ -2064,7 +1460,6 @@ "version": "6.4.12", "resolved": "https://registry.npmjs.org/@mikro-orm/postgresql/-/postgresql-6.4.12.tgz", "integrity": "sha512-qWO2oerG2A9Jf6dCP/3tvnwxB/Y7gZGXOByG/iMlnQHeHEZ95G5GDe1TSZ/5Ho52wGoq3Vn3xzeKZwJdajbcEw==", - "license": "MIT", "dependencies": { "@mikro-orm/knex": "6.4.12", "pg": "8.14.1", @@ -2083,7 +1478,6 @@ "version": "6.4.12", "resolved": "https://registry.npmjs.org/@mikro-orm/reflection/-/reflection-6.4.12.tgz", "integrity": "sha512-RZAMFAwe+yBylbiaHTyBDXDZWkqcLVv6IxRAc/YGBhD+Z1NjZbrFRrNg7OQryEW13OUIuIrXTCgKb9C0Mem0cQ==", - "license": "MIT", "dependencies": { "globby": "11.1.0", "ts-morph": "25.0.1" @@ -2099,7 +1493,6 @@ "version": "6.4.12", "resolved": "https://registry.npmjs.org/@mikro-orm/sqlite/-/sqlite-6.4.12.tgz", "integrity": "sha512-fIR/AkgUxOEKCiGxes8BrkNm86iP7eB0ZhvDjrRbinYxarGHtPIUEub0tY0jvQNbXo4s/GwRIPhA178pr5xEFA==", - "license": "MIT", "dependencies": { "@mikro-orm/knex": "6.4.12", "fs-extra": "11.3.0", @@ -2113,134 +1506,6 @@ "@mikro-orm/core": "^6.0.0" } }, - "node_modules/@napi-rs/snappy-android-arm-eabi": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@napi-rs/snappy-android-arm-eabi/-/snappy-android-arm-eabi-7.2.2.tgz", - "integrity": "sha512-H7DuVkPCK5BlAr1NfSU8bDEN7gYs+R78pSHhDng83QxRnCLmVIZk33ymmIwurmoA1HrdTxbkbuNl+lMvNqnytw==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@napi-rs/snappy-android-arm64": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@napi-rs/snappy-android-arm64/-/snappy-android-arm64-7.2.2.tgz", - "integrity": "sha512-2R/A3qok+nGtpVK8oUMcrIi5OMDckGYNoBLFyli3zp8w6IArPRfg1yOfVUcHvpUDTo9T7LOS1fXgMOoC796eQw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@napi-rs/snappy-darwin-arm64": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@napi-rs/snappy-darwin-arm64/-/snappy-darwin-arm64-7.2.2.tgz", - "integrity": "sha512-USgArHbfrmdbuq33bD5ssbkPIoT7YCXCRLmZpDS6dMDrx+iM7eD2BecNbOOo7/v1eu6TRmQ0xOzeQ6I/9FIi5g==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@napi-rs/snappy-darwin-x64": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@napi-rs/snappy-darwin-x64/-/snappy-darwin-x64-7.2.2.tgz", - "integrity": "sha512-0APDu8iO5iT0IJKblk2lH0VpWSl9zOZndZKnBYIc+ei1npw2L5QvuErFOTeTdHBtzvUHASB+9bvgaWnQo4PvTQ==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@napi-rs/snappy-freebsd-x64": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@napi-rs/snappy-freebsd-x64/-/snappy-freebsd-x64-7.2.2.tgz", - "integrity": "sha512-mRTCJsuzy0o/B0Hnp9CwNB5V6cOJ4wedDTWEthsdKHSsQlO7WU9W1yP7H3Qv3Ccp/ZfMyrmG98Ad7u7lG58WXA==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@napi-rs/snappy-linux-arm-gnueabihf": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@napi-rs/snappy-linux-arm-gnueabihf/-/snappy-linux-arm-gnueabihf-7.2.2.tgz", - "integrity": "sha512-v1uzm8+6uYjasBPcFkv90VLZ+WhLzr/tnfkZ/iD9mHYiULqkqpRuC8zvc3FZaJy5wLQE9zTDkTJN1IvUcZ+Vcg==", - "cpu": [ - "arm" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@napi-rs/snappy-linux-arm64-gnu": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@napi-rs/snappy-linux-arm64-gnu/-/snappy-linux-arm64-gnu-7.2.2.tgz", - "integrity": "sha512-LrEMa5pBScs4GXWOn6ZYXfQ72IzoolZw5txqUHVGs8eK4g1HR9HTHhb2oY5ySNaKakG5sOgMsb1rwaEnjhChmQ==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@napi-rs/snappy-linux-arm64-musl": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@napi-rs/snappy-linux-arm64-musl/-/snappy-linux-arm64-musl-7.2.2.tgz", - "integrity": "sha512-3orWZo9hUpGQcB+3aTLW7UFDqNCQfbr0+MvV67x8nMNYj5eAeUtMmUE/HxLznHO4eZ1qSqiTwLbVx05/Socdlw==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - } - }, "node_modules/@napi-rs/snappy-linux-x64-gnu": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/@napi-rs/snappy-linux-x64-gnu/-/snappy-linux-x64-gnu-7.2.2.tgz", @@ -2273,54 +1538,6 @@ "node": ">= 10" } }, - "node_modules/@napi-rs/snappy-win32-arm64-msvc": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@napi-rs/snappy-win32-arm64-msvc/-/snappy-win32-arm64-msvc-7.2.2.tgz", - "integrity": "sha512-9No0b3xGbHSWv2wtLEn3MO76Yopn1U2TdemZpCaEgOGccz1V+a/1d16Piz3ofSmnA13HGFz3h9NwZH9EOaIgYA==", - "cpu": [ - "arm64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@napi-rs/snappy-win32-ia32-msvc": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@napi-rs/snappy-win32-ia32-msvc/-/snappy-win32-ia32-msvc-7.2.2.tgz", - "integrity": "sha512-QiGe+0G86J74Qz1JcHtBwM3OYdTni1hX1PFyLRo3HhQUSpmi13Bzc1En7APn+6Pvo7gkrcy81dObGLDSxFAkQQ==", - "cpu": [ - "ia32" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, - "node_modules/@napi-rs/snappy-win32-x64-msvc": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@napi-rs/snappy-win32-x64-msvc/-/snappy-win32-x64-msvc-7.2.2.tgz", - "integrity": "sha512-a43cyx1nK0daw6BZxVcvDEXxKMFLSBSDTAhsFD0VqSKcC7MGUBMaqyoWUcMiI7LBSz4bxUmxDWKfCYzpEmeb3w==", - "cpu": [ - "x64" - ], - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - } - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -2543,231 +1760,6 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.38.0.tgz", - "integrity": "sha512-ldomqc4/jDZu/xpYU+aRxo3V4mGCV9HeTgUBANI3oIQMOL+SsxB+S2lxMpkFp5UamSS3XuTMQVbsS24R4J4Qjg==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "peer": true - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.38.0.tgz", - "integrity": "sha512-VUsgcy4GhhT7rokwzYQP+aV9XnSLkkhlEJ0St8pbasuWO/vwphhZQxYEKUP3ayeCYLhk6gEtacRpYP/cj3GjyQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "peer": true - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.38.0.tgz", - "integrity": "sha512-buA17AYXlW9Rn091sWMq1xGUvWQFOH4N1rqUxGJtEQzhChxWjldGCCup7r/wUnaI6Au8sKXpoh0xg58a7cgcpg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "peer": true - }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.38.0.tgz", - "integrity": "sha512-Mgcmc78AjunP1SKXl624vVBOF2bzwNWFPMP4fpOu05vS0amnLcX8gHIge7q/lDAHy3T2HeR0TqrriZDQS2Woeg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "peer": true - }, - "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.38.0.tgz", - "integrity": "sha512-zzJACgjLbQTsscxWqvrEQAEh28hqhebpRz5q/uUd1T7VTwUNZ4VIXQt5hE7ncs0GrF+s7d3S4on4TiXUY8KoQA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "peer": true - }, - "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.38.0.tgz", - "integrity": "sha512-hCY/KAeYMCyDpEE4pTETam0XZS4/5GXzlLgpi5f0IaPExw9kuB+PDTOTLuPtM10TlRG0U9OSmXJ+Wq9J39LvAg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "peer": true - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.38.0.tgz", - "integrity": "sha512-mimPH43mHl4JdOTD7bUMFhBdrg6f9HzMTOEnzRmXbOZqjijCw8LA5z8uL6LCjxSa67H2xiLFvvO67PT05PRKGg==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.38.0.tgz", - "integrity": "sha512-tPiJtiOoNuIH8XGG8sWoMMkAMm98PUwlriOFCCbZGc9WCax+GLeVRhmaxjJtz6WxrPKACgrwoZ5ia/uapq3ZVg==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.38.0.tgz", - "integrity": "sha512-wZco59rIVuB0tjQS0CSHTTUcEde+pXQWugZVxWaQFdQQ1VYub/sTrNdY76D1MKdN2NB48JDuGABP6o6fqos8mA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.38.0.tgz", - "integrity": "sha512-fQgqwKmW0REM4LomQ+87PP8w8xvU9LZfeLBKybeli+0yHT7VKILINzFEuggvnV9M3x1Ed4gUBmGUzCo/ikmFbQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true - }, - "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.38.0.tgz", - "integrity": "sha512-hz5oqQLXTB3SbXpfkKHKXLdIp02/w3M+ajp8p4yWOWwQRtHWiEOCKtc9U+YXahrwdk+3qHdFMDWR5k+4dIlddg==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true - }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.38.0.tgz", - "integrity": "sha512-NXqygK/dTSibQ+0pzxsL3r4Xl8oPqVoWbZV9niqOnIHV/J92fe65pOir0xjkUZDRSPyFRvu+4YOpJF9BZHQImw==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.38.0.tgz", - "integrity": "sha512-GEAIabR1uFyvf/jW/5jfu8gjM06/4kZ1W+j1nWTSSB3w6moZEBm7iBtzwQ3a1Pxos2F7Gz+58aVEnZHU295QTg==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true - }, - "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.38.0.tgz", - "integrity": "sha512-9EYTX+Gus2EGPbfs+fh7l95wVADtSQyYw4DfSBcYdUEAmP2lqSZY0Y17yX/3m5VKGGJ4UmIH5LHLkMJft3bYoA==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.38.0.tgz", - "integrity": "sha512-Mpp6+Z5VhB9VDk7RwZXoG2qMdERm3Jw07RNlXHE0bOnEeX+l7Fy4bg+NxfyN15ruuY3/7Vrbpm75J9QHFqj5+Q==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "peer": true - }, "node_modules/@rollup/rollup-linux-x64-gnu": { "version": "4.38.0", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.38.0.tgz", @@ -2798,51 +1790,6 @@ ], "peer": true }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.38.0.tgz", - "integrity": "sha512-u/Jbm1BU89Vftqyqbmxdq14nBaQjQX1HhmsdBWqSdGClNaKwhjsg5TpW+5Ibs1mb8Es9wJiMdl86BcmtUVXNZg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "peer": true - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.38.0.tgz", - "integrity": "sha512-mqu4PzTrlpNHHbu5qleGvXJoGgHpChBlrBx/mEhTPpnAL1ZAYFlvHD7rLK839LLKQzqEQMFJfGrrOHItN4ZQqA==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "peer": true - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.38.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.38.0.tgz", - "integrity": "sha512-jjqy3uWlecfB98Psxb5cD6Fny9Fupv9LrDSPTQZUROqjvZmcCqNu4UMl7qqhlUUGpwiAkotj6GYu4SZdcr/nLw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "peer": true - }, "node_modules/@scarf/scarf": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@scarf/scarf/-/scarf-1.4.0.tgz", @@ -6303,22 +5250,6 @@ "devOptional": true, "license": "ISC" }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "peer": true, - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -8023,7 +6954,6 @@ "version": "6.4.12", "resolved": "https://registry.npmjs.org/mikro-orm/-/mikro-orm-6.4.12.tgz", "integrity": "sha512-uOJdx0q9Hg0SKYtHeJ73Iu2PhlU8LoyhaMm2PH9n1kvqpyoqUme2vKpwWywELFpZKgXwtkeIA8Ce56caYb593Q==", - "license": "MIT", "engines": { "node": ">= 18.12.0" } @@ -8823,7 +7753,6 @@ "resolved": "https://registry.npmjs.org/pg/-/pg-8.14.1.tgz", "integrity": "sha512-0TdbqfjwIun9Fm/r89oB7RFQ0bLgduAhiIqIXOsyKoiC/L54DbuAAzIEN/9Op0f1Po9X7iCPXGoa/Ah+2aI8Xw==", "license": "MIT", - "peer": true, "dependencies": { "pg-connection-string": "^2.7.0", "pg-pool": "^3.8.0", @@ -8933,8 +7862,7 @@ "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", - "peer": true + "license": "MIT" }, "node_modules/pgpass": { "version": "1.0.5", @@ -9008,21 +7936,6 @@ "node": ">=18" } }, - "node_modules/playwright/node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/postcss": { "version": "8.5.3", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz", From 205a4addadb933e0117c245bd63df9852b88078f Mon Sep 17 00:00:00 2001 From: Lint Action Date: Thu, 17 Apr 2025 17:08:13 +0000 Subject: [PATCH 12/22] style: fix linting issues met ESLint --- backend/src/services/assignments.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/services/assignments.ts b/backend/src/services/assignments.ts index ce6c248d..a3992344 100644 --- a/backend/src/services/assignments.ts +++ b/backend/src/services/assignments.ts @@ -77,7 +77,7 @@ export async function createAssignment(classid: string, assignmentData: Assignme const members = await fetchStudents(memberUsernames); const newGroup = groupRepository.create({ - assignment: assignmentCopy!, + assignment: assignmentCopy, members: members, }); await groupRepository.save(newGroup); From 7f782915b6e3a1d9c2f3c707b85b7fe5db6b3bac Mon Sep 17 00:00:00 2001 From: Lint Action Date: Thu, 17 Apr 2025 17:08:18 +0000 Subject: [PATCH 13/22] style: fix linting issues met Prettier --- .../src/data/assignments/assignment-repository.ts | 4 ++-- backend/src/entities/assignments/group.entity.ts | 4 ++-- backend/src/entities/classes/class.entity.ts | 4 ++-- backend/src/entities/users/student.entity.ts | 4 ++-- backend/src/entities/users/teacher.entity.ts | 2 +- backend/src/exceptions/server-error-exception.ts | 2 +- backend/src/interfaces/assignment.ts | 14 +++++++------- backend/src/interfaces/group.ts | 3 +-- backend/src/services/assignments.ts | 7 +++---- backend/src/services/groups.ts | 6 +++--- backend/src/services/students.ts | 4 ++-- common/src/interfaces/group.ts | 8 ++++---- 12 files changed, 30 insertions(+), 32 deletions(-) diff --git a/backend/src/data/assignments/assignment-repository.ts b/backend/src/data/assignments/assignment-repository.ts index bdfa9fa7..1c8bb504 100644 --- a/backend/src/data/assignments/assignment-repository.ts +++ b/backend/src/data/assignments/assignment-repository.ts @@ -4,7 +4,7 @@ import { Class } from '../../entities/classes/class.entity.js'; export class AssignmentRepository extends DwengoEntityRepository { public async findByClassAndId(within: Class, id: number): Promise { - return this.findOne({ within: within, id: id }, { populate: [ "groups", "groups.members" ]}); + return this.findOne({ within: within, id: id }, { populate: ['groups', 'groups.members'] }); } public async findByClassIdAndAssignmentId(withinClass: string, id: number): Promise { return this.findOne({ within: { classId: withinClass }, id: id }); @@ -23,7 +23,7 @@ export class AssignmentRepository extends DwengoEntityRepository { }); } public async findAllAssignmentsInClass(within: Class): Promise { - return this.findAll({ where: { within: within }, populate: [ "groups", "groups.members" ] }); + return this.findAll({ where: { within: within }, populate: ['groups', 'groups.members'] }); } public async deleteByClassAndId(within: Class, id: number): Promise { return this.deleteWhere({ within: within, id: id }); diff --git a/backend/src/entities/assignments/group.entity.ts b/backend/src/entities/assignments/group.entity.ts index d27821c3..62d5fee9 100644 --- a/backend/src/entities/assignments/group.entity.ts +++ b/backend/src/entities/assignments/group.entity.ts @@ -16,14 +16,14 @@ export class Group { @ManyToOne({ entity: () => Assignment, - primary: true + primary: true, }) assignment!: Assignment; @ManyToMany({ entity: () => Student, owner: true, - inversedBy: "groups" + inversedBy: 'groups', }) members: Collection = new Collection(this); } diff --git a/backend/src/entities/classes/class.entity.ts b/backend/src/entities/classes/class.entity.ts index 7ad66c52..b2c59ade 100644 --- a/backend/src/entities/classes/class.entity.ts +++ b/backend/src/entities/classes/class.entity.ts @@ -14,9 +14,9 @@ export class Class { @Property({ type: 'string' }) displayName!: string; - @ManyToMany({entity: () => Teacher, owner: true, inversedBy: 'classes'}) + @ManyToMany({ entity: () => Teacher, owner: true, inversedBy: 'classes' }) teachers!: Collection; - @ManyToMany({entity: () => Student, owner: true, inversedBy: 'classes'}) + @ManyToMany({ entity: () => Student, owner: true, inversedBy: 'classes' }) students!: Collection; } diff --git a/backend/src/entities/users/student.entity.ts b/backend/src/entities/users/student.entity.ts index 2c4cfb68..9f294d3c 100644 --- a/backend/src/entities/users/student.entity.ts +++ b/backend/src/entities/users/student.entity.ts @@ -8,9 +8,9 @@ import { StudentRepository } from '../../data/users/student-repository.js'; repository: () => StudentRepository, }) export class Student extends User { - @ManyToMany({entity: () => Class, mappedBy: 'students'}) + @ManyToMany({ entity: () => Class, mappedBy: 'students' }) classes!: Collection; - @ManyToMany({entity: () => Group, mappedBy: 'members'}) + @ManyToMany({ entity: () => Group, mappedBy: 'members' }) groups: Collection = new Collection(this); } diff --git a/backend/src/entities/users/teacher.entity.ts b/backend/src/entities/users/teacher.entity.ts index 900e3610..8fbe5e51 100644 --- a/backend/src/entities/users/teacher.entity.ts +++ b/backend/src/entities/users/teacher.entity.ts @@ -5,6 +5,6 @@ import { TeacherRepository } from '../../data/users/teacher-repository.js'; @Entity({ repository: () => TeacherRepository }) export class Teacher extends User { - @ManyToMany({entity: () => Class, mappedBy: 'teachers'}) + @ManyToMany({ entity: () => Class, mappedBy: 'teachers' }) classes!: Collection; } diff --git a/backend/src/exceptions/server-error-exception.ts b/backend/src/exceptions/server-error-exception.ts index 76850a50..04db25fe 100644 --- a/backend/src/exceptions/server-error-exception.ts +++ b/backend/src/exceptions/server-error-exception.ts @@ -1,4 +1,4 @@ -import { ExceptionWithHttpState } from "./exception-with-http-state"; +import { ExceptionWithHttpState } from './exception-with-http-state'; /** * Exception for HTTP 500 Internal Server Error diff --git a/backend/src/interfaces/assignment.ts b/backend/src/interfaces/assignment.ts index 2df9d8bd..167f943f 100644 --- a/backend/src/interfaces/assignment.ts +++ b/backend/src/interfaces/assignment.ts @@ -9,11 +9,11 @@ import { getAssignmentHandler } from '../controllers/assignments.js'; import { getAssignmentRepository, getClassRepository } from '../data/repositories.js'; export function mapToAssignmentDTOId(assignment: Assignment): AssignmentDTOId { - return { - id: assignment.id!, - within: assignment.within.classId!, - }; - } + return { + id: assignment.id!, + within: assignment.within.classId!, + }; +} export function mapToAssignmentDTO(assignment: Assignment): AssignmentDTO { return { @@ -23,7 +23,7 @@ export function mapToAssignmentDTO(assignment: Assignment): AssignmentDTO { description: assignment.description, learningPath: assignment.learningPathHruid, language: assignment.learningPathLanguage, - groups: assignment.groups.map(group => mapToGroupDTO(group, assignment.within)), + groups: assignment.groups.map((group) => mapToGroupDTO(group, assignment.within)), }; } @@ -35,5 +35,5 @@ export function mapToAssignment(assignmentData: AssignmentDTO, cls: Class): Assi learningPathHruid: assignmentData.learningPath, learningPathLanguage: languageMap[assignmentData.language], groups: [], - }) + }); } diff --git a/backend/src/interfaces/group.ts b/backend/src/interfaces/group.ts index 1d15b459..d886c204 100644 --- a/backend/src/interfaces/group.ts +++ b/backend/src/interfaces/group.ts @@ -25,8 +25,7 @@ export function mapToGroupDTO(group: Group, cls: Class): GroupDTO { class: cls.classId!, assignment: group.assignment.id!, groupNumber: group.groupNumber!, - members: group.members.map(mapToStudentDTO) - + members: group.members.map(mapToStudentDTO), }; } diff --git a/backend/src/services/assignments.ts b/backend/src/services/assignments.ts index a3992344..2141671d 100644 --- a/backend/src/services/assignments.ts +++ b/backend/src/services/assignments.ts @@ -58,17 +58,16 @@ export async function createAssignment(classid: string, assignmentData: Assignme const assignment = mapToAssignment(assignmentData, cls); await assignmentRepository.save(assignment); - if (assignmentData.groups) { /* For some reason when trying to add groups, it does not work when using the original assignment variable. The assignment needs to be refetched in order for it to work. */ - + const assignmentCopy = await assignmentRepository.findByClassAndId(cls, assignment.id!); - + if (assignmentCopy === null) { - throw new ServerErrorException("Something has gone horribly wrong. Could not find newly added assignment which is needed to add groups."); + throw new ServerErrorException('Something has gone horribly wrong. Could not find newly added assignment which is needed to add groups.'); } const groupRepository = getGroupRepository(); diff --git a/backend/src/services/groups.ts b/backend/src/services/groups.ts index 0bda8237..5382b608 100644 --- a/backend/src/services/groups.ts +++ b/backend/src/services/groups.ts @@ -68,7 +68,7 @@ export async function createGroup(groupData: GroupDTO, classid: string, assignme const groupRepository = getGroupRepository(); const newGroup = groupRepository.create({ assignment: assignment, - members: members + members: members, }); await groupRepository.save(newGroup); @@ -83,10 +83,10 @@ export async function getAllGroups(classId: string, assignmentNumber: number, fu const groups = await groupRepository.findAllGroupsForAssignment(assignment); if (full) { - return groups.map(group => mapToGroupDTO(group, assignment.within)); + return groups.map((group) => mapToGroupDTO(group, assignment.within)); } - return groups.map(group => mapToGroupDTOId(group, assignment.within)); + return groups.map((group) => mapToGroupDTOId(group, assignment.within)); } export async function getGroupSubmissions( diff --git a/backend/src/services/students.ts b/backend/src/services/students.ts index c0c64400..4052b577 100644 --- a/backend/src/services/students.ts +++ b/backend/src/services/students.ts @@ -104,10 +104,10 @@ export async function getStudentGroups(username: string, full: boolean): Promise const groups = await groupRepository.findAllGroupsWithStudent(student); if (full) { - return groups.map(group => mapToGroupDTO(group, group.assignment.within)); + return groups.map((group) => mapToGroupDTO(group, group.assignment.within)); } - return groups.map(group => mapToGroupDTOId(group, group.assignment.within)); + return groups.map((group) => mapToGroupDTOId(group, group.assignment.within)); } export async function getStudentSubmissions(username: string, full: boolean): Promise { diff --git a/common/src/interfaces/group.ts b/common/src/interfaces/group.ts index cd6e9a3a..77721a1a 100644 --- a/common/src/interfaces/group.ts +++ b/common/src/interfaces/group.ts @@ -10,7 +10,7 @@ export interface GroupDTO { } export interface GroupDTOId { - class: string, - assignment: number, - groupNumber: number, -} \ No newline at end of file + class: string; + assignment: number; + groupNumber: number; +} From 5dd0db685ef8298e41f1e729b9f11e418a536efd Mon Sep 17 00:00:00 2001 From: Adriaan Jacquet Date: Thu, 17 Apr 2025 19:14:20 +0200 Subject: [PATCH 14/22] fix: fixed linting errors --- backend/src/controllers/assignments.ts | 4 ---- backend/src/interfaces/assignment.ts | 7 ++----- backend/src/interfaces/group.ts | 2 -- backend/src/services/assignments.ts | 1 - backend/src/services/groups.ts | 2 +- backend/src/services/students.ts | 2 +- 6 files changed, 4 insertions(+), 14 deletions(-) diff --git a/backend/src/controllers/assignments.ts b/backend/src/controllers/assignments.ts index 03b0d83b..2ecb35cb 100644 --- a/backend/src/controllers/assignments.ts +++ b/backend/src/controllers/assignments.ts @@ -12,8 +12,6 @@ import { requireFields } from './error-helper.js'; import { BadRequestException } from '../exceptions/bad-request-exception.js'; import { Assignment } from '../entities/assignments/assignment.entity.js'; import { EntityDTO } from '@mikro-orm/core'; -import { createGroup } from '../services/groups.js'; -import { getLogger } from '../logging/initalize.js'; export async function getAllAssignmentsHandler(req: Request, res: Response): Promise { const classId = req.params.classid; @@ -21,8 +19,6 @@ export async function getAllAssignmentsHandler(req: Request, res: Response): Pro const assignments = await getAllAssignments(classId, full); - console.log(JSON.stringify(assignments)); - res.json({ assignments }); } diff --git a/backend/src/interfaces/assignment.ts b/backend/src/interfaces/assignment.ts index 167f943f..7c5a0909 100644 --- a/backend/src/interfaces/assignment.ts +++ b/backend/src/interfaces/assignment.ts @@ -1,12 +1,9 @@ import { languageMap } from '@dwengo-1/common/util/language'; -import { FALLBACK_LANG } from '../config.js'; import { Assignment } from '../entities/assignments/assignment.entity.js'; import { Class } from '../entities/classes/class.entity.js'; -import { getLogger } from '../logging/initalize.js'; import { AssignmentDTO, AssignmentDTOId } from '@dwengo-1/common/interfaces/assignment'; -import { mapToGroupDTO, mapToGroupDTOId } from './group.js'; -import { getAssignmentHandler } from '../controllers/assignments.js'; -import { getAssignmentRepository, getClassRepository } from '../data/repositories.js'; +import { mapToGroupDTO } from './group.js'; +import { getAssignmentRepository } from '../data/repositories.js'; export function mapToAssignmentDTOId(assignment: Assignment): AssignmentDTOId { return { diff --git a/backend/src/interfaces/group.ts b/backend/src/interfaces/group.ts index d886c204..3cebb9eb 100644 --- a/backend/src/interfaces/group.ts +++ b/backend/src/interfaces/group.ts @@ -1,14 +1,12 @@ import { Group } from '../entities/assignments/group.entity.js'; import { mapToAssignment } from './assignment.js'; import { mapToStudent } from './student.js'; -import { mapToAssignmentDTO } from './assignment.js'; import { mapToStudentDTO } from './student.js'; import { GroupDTO, GroupDTOId } from '@dwengo-1/common/interfaces/group'; import { getGroupRepository } from '../data/repositories.js'; import { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment'; import { Class } from '../entities/classes/class.entity.js'; import { StudentDTO } from '@dwengo-1/common/interfaces/student'; -import { mapToClassDTO } from './class.js'; export function mapToGroup(groupDto: GroupDTO, clazz: Class): Group { const assignmentDto = groupDto.assignment as AssignmentDTO; diff --git a/backend/src/services/assignments.ts b/backend/src/services/assignments.ts index 2141671d..2379ecfb 100644 --- a/backend/src/services/assignments.ts +++ b/backend/src/services/assignments.ts @@ -4,7 +4,6 @@ import { getClassRepository, getGroupRepository, getQuestionRepository, - getStudentRepository, getSubmissionRepository, } from '../data/repositories.js'; import { Assignment } from '../entities/assignments/assignment.entity.js'; diff --git a/backend/src/services/groups.ts b/backend/src/services/groups.ts index 5382b608..0c73c8c5 100644 --- a/backend/src/services/groups.ts +++ b/backend/src/services/groups.ts @@ -1,7 +1,7 @@ import { EntityDTO } from '@mikro-orm/core'; import { getGroupRepository, getSubmissionRepository } from '../data/repositories.js'; import { Group } from '../entities/assignments/group.entity.js'; -import { mapToGroupDTO, mapToGroupDTOId, mapToShallowGroupDTO } from '../interfaces/group.js'; +import { mapToGroupDTO, mapToGroupDTOId } from '../interfaces/group.js'; import { mapToSubmissionDTO, mapToSubmissionDTOId } from '../interfaces/submission.js'; import { GroupDTO, GroupDTOId } from '@dwengo-1/common/interfaces/group'; import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; diff --git a/backend/src/services/students.ts b/backend/src/services/students.ts index 4052b577..03a6d8fa 100644 --- a/backend/src/services/students.ts +++ b/backend/src/services/students.ts @@ -7,7 +7,7 @@ import { getSubmissionRepository, } from '../data/repositories.js'; import { mapToClassDTO } from '../interfaces/class.js'; -import { mapToGroupDTO, mapToGroupDTOId, mapToShallowGroupDTO } from '../interfaces/group.js'; +import { mapToGroupDTO, mapToGroupDTOId } from '../interfaces/group.js'; import { mapToStudent, mapToStudentDTO } from '../interfaces/student.js'; import { mapToSubmissionDTO, mapToSubmissionDTOId } from '../interfaces/submission.js'; import { getAllAssignments } from './assignments.js'; From a238e57a0c2704ca2c637290d9de2eaa787a3f1f Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Fri, 18 Apr 2025 08:32:40 +0200 Subject: [PATCH 15/22] fix: .js toevoegen aan imports --- backend/src/exceptions/server-error-exception.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/exceptions/server-error-exception.ts b/backend/src/exceptions/server-error-exception.ts index 04db25fe..49251bdf 100644 --- a/backend/src/exceptions/server-error-exception.ts +++ b/backend/src/exceptions/server-error-exception.ts @@ -1,4 +1,4 @@ -import { ExceptionWithHttpState } from './exception-with-http-state'; +import { ExceptionWithHttpState } from './exception-with-http-state.js'; /** * Exception for HTTP 500 Internal Server Error From c6ce2e7e2cb3fcb37cc72d8585a843aab3f9460d Mon Sep 17 00:00:00 2001 From: Adriaan Jacquet Date: Fri, 18 Apr 2025 21:59:30 +0200 Subject: [PATCH 16/22] fix: assignment id bij seeden gefixt (DEELS) --- .../tests/test_assets/assignments/assignments.testdata.ts | 4 ---- backend/tool/seed.ts | 8 ++++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/backend/tests/test_assets/assignments/assignments.testdata.ts b/backend/tests/test_assets/assignments/assignments.testdata.ts index 14253c0a..5ac2923b 100644 --- a/backend/tests/test_assets/assignments/assignments.testdata.ts +++ b/backend/tests/test_assets/assignments/assignments.testdata.ts @@ -6,7 +6,6 @@ import { Language } from '@dwengo-1/common/util/language'; export function makeTestAssignemnts(em: EntityManager, classes: Class[]): Assignment[] { const assignment01 = em.create(Assignment, { within: classes[0], - id: 1, title: 'dire straits', description: 'reading', learningPathHruid: 'id02', @@ -16,7 +15,6 @@ export function makeTestAssignemnts(em: EntityManager, classes: Class[]): Assign const assignment02 = em.create(Assignment, { within: classes[1], - id: 2, title: 'tool', description: 'reading', learningPathHruid: 'id01', @@ -26,7 +24,6 @@ export function makeTestAssignemnts(em: EntityManager, classes: Class[]): Assign const assignment03 = em.create(Assignment, { within: classes[0], - id: 3, title: 'delete', description: 'will be deleted', learningPathHruid: 'id02', @@ -36,7 +33,6 @@ export function makeTestAssignemnts(em: EntityManager, classes: Class[]): Assign const assignment04 = em.create(Assignment, { within: classes[0], - id: 4, title: 'another assignment', description: 'with a description', learningPathHruid: 'id01', diff --git a/backend/tool/seed.ts b/backend/tool/seed.ts index 3ded9379..423eca84 100644 --- a/backend/tool/seed.ts +++ b/backend/tool/seed.ts @@ -34,6 +34,10 @@ export async function seedDatabase(): Promise { const learningPaths = makeTestLearningPaths(em); const classes = makeTestClasses(em, students, teachers); const assignments = makeTestAssignemnts(em, classes); + + /* Wegens een probleem met het aanmaken van groups werd deze code even in commentaar gezet */ + + /* const groups = makeTestGroups(em, students, assignments); assignments[0].groups = new Collection(groups.slice(0, 3)); @@ -48,6 +52,7 @@ export async function seedDatabase(): Promise { const questions = makeTestQuestions(em, students, groups); const answers = makeTestAnswers(em, teachers, questions); const submissions = makeTestSubmissions(em, students, groups); + */ // Persist all entities await em.persistAndFlush([ @@ -57,6 +62,7 @@ export async function seedDatabase(): Promise { ...learningPaths, ...classes, ...assignments, + /* ...groups, ...teacherInvitations, ...classJoinRequests, @@ -64,6 +70,7 @@ export async function seedDatabase(): Promise { ...questions, ...answers, ...submissions, + */ ]); logger.info('Development database seeded successfully!'); @@ -72,3 +79,4 @@ export async function seedDatabase(): Promise { } seedDatabase().catch(logger.error); + From 3be17f46376f769841fa548b662a291aebb32b48 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Fri, 18 Apr 2025 20:01:58 +0000 Subject: [PATCH 17/22] style: fix linting issues met ESLint --- backend/tool/seed.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/tool/seed.ts b/backend/tool/seed.ts index 423eca84..6f6a05a4 100644 --- a/backend/tool/seed.ts +++ b/backend/tool/seed.ts @@ -38,7 +38,7 @@ export async function seedDatabase(): Promise { /* Wegens een probleem met het aanmaken van groups werd deze code even in commentaar gezet */ /* - const groups = makeTestGroups(em, students, assignments); + Const groups = makeTestGroups(em, students, assignments); assignments[0].groups = new Collection(groups.slice(0, 3)); assignments[1].groups = new Collection(groups.slice(3, 4)); From 3d050f06235bb2e96fcc7d103b1ed61489390bb1 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Fri, 18 Apr 2025 20:02:04 +0000 Subject: [PATCH 18/22] style: fix linting issues met Prettier --- backend/tool/seed.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/tool/seed.ts b/backend/tool/seed.ts index 6f6a05a4..ed2a0d2b 100644 --- a/backend/tool/seed.ts +++ b/backend/tool/seed.ts @@ -79,4 +79,3 @@ export async function seedDatabase(): Promise { } seedDatabase().catch(logger.error); - From 5f1249bd78a73e1ef46080f28b234cf7210fbbf7 Mon Sep 17 00:00:00 2001 From: Adriaan Jacquet Date: Fri, 18 Apr 2025 22:08:06 +0200 Subject: [PATCH 19/22] fix: oplossing 2 voor seeden geimplementeerd (zie comment op #184) --- .../test_assets/assignments/assignments.testdata.ts | 4 ++++ .../tests/test_assets/assignments/groups.testdata.ts | 10 +++++----- backend/tool/seed.ts | 6 ------ 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/backend/tests/test_assets/assignments/assignments.testdata.ts b/backend/tests/test_assets/assignments/assignments.testdata.ts index 5ac2923b..200d9df2 100644 --- a/backend/tests/test_assets/assignments/assignments.testdata.ts +++ b/backend/tests/test_assets/assignments/assignments.testdata.ts @@ -5,6 +5,7 @@ import { Language } from '@dwengo-1/common/util/language'; export function makeTestAssignemnts(em: EntityManager, classes: Class[]): Assignment[] { const assignment01 = em.create(Assignment, { + id: 21000, within: classes[0], title: 'dire straits', description: 'reading', @@ -14,6 +15,7 @@ export function makeTestAssignemnts(em: EntityManager, classes: Class[]): Assign }); const assignment02 = em.create(Assignment, { + id: 21001, within: classes[1], title: 'tool', description: 'reading', @@ -23,6 +25,7 @@ export function makeTestAssignemnts(em: EntityManager, classes: Class[]): Assign }); const assignment03 = em.create(Assignment, { + id: 21002, within: classes[0], title: 'delete', description: 'will be deleted', @@ -32,6 +35,7 @@ export function makeTestAssignemnts(em: EntityManager, classes: Class[]): Assign }); const assignment04 = em.create(Assignment, { + id: 21003, within: classes[0], title: 'another assignment', description: 'with a description', diff --git a/backend/tests/test_assets/assignments/groups.testdata.ts b/backend/tests/test_assets/assignments/groups.testdata.ts index c82887bb..34ca140d 100644 --- a/backend/tests/test_assets/assignments/groups.testdata.ts +++ b/backend/tests/test_assets/assignments/groups.testdata.ts @@ -10,7 +10,7 @@ export function makeTestGroups(em: EntityManager, students: Student[], assignmen */ const group01 = em.create(Group, { assignment: assignments[0], - groupNumber: 1, + groupNumber: 21001, members: students.slice(0, 2), }); @@ -20,7 +20,7 @@ export function makeTestGroups(em: EntityManager, students: Student[], assignmen */ const group02 = em.create(Group, { assignment: assignments[0], - groupNumber: 2, + groupNumber: 21002, members: students.slice(2, 4), }); @@ -30,7 +30,7 @@ export function makeTestGroups(em: EntityManager, students: Student[], assignmen */ const group03 = em.create(Group, { assignment: assignments[0], - groupNumber: 3, + groupNumber: 21003, members: students.slice(4, 6), }); @@ -40,7 +40,7 @@ export function makeTestGroups(em: EntityManager, students: Student[], assignmen */ const group04 = em.create(Group, { assignment: assignments[1], - groupNumber: 4, + groupNumber: 21004, members: students.slice(3, 4), }); @@ -50,7 +50,7 @@ export function makeTestGroups(em: EntityManager, students: Student[], assignmen */ const group05 = em.create(Group, { assignment: assignments[3], - groupNumber: 1, + groupNumber: 21001, members: students.slice(0, 2), }); diff --git a/backend/tool/seed.ts b/backend/tool/seed.ts index 423eca84..78d6dd70 100644 --- a/backend/tool/seed.ts +++ b/backend/tool/seed.ts @@ -35,9 +35,6 @@ export async function seedDatabase(): Promise { const classes = makeTestClasses(em, students, teachers); const assignments = makeTestAssignemnts(em, classes); - /* Wegens een probleem met het aanmaken van groups werd deze code even in commentaar gezet */ - - /* const groups = makeTestGroups(em, students, assignments); assignments[0].groups = new Collection(groups.slice(0, 3)); @@ -52,7 +49,6 @@ export async function seedDatabase(): Promise { const questions = makeTestQuestions(em, students, groups); const answers = makeTestAnswers(em, teachers, questions); const submissions = makeTestSubmissions(em, students, groups); - */ // Persist all entities await em.persistAndFlush([ @@ -62,7 +58,6 @@ export async function seedDatabase(): Promise { ...learningPaths, ...classes, ...assignments, - /* ...groups, ...teacherInvitations, ...classJoinRequests, @@ -70,7 +65,6 @@ export async function seedDatabase(): Promise { ...questions, ...answers, ...submissions, - */ ]); logger.info('Development database seeded successfully!'); From 78cb7812a778e368d001b488ff5e0fdb87e88dd4 Mon Sep 17 00:00:00 2001 From: Adriaan Jacquet Date: Fri, 18 Apr 2025 22:26:39 +0200 Subject: [PATCH 20/22] fix: falende tests gefixt door verandering in handmatige ids van assignment --- backend/tests/data/assignments/assignments.test.ts | 4 ++-- backend/tests/data/assignments/groups.test.ts | 10 +++++----- backend/tests/data/assignments/submissions.test.ts | 6 +++--- backend/tests/data/questions/questions.test.ts | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/backend/tests/data/assignments/assignments.test.ts b/backend/tests/data/assignments/assignments.test.ts index 1fe52523..67b20eef 100644 --- a/backend/tests/data/assignments/assignments.test.ts +++ b/backend/tests/data/assignments/assignments.test.ts @@ -16,7 +16,7 @@ describe('AssignmentRepository', () => { it('should return the requested assignment', async () => { const class_ = await classRepository.findById('34d484a1-295f-4e9f-bfdc-3e7a23d86a89'); - const assignment = await assignmentRepository.findByClassAndId(class_!, 2); + const assignment = await assignmentRepository.findByClassAndId(class_!, 21001); expect(assignment).toBeTruthy(); expect(assignment!.title).toBe('tool'); @@ -35,7 +35,7 @@ describe('AssignmentRepository', () => { const result = await assignmentRepository.findAllByResponsibleTeacher('testleerkracht1'); const resultIds = result.map((it) => it.id).sort((a, b) => (a ?? 0) - (b ?? 0)); - expect(resultIds).toEqual([1, 3, 4]); + expect(resultIds).toEqual([ 21000, 21002, 21003 ]); }); it('should not find removed assignment', async () => { diff --git a/backend/tests/data/assignments/groups.test.ts b/backend/tests/data/assignments/groups.test.ts index f7fb3046..efd477ab 100644 --- a/backend/tests/data/assignments/groups.test.ts +++ b/backend/tests/data/assignments/groups.test.ts @@ -19,16 +19,16 @@ describe('GroupRepository', () => { it('should return the requested group', async () => { const class_ = await classRepository.findById('8764b861-90a6-42e5-9732-c0d9eb2f55f9'); - const assignment = await assignmentRepository.findByClassAndId(class_!, 1); + const assignment = await assignmentRepository.findByClassAndId(class_!, 21000); - const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, 1); + const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, 21001); expect(group).toBeTruthy(); }); it('should return all groups for assignment', async () => { const class_ = await classRepository.findById('8764b861-90a6-42e5-9732-c0d9eb2f55f9'); - const assignment = await assignmentRepository.findByClassAndId(class_!, 1); + const assignment = await assignmentRepository.findByClassAndId(class_!, 21000); const groups = await groupRepository.findAllGroupsForAssignment(assignment!); @@ -38,9 +38,9 @@ describe('GroupRepository', () => { it('should not find removed group', async () => { const class_ = await classRepository.findById('34d484a1-295f-4e9f-bfdc-3e7a23d86a89'); - const assignment = await assignmentRepository.findByClassAndId(class_!, 2); + const assignment = await assignmentRepository.findByClassAndId(class_!, 21001); - await groupRepository.deleteByAssignmentAndGroupNumber(assignment!, 1); + await groupRepository.deleteByAssignmentAndGroupNumber(assignment!, 21001); const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, 1); diff --git a/backend/tests/data/assignments/submissions.test.ts b/backend/tests/data/assignments/submissions.test.ts index 31aafc1d..77609ad8 100644 --- a/backend/tests/data/assignments/submissions.test.ts +++ b/backend/tests/data/assignments/submissions.test.ts @@ -54,8 +54,8 @@ describe('SubmissionRepository', () => { it('should find the most recent submission for a group', async () => { const id = new LearningObjectIdentifier('id03', Language.English, 1); const class_ = await classRepository.findById('8764b861-90a6-42e5-9732-c0d9eb2f55f9'); - const assignment = await assignmentRepository.findByClassAndId(class_!, 1); - const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, 1); + const assignment = await assignmentRepository.findByClassAndId(class_!, 21000); + const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, 21001); const submission = await submissionRepository.findMostRecentSubmissionForGroup(id, group!); expect(submission).toBeTruthy(); @@ -67,7 +67,7 @@ describe('SubmissionRepository', () => { let loId: LearningObjectIdentifier; it('should find all submissions for a certain learning object and assignment', async () => { clazz = await classRepository.findById('8764b861-90a6-42e5-9732-c0d9eb2f55f9'); - assignment = await assignmentRepository.findByClassAndId(clazz!, 1); + assignment = await assignmentRepository.findByClassAndId(clazz!, 21000); loId = { hruid: 'id02', language: Language.English, diff --git a/backend/tests/data/questions/questions.test.ts b/backend/tests/data/questions/questions.test.ts index 9565e71d..8ad2d47c 100644 --- a/backend/tests/data/questions/questions.test.ts +++ b/backend/tests/data/questions/questions.test.ts @@ -38,8 +38,8 @@ describe('QuestionRepository', () => { const student = await studentRepository.findByUsername('Noordkaap'); const clazz = await getClassRepository().findById('8764b861-90a6-42e5-9732-c0d9eb2f55f9'); - const assignment = await getAssignmentRepository().findByClassAndId(clazz!, 1); - const group = await getGroupRepository().findByAssignmentAndGroupNumber(assignment!, 1); + const assignment = await getAssignmentRepository().findByClassAndId(clazz!, 21000); + const group = await getGroupRepository().findByAssignmentAndGroupNumber(assignment!, 21001); await questionRepository.createQuestion({ loId: id, inGroup: group!, @@ -57,7 +57,7 @@ describe('QuestionRepository', () => { let loId: LearningObjectIdentifier; it('should find all questions for a certain learning object and assignment', async () => { clazz = await getClassRepository().findById('8764b861-90a6-42e5-9732-c0d9eb2f55f9'); - assignment = await getAssignmentRepository().findByClassAndId(clazz!, 1); + assignment = await getAssignmentRepository().findByClassAndId(clazz!, 21000); loId = { hruid: 'id05', language: Language.English, From fc7a49d69bec948c15974f58f1efc7782cac00b6 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Fri, 18 Apr 2025 20:27:23 +0000 Subject: [PATCH 21/22] style: fix linting issues met Prettier --- backend/tests/data/assignments/assignments.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/tests/data/assignments/assignments.test.ts b/backend/tests/data/assignments/assignments.test.ts index 67b20eef..af55780d 100644 --- a/backend/tests/data/assignments/assignments.test.ts +++ b/backend/tests/data/assignments/assignments.test.ts @@ -35,7 +35,7 @@ describe('AssignmentRepository', () => { const result = await assignmentRepository.findAllByResponsibleTeacher('testleerkracht1'); const resultIds = result.map((it) => it.id).sort((a, b) => (a ?? 0) - (b ?? 0)); - expect(resultIds).toEqual([ 21000, 21002, 21003 ]); + expect(resultIds).toEqual([21000, 21002, 21003]); }); it('should not find removed assignment', async () => { From 460acb27c4fa35e513725bc2fd820c4883f95691 Mon Sep 17 00:00:00 2001 From: Adriaan Jacquet Date: Sat, 19 Apr 2025 13:49:37 +0200 Subject: [PATCH 22/22] fix: fixed test merge errors --- backend/tests/data/assignments/assignments.test.ts | 2 +- backend/tests/data/assignments/submissions.test.ts | 2 +- backend/tests/test_assets/assignments/assignments.testdata.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/tests/data/assignments/assignments.test.ts b/backend/tests/data/assignments/assignments.test.ts index af55780d..74c858b3 100644 --- a/backend/tests/data/assignments/assignments.test.ts +++ b/backend/tests/data/assignments/assignments.test.ts @@ -35,7 +35,7 @@ describe('AssignmentRepository', () => { const result = await assignmentRepository.findAllByResponsibleTeacher('testleerkracht1'); const resultIds = result.map((it) => it.id).sort((a, b) => (a ?? 0) - (b ?? 0)); - expect(resultIds).toEqual([21000, 21002, 21003]); + expect(resultIds).toEqual([21000, 21002, 21003, 21004]); }); it('should not find removed assignment', async () => { diff --git a/backend/tests/data/assignments/submissions.test.ts b/backend/tests/data/assignments/submissions.test.ts index 93b3261d..2bbd00dc 100644 --- a/backend/tests/data/assignments/submissions.test.ts +++ b/backend/tests/data/assignments/submissions.test.ts @@ -92,7 +92,7 @@ describe('SubmissionRepository', () => { }); it('should find only the submissions for a certain learning object and assignment made for the given group', async () => { - const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, 2); + const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, 21002); const result = await submissionRepository.findAllSubmissionsForLearningObjectAndGroup(loId, group!); expect(result).toHaveLength(1); diff --git a/backend/tests/test_assets/assignments/assignments.testdata.ts b/backend/tests/test_assets/assignments/assignments.testdata.ts index 29fa877e..337ec98f 100644 --- a/backend/tests/test_assets/assignments/assignments.testdata.ts +++ b/backend/tests/test_assets/assignments/assignments.testdata.ts @@ -48,7 +48,7 @@ export function makeTestAssignemnts(em: EntityManager, classes: Class[]): Assign conditionalPathAssignment = em.create(Assignment, { within: getClassWithTestleerlingAndTestleerkracht(), - id: 1, + id: 21004, title: 'Assignment: Conditional Learning Path', description: 'You have to do the testing learning path with a condition.', learningPathHruid: testLearningPathWithConditions.hruid,