404 lines
9.1 KiB
TypeScript
404 lines
9.1 KiB
TypeScript
import type { Circle } from "@/services/circle";
|
|
import type { Component } from "vue";
|
|
|
|
export type CourseCompletionStatus = "unknown" | "fail" | "success";
|
|
|
|
export interface BaseCourseWagtailPage {
|
|
readonly id: number;
|
|
readonly title: string;
|
|
readonly slug: string;
|
|
readonly type: string;
|
|
readonly translation_key: string;
|
|
readonly frontend_url: string;
|
|
completion_status?: CourseCompletionStatus;
|
|
completion_status_updated_at?: string;
|
|
}
|
|
|
|
export interface CircleLight {
|
|
readonly id: number;
|
|
readonly title: string;
|
|
readonly translation_key: string;
|
|
}
|
|
|
|
export interface BaseLearningContentBlock {
|
|
readonly type: string;
|
|
readonly id: string;
|
|
readonly value: {
|
|
description: string;
|
|
url: string;
|
|
text?: string;
|
|
};
|
|
}
|
|
|
|
export interface AssignmentBlock extends BaseLearningContentBlock {
|
|
readonly type: "assignment";
|
|
}
|
|
|
|
export interface BookBlock extends BaseLearningContentBlock {
|
|
readonly type: "book";
|
|
}
|
|
|
|
export interface DocumentBlock extends BaseLearningContentBlock {
|
|
readonly type: "document";
|
|
}
|
|
|
|
export interface ExerciseBlock extends BaseLearningContentBlock {
|
|
readonly type: "exercise";
|
|
}
|
|
|
|
export interface MediaLibraryBlock extends BaseLearningContentBlock {
|
|
readonly type: "media_library";
|
|
}
|
|
|
|
export interface OnlineTrainingBlock extends BaseLearningContentBlock {
|
|
readonly type: "online_training";
|
|
}
|
|
|
|
export interface ResourceBlock extends BaseLearningContentBlock {
|
|
readonly type: "resource";
|
|
}
|
|
|
|
export interface TestBlock extends BaseLearningContentBlock {
|
|
readonly type: "test";
|
|
}
|
|
|
|
export interface VideoBlock extends BaseLearningContentBlock {
|
|
readonly type: "video";
|
|
}
|
|
|
|
export interface LearningModuleBlock extends BaseLearningContentBlock {
|
|
readonly type: "learningmodule";
|
|
}
|
|
|
|
export interface PlaceholderBlock extends BaseLearningContentBlock {
|
|
readonly type: "placeholder";
|
|
}
|
|
|
|
export interface FeedbackBlock extends BaseLearningContentBlock {
|
|
readonly type: "feedback";
|
|
}
|
|
|
|
export type LearningContentBlock =
|
|
| AssignmentBlock
|
|
| BookBlock
|
|
| DocumentBlock
|
|
| ExerciseBlock
|
|
| MediaLibraryBlock
|
|
| OnlineTrainingBlock
|
|
| ResourceBlock
|
|
| TestBlock
|
|
| VideoBlock
|
|
| LearningModuleBlock
|
|
| PlaceholderBlock
|
|
| FeedbackBlock;
|
|
|
|
export type LearningContentType = LearningContentBlock["type"];
|
|
|
|
export interface LearningContent extends BaseCourseWagtailPage {
|
|
readonly type: "learnpath.LearningContent";
|
|
minutes: number;
|
|
contents: LearningContentBlock[];
|
|
parentCircle: Circle;
|
|
parentLearningSequence?: LearningSequence;
|
|
parentLearningUnit?: LearningUnit;
|
|
nextLearningContent?: LearningContent;
|
|
previousLearningContent?: LearningContent;
|
|
}
|
|
|
|
export interface LearningUnitPerformanceCriteria extends BaseCourseWagtailPage {
|
|
readonly type: "competence.PerformanceCriteria";
|
|
readonly competence_id: string;
|
|
parentLearningSequence?: LearningSequence;
|
|
parentLearningUnit?: LearningUnit;
|
|
}
|
|
|
|
export interface LearningUnit extends BaseCourseWagtailPage {
|
|
readonly type: "learnpath.LearningUnit";
|
|
readonly evaluate_url: string;
|
|
readonly course_category: CourseCategory;
|
|
children: LearningUnitPerformanceCriteria[];
|
|
|
|
// additional frontend fields
|
|
learningContents: LearningContent[];
|
|
minutes: number;
|
|
parentLearningSequence?: LearningSequence;
|
|
parentCircle?: Circle;
|
|
last?: boolean;
|
|
}
|
|
|
|
export interface LearningSequence extends BaseCourseWagtailPage {
|
|
readonly type: "learnpath.LearningSequence";
|
|
icon: string;
|
|
learningUnits: LearningUnit[];
|
|
minutes: number;
|
|
}
|
|
|
|
export type CircleChild = LearningContent | LearningUnit | LearningSequence;
|
|
|
|
export interface WagtailLearningPath extends BaseCourseWagtailPage {
|
|
readonly type: "learnpath.LearningPath";
|
|
course: Course;
|
|
children: LearningPathChild[];
|
|
}
|
|
|
|
export interface CircleGoal {
|
|
type: "goal";
|
|
value: string;
|
|
id: string;
|
|
}
|
|
|
|
export interface CircleJobSituation {
|
|
type: "job_situation";
|
|
value: string;
|
|
id: string;
|
|
}
|
|
|
|
export interface WagtailCircle extends BaseCourseWagtailPage {
|
|
readonly type: "learnpath.Circle";
|
|
readonly description: string;
|
|
readonly goal_description: string;
|
|
readonly goals: CircleGoal[];
|
|
readonly job_situation_description: string;
|
|
readonly job_situations: CircleJobSituation[];
|
|
readonly children: CircleChild[];
|
|
}
|
|
|
|
export interface Topic extends BaseCourseWagtailPage {
|
|
readonly type: "learnpath.Topic";
|
|
readonly is_visible: boolean;
|
|
circles: Circle[];
|
|
}
|
|
|
|
export type LearningPathChild = Topic | WagtailCircle;
|
|
|
|
export interface CourseCompletion {
|
|
id: number;
|
|
created_at: string;
|
|
updated_at: string;
|
|
user: number;
|
|
page_key: string;
|
|
page_type: string;
|
|
page_slug: string;
|
|
course: number;
|
|
completion_status: CourseCompletionStatus;
|
|
additional_json_data: unknown;
|
|
}
|
|
|
|
export interface CircleDiagramData {
|
|
index: number;
|
|
title: string;
|
|
icon: string;
|
|
startAngle: number;
|
|
endAngle: number;
|
|
arrowStartAngle: number;
|
|
arrowEndAngle: number;
|
|
done: boolean;
|
|
}
|
|
|
|
export interface Course {
|
|
id: number;
|
|
title: string;
|
|
category_name: string;
|
|
slug: string;
|
|
}
|
|
|
|
export interface CourseCategory {
|
|
id: number;
|
|
name: string;
|
|
general: boolean;
|
|
}
|
|
|
|
export type MediaLibraryContentBlockValue = {
|
|
title: string;
|
|
description: string;
|
|
icon_url: string;
|
|
link_display_text: string;
|
|
url: string;
|
|
open_window: boolean;
|
|
};
|
|
|
|
export interface LearnMediaBlock {
|
|
type: "learn_media";
|
|
id: string;
|
|
value: MediaLibraryContentBlockValue;
|
|
}
|
|
|
|
export interface ExternalLinkBlock {
|
|
type: "external_link";
|
|
id: string;
|
|
value: MediaLibraryContentBlockValue;
|
|
}
|
|
|
|
export interface InternalLinkBlock {
|
|
type: "internal_link";
|
|
id: string;
|
|
value: MediaLibraryContentBlockValue;
|
|
}
|
|
|
|
export interface RelativeLinkBlock {
|
|
type: "relative_link";
|
|
id: string;
|
|
value: MediaLibraryContentBlockValue;
|
|
}
|
|
|
|
export type MediaBlock =
|
|
| LearnMediaBlock
|
|
| ExternalLinkBlock
|
|
| InternalLinkBlock
|
|
| RelativeLinkBlock;
|
|
|
|
export type MediaBlockType = MediaBlock["type"];
|
|
|
|
export interface MediaContentCollection {
|
|
type: "content_collection";
|
|
value: {
|
|
title: string;
|
|
description: string;
|
|
contents: MediaBlock[];
|
|
};
|
|
}
|
|
|
|
export interface MediaCategoryPage extends BaseCourseWagtailPage {
|
|
type: "media_library.MediaCategoryPage";
|
|
overview_icon: string;
|
|
detail_image: string;
|
|
introduction_text: string;
|
|
description_title: string;
|
|
description_text: string;
|
|
items: {
|
|
type: "item";
|
|
value: string;
|
|
id: string;
|
|
}[];
|
|
course_category: CourseCategory;
|
|
body: MediaContentCollection[];
|
|
}
|
|
|
|
export interface MediaLibraryPage extends BaseCourseWagtailPage {
|
|
readonly type: "media_library.MediaLibraryPage";
|
|
readonly course: Course;
|
|
readonly children: MediaCategoryPage[];
|
|
}
|
|
|
|
export interface PerformanceCriteria extends BaseCourseWagtailPage {
|
|
readonly type: "competence.PerformanceCriteria";
|
|
readonly competence_id: string;
|
|
readonly circle: CircleLight;
|
|
readonly course_category: CourseCategory;
|
|
readonly learning_unit: BaseCourseWagtailPage;
|
|
}
|
|
|
|
export interface CompetencePage extends BaseCourseWagtailPage {
|
|
readonly type: "competence.CompetencePage";
|
|
readonly competence_id: string;
|
|
readonly children: PerformanceCriteria[];
|
|
}
|
|
|
|
export interface CompetenceProfilePage extends BaseCourseWagtailPage {
|
|
readonly type: "competence.CompetenceProfilePage";
|
|
readonly course: Course;
|
|
readonly circles: CircleLight[];
|
|
readonly children: CompetencePage[];
|
|
}
|
|
|
|
// dropdown
|
|
export interface DropdownListItem {
|
|
title: string;
|
|
icon: Component;
|
|
data: object;
|
|
}
|
|
|
|
export interface DropdownSelectable {
|
|
id: number | string;
|
|
name: string;
|
|
iconName?: string;
|
|
}
|
|
|
|
export interface CircleExpert {
|
|
user_id: number;
|
|
user_email: string;
|
|
user_first_name: string;
|
|
user_last_name: string;
|
|
circle_id: number;
|
|
circle_slug: string;
|
|
circle_translation_key: string;
|
|
}
|
|
|
|
export interface CircleDocument {
|
|
id: number;
|
|
name: string;
|
|
file_name: string;
|
|
url: string;
|
|
course_session: number;
|
|
learning_sequence: number;
|
|
}
|
|
|
|
export interface CourseSession {
|
|
id: number;
|
|
created_at: string;
|
|
updated_at: string;
|
|
course: Course;
|
|
title: string;
|
|
start_date: string;
|
|
end_date: string;
|
|
learning_path_url: string;
|
|
competence_url: string;
|
|
course_url: string;
|
|
media_library_url: string;
|
|
additional_json_data: unknown;
|
|
documents: CircleDocument[];
|
|
users: CourseSessionUser[];
|
|
}
|
|
|
|
export type Role = "MEMBER" | "EXPERT" | "TUTOR";
|
|
|
|
export interface CourseSessionUser {
|
|
session_title: string;
|
|
user_id: number;
|
|
first_name: string;
|
|
last_name: string;
|
|
email: string;
|
|
avatar_url: string;
|
|
role: Role;
|
|
}
|
|
|
|
export interface ExpertSessionUser extends CourseSessionUser {
|
|
role: "EXPERT";
|
|
circles: {
|
|
id: number;
|
|
title: string;
|
|
slug: string;
|
|
translation_key: string;
|
|
}[];
|
|
}
|
|
|
|
// document upload
|
|
export interface DocumentUploadData {
|
|
file: File | null;
|
|
name: string;
|
|
learningSequence: {
|
|
id: number;
|
|
name: string;
|
|
};
|
|
}
|
|
|
|
// notifications
|
|
|
|
export type NotificationType = "USER_INTERACTION" | "PROGRESS" | "INFORMATION";
|
|
|
|
export interface Notification {
|
|
// given by AbstractNotification model
|
|
id: number;
|
|
timestamp: string;
|
|
unread: boolean;
|
|
actor: string | null;
|
|
verb: string;
|
|
target: string | null;
|
|
action_object: string | null;
|
|
// given by Notification model
|
|
notification_type: NotificationType;
|
|
target_url: string | null;
|
|
actor_avatar_url: string | null;
|
|
course: string | null;
|
|
}
|