import { BaseController } from "@/controllers/base-controller.ts"; import type { ClassesResponse } from "@/controllers/classes.ts"; import type { AssignmentsResponse } from "@/controllers/assignments.ts"; import type { GroupsResponse } from "@/controllers/groups.ts"; import type { SubmissionsResponse } from "@/controllers/submissions.ts"; import type { QuestionsResponse } from "@/controllers/questions.ts"; import type { StudentDTO } from "@dwengo-1/common/interfaces/student"; import type { ClassJoinRequestDTO } from "@dwengo-1/common/interfaces/class-join-request"; export interface StudentsResponse { students: StudentDTO[] | string[]; } export interface StudentResponse { student: StudentDTO; } export interface JoinRequestsResponse { requests: ClassJoinRequestDTO[]; } export interface JoinRequestResponse { request: ClassJoinRequestDTO; } export class StudentController extends BaseController { constructor() { super("student"); } async getAll(full = true): Promise { return this.get("/", { full }); } async getByUsername(username: string): Promise { return this.get(`/${username}`); } async createStudent(data: StudentDTO): Promise { return this.post("/", data); } async deleteStudent(username: string): Promise { return this.delete(`/${username}`); } async getClasses(username: string, full = true): Promise { return this.get(`/${username}/classes`, { full }); } async getAssignments(username: string, full = true): Promise { return this.get(`/${username}/assignments`, { full }); } async getGroups(username: string, full = true): Promise { return this.get(`/${username}/groups`, { full }); } async getSubmissions(username: string): Promise { return this.get(`/${username}/submissions`); } async getQuestions(username: string, full = true): Promise { return this.get(`/${username}/questions`, { full }); } async getJoinRequests(username: string): Promise { return this.get(`/${username}/joinRequests`); } async getJoinRequest(username: string, classId: string): Promise { return this.get(`/${username}/joinRequests/${classId}`); } async createJoinRequest(username: string, classId: string): Promise { return this.post(`/${username}/joinRequests}`, classId); } async deleteJoinRequest(username: string, classId: string): Promise { return this.delete(`/${username}/joinRequests/${classId}`); } }