fix: assignmentParam type errors gefixt
This commit is contained in:
parent
dbe7807f4a
commit
19317868c7
1 changed files with 4 additions and 9 deletions
|
@ -3,12 +3,7 @@ import { createAssignment, getAllAssignments, getAssignment, getAssignmentsSubmi
|
|||
import { AssignmentDTO } from '../interfaces/assignment.js';
|
||||
|
||||
// Typescript is annoy with with parameter forwarding from class.ts
|
||||
interface AssignmentParams {
|
||||
classid: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
export async function getAllAssignmentsHandler(req: Request<AssignmentParams>, res: Response): Promise<void> {
|
||||
export async function getAllAssignmentsHandler(req: Request, res: Response): Promise<void> {
|
||||
const classid = req.params.classid;
|
||||
const full = req.query.full === 'true';
|
||||
|
||||
|
@ -19,7 +14,7 @@ export async function getAllAssignmentsHandler(req: Request<AssignmentParams>, r
|
|||
});
|
||||
}
|
||||
|
||||
export async function createAssignmentHandler(req: Request<AssignmentParams>, res: Response): Promise<void> {
|
||||
export async function createAssignmentHandler(req: Request, res: Response): Promise<void> {
|
||||
const classid = req.params.classid;
|
||||
const assignmentData = req.body as AssignmentDTO;
|
||||
|
||||
|
@ -40,7 +35,7 @@ export async function createAssignmentHandler(req: Request<AssignmentParams>, re
|
|||
res.status(201).json({ assignment: assignment });
|
||||
}
|
||||
|
||||
export async function getAssignmentHandler(req: Request<AssignmentParams>, res: Response): Promise<void> {
|
||||
export async function getAssignmentHandler(req: Request, res: Response): Promise<void> {
|
||||
const id = +req.params.id;
|
||||
const classid = req.params.classid;
|
||||
|
||||
|
@ -59,7 +54,7 @@ export async function getAssignmentHandler(req: Request<AssignmentParams>, res:
|
|||
res.json(assignment);
|
||||
}
|
||||
|
||||
export async function getAssignmentsSubmissionsHandler(req: Request<AssignmentParams>, res: Response): Promise<void> {
|
||||
export async function getAssignmentsSubmissionsHandler(req: Request, res: Response): Promise<void> {
|
||||
const classid = req.params.classid;
|
||||
const assignmentNumber = +req.params.id;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue