fix: return type + any aangepast voor linter
This commit is contained in:
parent
f87c943530
commit
4bee95762b
4 changed files with 34 additions and 25 deletions
|
@ -2,6 +2,7 @@ import { BaseController } from "./base-controller";
|
|||
import type { ClassDTO } from "@dwengo-1/common/interfaces/class";
|
||||
import type { StudentsResponse } from "./students";
|
||||
import type { AssignmentsResponse } from "./assignments";
|
||||
import type { TeacherInvitationDTO } from "@dwengo-1/common/interfaces/teacher-invitation";
|
||||
|
||||
export interface ClassesResponse {
|
||||
classes: ClassDTO[] | string[];
|
||||
|
@ -11,37 +12,45 @@ export interface ClassResponse {
|
|||
class: ClassDTO;
|
||||
}
|
||||
|
||||
export interface TeacherInvitationsResponse {
|
||||
invites: TeacherInvitationDTO[];
|
||||
}
|
||||
|
||||
export interface TeacherInvitationResponse {
|
||||
invite: TeacherInvitationDTO;
|
||||
}
|
||||
|
||||
export class ClassController extends BaseController {
|
||||
constructor() {
|
||||
super("class");
|
||||
}
|
||||
|
||||
async getAll(full = true) {
|
||||
async getAll(full = true): Promise<ClassesResponse> {
|
||||
return this.get<ClassesResponse>(`/`, { full });
|
||||
}
|
||||
|
||||
async getById(id: string) {
|
||||
async getById(id: string): Promise<ClassResponse> {
|
||||
return this.get<ClassResponse>(`/${id}`);
|
||||
}
|
||||
|
||||
async createClass(data: any) {
|
||||
async createClass(data: ClassDTO): Promise<ClassResponse> {
|
||||
return this.post<ClassResponse>(`/`, data);
|
||||
}
|
||||
|
||||
async deleteClass(id: string) {
|
||||
async deleteClass(id: string): Promise<ClassResponse> {
|
||||
return this.delete<ClassResponse>(`/${id}`);
|
||||
}
|
||||
|
||||
async getStudents(id: string, full = true) {
|
||||
async getStudents(id: string, full = true): Promise<StudentsResponse> {
|
||||
return this.get<StudentsResponse>(`/${id}/students`, { full });
|
||||
}
|
||||
|
||||
// TODO
|
||||
async getTeacherInvitations(id: string, full = true) {
|
||||
return this.get<any>(`/${id}/teacher-invitations`, { full });
|
||||
async getTeacherInvitations(id: string, full = true): Promise<TeacherInvitationsResponse> {
|
||||
return this.get<TeacherInvitationsResponse>(`/${id}/teacher-invitations`, { full });
|
||||
}
|
||||
|
||||
async getAssignments(id: string, full = true) {
|
||||
async getAssignments(id: string, full = true): Promise<AssignmentsResponse> {
|
||||
return this.get<AssignmentsResponse>(`/${id}/assignments`, { full });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue