import { BaseController } from "./base-controller"; import type { AssignmentDTO } 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[]; } export interface AssignmentResponse { assignment: AssignmentDTO; } export class AssignmentController extends BaseController { constructor(classid: string) { super(`class/${classid}/assignments`); } async getAll(full = true): Promise { return this.get(`/`, { full }); } async getByNumber(num: number): Promise { return this.get(`/${num}`); } async createAssignment(data: AssignmentDTO): Promise { return this.post(`/`, data); } async deleteAssignment(num: number): Promise { return this.delete(`/${num}`); } async getSubmissions(assignmentNumber: number, full = true): Promise { return this.get(`/${assignmentNumber}/submissions`, { full }); } async getQuestions(assignmentNumber: number, full = true): Promise { return this.get(`/${assignmentNumber}/questions`, { full }); } async getGroups(assignmentNumber: number, full = true): Promise { return this.get(`/${assignmentNumber}/groups`, { full }); } }