fix: werkende aan assignment fix
This commit is contained in:
parent
45ca433e09
commit
69659426de
6 changed files with 44 additions and 21 deletions
|
@ -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<void> {
|
||||
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 });
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue