Merge branch 'dev' into feat/assignment-page
# Conflicts: # backend/package.json # common/src/interfaces/assignment.ts # frontend/src/controllers/learning-paths.ts # frontend/src/i18n/locale/de.json # frontend/src/i18n/locale/en.json # frontend/src/i18n/locale/fr.json # frontend/src/i18n/locale/nl.json # frontend/src/views/assignments/CreateAssignment.vue # package-lock.json
This commit is contained in:
commit
a421b1996a
123 changed files with 2428 additions and 2658 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 {
|
||||
|
|
|
@ -1,35 +1,33 @@
|
|||
import {BaseController} from "@/controllers/base-controller.ts";
|
||||
import {LearningPath} from "@/data-objects/learning-paths/learning-path.ts";
|
||||
import type {Language} from "@/data-objects/language.ts";
|
||||
import {single} from "@/utils/response-assertions.ts";
|
||||
import type {LearningPathDTO} from "@/data-objects/learning-paths/learning-path-dto.ts";
|
||||
import { BaseController } from "@/controllers/base-controller.ts";
|
||||
import { LearningPath } from "@/data-objects/learning-paths/learning-path.ts";
|
||||
import type { Language } from "@/data-objects/language.ts";
|
||||
import { single } from "@/utils/response-assertions.ts";
|
||||
import type { LearningPathDTO } from "@/data-objects/learning-paths/learning-path-dto.ts";
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
async getAllByTheme(theme: string): Promise<LearningPath[]> {
|
||||
const dtos = await this.get<LearningPathDTO[]>("/", {theme});
|
||||
const dtos = await this.get<LearningPathDTO[]>("/", { theme });
|
||||
return dtos.map((dto) => LearningPath.fromDTO(dto));
|
||||
}
|
||||
|
||||
|
|
|
@ -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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue