Merge branch 'dev' into test/linking
This commit is contained in:
		
						commit
						906eb36fec
					
				
					 153 changed files with 3579 additions and 3184 deletions
				
			
		|  | @ -1,11 +1,11 @@ | |||
| import { BaseController } from "./base-controller"; | ||||
| import type { AssignmentDTO } from "@dwengo-1/common/interfaces/assignment"; | ||||
| import type { AssignmentDTO, AssignmentDTOId } from "@dwengo-1/common/interfaces/assignment"; | ||||
| import type { SubmissionsResponse } from "./submissions"; | ||||
| import type { QuestionsResponse } from "./questions"; | ||||
| import type { GroupsResponse } from "./groups"; | ||||
| 
 | ||||
| export interface AssignmentsResponse { | ||||
|     assignments: AssignmentDTO[] | string[]; | ||||
|     assignments: AssignmentDTO[] | AssignmentDTOId[]; | ||||
| } | ||||
| 
 | ||||
| export interface AssignmentResponse { | ||||
|  |  | |||
|  | @ -1,10 +1,10 @@ | |||
| import { BaseController } from "./base-controller"; | ||||
| import type { GroupDTO } from "@dwengo-1/common/interfaces/group"; | ||||
| import type { GroupDTO, GroupDTOId } from "@dwengo-1/common/interfaces/group"; | ||||
| import type { SubmissionsResponse } from "./submissions"; | ||||
| import type { QuestionsResponse } from "./questions"; | ||||
| 
 | ||||
| export interface GroupsResponse { | ||||
|     groups: GroupDTO[]; | ||||
|     groups: GroupDTO[] | GroupDTOId[]; | ||||
| } | ||||
| 
 | ||||
| export interface GroupResponse { | ||||
|  |  | |||
|  | @ -8,20 +8,21 @@ export class LearningPathController extends BaseController { | |||
|     constructor() { | ||||
|         super("learningPath"); | ||||
|     } | ||||
|     async search(query: string): Promise<LearningPath[]> { | ||||
|         const dtos = await this.get<LearningPathDTO[]>("/", { search: query }); | ||||
|     async search(query: string, language: string): Promise<LearningPath[]> { | ||||
|         const dtos = await this.get<LearningPathDTO[]>("/", { search: query, language }); | ||||
|         return dtos.map((dto) => LearningPath.fromDTO(dto)); | ||||
|     } | ||||
|     async getBy( | ||||
|         hruid: string, | ||||
|         language: Language, | ||||
|         options?: { forGroup?: string; forStudent?: string }, | ||||
|         forGroup?: { forGroup: number; assignmentNo: number; classId: string }, | ||||
|     ): Promise<LearningPath> { | ||||
|         const dtos = await this.get<LearningPathDTO[]>("/", { | ||||
|             hruid, | ||||
|             language, | ||||
|             forGroup: options?.forGroup, | ||||
|             forStudent: options?.forStudent, | ||||
|             forGroup: forGroup?.forGroup, | ||||
|             assignmentNo: forGroup?.assignmentNo, | ||||
|             classId: forGroup?.classId, | ||||
|         }); | ||||
|         return LearningPath.fromDTO(single(dtos)); | ||||
|     } | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ export interface StudentResponse { | |||
|     student: StudentDTO; | ||||
| } | ||||
| export interface JoinRequestsResponse { | ||||
|     requests: ClassJoinRequestDTO[]; | ||||
|     joinRequests: ClassJoinRequestDTO[]; | ||||
| } | ||||
| export interface JoinRequestResponse { | ||||
|     request: ClassJoinRequestDTO; | ||||
|  |  | |||
|  | @ -1,5 +1,6 @@ | |||
| import { BaseController } from "./base-controller"; | ||||
| import type { SubmissionDTO, SubmissionDTOId } from "@dwengo-1/common/interfaces/submission"; | ||||
| import type { Language } from "@dwengo-1/common/util/language"; | ||||
| 
 | ||||
| export interface SubmissionsResponse { | ||||
|     submissions: SubmissionDTO[] | SubmissionDTOId[]; | ||||
|  | @ -10,16 +11,36 @@ export interface SubmissionResponse { | |||
| } | ||||
| 
 | ||||
| export class SubmissionController extends BaseController { | ||||
|     constructor(classid: string, assignmentNumber: number, groupNumber: number) { | ||||
|         super(`class/${classid}/assignments/${assignmentNumber}/groups/${groupNumber}/submissions`); | ||||
|     constructor(hruid: string) { | ||||
|         super(`learningObject/${hruid}/submissions`); | ||||
|     } | ||||
| 
 | ||||
|     async getAll(full = true): Promise<SubmissionsResponse> { | ||||
|         return this.get<SubmissionsResponse>(`/`, { full }); | ||||
|     async getAll( | ||||
|         language: Language, | ||||
|         version: number, | ||||
|         classId: string, | ||||
|         assignmentId: number, | ||||
|         groupId?: number, | ||||
|         full = true, | ||||
|     ): Promise<SubmissionsResponse> { | ||||
|         return this.get<SubmissionsResponse>(`/`, { language, version, classId, assignmentId, groupId, full }); | ||||
|     } | ||||
| 
 | ||||
|     async getByNumber(submissionNumber: number): Promise<SubmissionResponse> { | ||||
|         return this.get<SubmissionResponse>(`/${submissionNumber}`); | ||||
|     async getByNumber( | ||||
|         language: Language, | ||||
|         version: number, | ||||
|         classId: string, | ||||
|         assignmentId: number, | ||||
|         groupId: number, | ||||
|         submissionNumber: number, | ||||
|     ): Promise<SubmissionResponse> { | ||||
|         return this.get<SubmissionResponse>(`/${submissionNumber}`, { | ||||
|             language, | ||||
|             version, | ||||
|             classId, | ||||
|             assignmentId, | ||||
|             groupId, | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     async createSubmission(data: SubmissionDTO): Promise<SubmissionResponse> { | ||||
|  |  | |||
|  | @ -11,10 +11,11 @@ export interface TeacherInvitationResponse { | |||
| 
 | ||||
| export class TeacherInvitationController extends BaseController { | ||||
|     constructor() { | ||||
|         super("teachers/invitations"); | ||||
|         super("teacher/invitations"); | ||||
|     } | ||||
| 
 | ||||
|     async getAll(username: string, sent: boolean): Promise<TeacherInvitationsResponse> { | ||||
|     async getAll(username: string, s: boolean): Promise<TeacherInvitationsResponse> { | ||||
|         const sent = s.toString(); | ||||
|         return this.get<TeacherInvitationsResponse>(`/${username}`, { sent }); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -54,10 +54,9 @@ export class TeacherController extends BaseController { | |||
|         studentUsername: string, | ||||
|         accepted: boolean, | ||||
|     ): Promise<JoinRequestResponse> { | ||||
|         return this.put<JoinRequestResponse>( | ||||
|             `/${teacherUsername}/joinRequests/${classId}/${studentUsername}`, | ||||
|         return this.put<JoinRequestResponse>(`/${teacherUsername}/joinRequests/${classId}/${studentUsername}`, { | ||||
|             accepted, | ||||
|         ); | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     // GetInvitations(id: string) {return this.get<{ invitations: string[] }>(`/${id}/invitations`);}
 | ||||
|  |  | |||
		Reference in a new issue