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/src/interfaces/teacher"; export type TeachersResponse = { teachers: TeacherDTO[] | string[] }; export type TeacherResponse = { teacher: TeacherDTO | string }; 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: any): 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 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`);} }