feat(frontend): "Volgende" en "vorige"-knop toegevoegd aan leerpadpagina.

This commit is contained in:
Gerald Schmittinger 2025-03-24 22:58:44 +01:00
parent 728b04c9d8
commit 4356a1ccd2
8 changed files with 112 additions and 22 deletions

View file

@ -3,16 +3,21 @@ import {LearningPath, type LearningPathDTO} from "@/services/learning-content/le
import type {Language} from "@/services/learning-content/language.ts";
import {single} from "@/utils/response-assertions.ts";
const learningPathEndpoint = new GetEndpoint<{}, {search?: string, hruid?: string, language?: Language}, LearningPathDTO[]>(
"/learningPath"
);
const learningPathEndpoint = new GetEndpoint<
{},
{search?: string, hruid?: string, language?: Language, forGroup?: string, forStudent?: string},
LearningPathDTO[]
>("/learningPath");
export async function searchLearningPaths(query: string): Promise<LearningPath[]> {
let dtos = await learningPathEndpoint.get({}, {search: query})
return dtos.map(dto => LearningPath.fromDTO(dto));
}
export async function getLearningPath(hruid: string, language: Language): Promise<LearningPath> {
let dtos = await learningPathEndpoint.get({}, {hruid, language});
export async function getLearningPath(hruid: string, language: Language, options?: {forGroup?: string, forStudent?: string}): Promise<LearningPath> {
let dtos = await learningPathEndpoint.get(
{},
{hruid, language, forGroup: options?.forGroup, forStudent: options?.forStudent}
);
return LearningPath.fromDTO(single(dtos));
}

View file

@ -49,7 +49,8 @@ export class LearningPathNode {
public readonly language: Language,
public readonly transitions: {next: LearningPathNode, default: boolean}[],
public readonly createdAt: Date,
public readonly updatedAt: Date
public readonly updatedAt: Date,
public readonly done: boolean = false
) {
}
@ -80,6 +81,7 @@ export class LearningPathNode {
}),
new Date(dto.created_at),
new Date(dto.updatedAt),
dto.done
)
}
}