refactor: type responses
This commit is contained in:
parent
8ceed7f779
commit
075616b67b
9 changed files with 221 additions and 144 deletions
|
@ -1,3 +1,3 @@
|
|||
import type {AssignmentDTO} from "dwengo-1-common/src/interfaces/assignment";
|
||||
|
||||
export type AssignmentsResponse = { assignments: AssignmentDTO[] }; // TODO ID
|
||||
export interface AssignmentsResponse { assignments: AssignmentDTO[] } // TODO ID
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import type {ClassDTO} from "dwengo-1-common/src/interfaces/class";
|
||||
|
||||
export type ClassesResponse = { classes: ClassDTO[] | string[] };
|
||||
export interface ClassesResponse { classes: ClassDTO[] | string[] }
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import type {GroupDTO} from "dwengo-1-common/src/interfaces/group";
|
||||
|
||||
export type GroupsResponse = { groups: GroupDTO[] }; // | TODO id
|
||||
export interface GroupsResponse { groups: GroupDTO[] } // | TODO id
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import type {QuestionDTO, QuestionId} from "dwengo-1-common/src/interfaces/question";
|
||||
|
||||
export type QuestionsResponse = { questions: QuestionDTO[] | QuestionId[] }
|
||||
export interface QuestionsResponse { questions: QuestionDTO[] | QuestionId[] }
|
||||
|
|
|
@ -7,10 +7,10 @@ import type {SubmissionsResponse} from "@/controllers/submissions.ts";
|
|||
import type {QuestionsResponse} from "@/controllers/questions.ts";
|
||||
import type {ClassJoinRequestDTO} from "dwengo-1-common/src/interfaces/class-join-request";
|
||||
|
||||
export type StudentsResponse = { students: StudentDTO[] | string[] };
|
||||
export type StudentResponse = { student: StudentDTO };
|
||||
export type JoinRequestsResponse = { requests: ClassJoinRequestDTO[] };
|
||||
export type JoinRequestResponse = { request: ClassJoinRequestDTO };
|
||||
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 {
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import {type SubmissionDTO, SubmissionDTOId} from "dwengo-1-common/src/interfaces/submission";
|
||||
|
||||
export type SubmissionsResponse = { submissions: SubmissionDTO[] | SubmissionDTOId[] };
|
||||
export interface SubmissionsResponse { submissions: SubmissionDTO[] | SubmissionDTOId[] }
|
||||
|
|
|
@ -4,8 +4,8 @@ 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 interface TeachersResponse { teachers: TeacherDTO[] | string[] }
|
||||
export interface TeacherResponse { teacher: TeacherDTO | string }
|
||||
|
||||
|
||||
export class TeacherController extends BaseController {
|
||||
|
@ -21,7 +21,7 @@ export class TeacherController extends BaseController {
|
|||
return this.get<TeacherResponse>(`/${username}`);
|
||||
}
|
||||
|
||||
async createTeacher(data: any): Promise<TeacherResponse> {
|
||||
async createTeacher(data: TeacherDTO): Promise<TeacherResponse> {
|
||||
return this.post<TeacherResponse>("/", data);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue