import { BaseController } from "./base-controller"; 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[] | GroupDTOId[]; } export interface GroupResponse { group: GroupDTO; } export class GroupController extends BaseController { constructor(classid: string, assignmentNumber: number) { super(`class/${classid}/assignments/${assignmentNumber}/groups`); } async getAll(full = true): Promise { return this.get(`/`, { full }); } async getByNumber(num: number): Promise { return this.get(`/${num}`); } async createGroup(data: GroupDTO): Promise { return this.post(`/`, data); } async deleteGroup(num: number): Promise { return this.delete(`/${num}`); } async updateGroup(num: number, data: Partial): Promise { return this.put(`/${num}`, data); } async getSubmissions(num: number, full = true): Promise { return this.get(`/${num}/submissions`, { full }); } async getQuestions(num: number, full = true): Promise { return this.get(`/${num}/questions`, { full }); } }