import { BaseController } from "@/controllers/base-controller.ts"; import type { JoinRequestResponse, JoinRequestsResponse, StudentsResponse } from "@/controllers/students.ts"; import type { QuestionsResponse } from "@/controllers/questions.ts"; import type { ClassesResponse } from "@/controllers/classes.ts"; import type { TeacherDTO } from "@dwengo-1/common/interfaces/teacher"; import type { AssignmentsResponse } from "./assignments"; export interface TeachersResponse { teachers: TeacherDTO[] | string[]; } export interface TeacherResponse { teacher: TeacherDTO; } export class TeacherController extends BaseController { constructor() { super("teacher"); } async getAll(full = false): Promise { return this.get("/", { full }); } async getByUsername(username: string): Promise { return this.get(`/${username}`); } async createTeacher(data: TeacherDTO): Promise { return this.post("/", data); } async deleteTeacher(username: string): Promise { return this.delete(`/${username}`); } async getClasses(username: string, full = false): Promise { return this.get(`/${username}/classes`, { full }); } async getAssignments(username: string, full = true): Promise { return this.get(`/${username}/assignments`, { full }); } async getStudents(username: string, full = false): Promise { return this.get(`/${username}/students`, { full }); } async getQuestions(username: string, full = false): Promise { return this.get(`/${username}/questions`, { full }); } async getStudentJoinRequests(username: string, classId: string): Promise { return this.get(`/${username}/joinRequests/${classId}`); } async updateStudentJoinRequest( teacherUsername: string, classId: string, studentUsername: string, accepted: boolean, ): Promise { return this.put(`/${teacherUsername}/joinRequests/${classId}/${studentUsername}`, { accepted, }); } // GetInvitations(id: string) {return this.get<{ invitations: string[] }>(`/${id}/invitations`);} }