File
Description
Full save payload when the linked course has no enrollments:
course, course module, and content type may be updated.
|
content_type
|
Type : ContentType
|
Decorators :
@Expose() @IsNotEmpty() @IsEnum(ContentType)
|
|
|
|
course
|
Type : Course
|
Decorators :
@Transform( => ) @Expose()
|
|
|
|
courseModule
|
Type : CourseModule
|
Decorators :
@Transform( => ) @Expose()
|
|
|
|
Optional
difficulty_level
|
Type : DifficultyLevel | null
|
Decorators :
@Expose() @Transform( => ) @IsOptional() @IsIn(['undefined'])
|
|
|
General per-page difficulty (Foundation / Intermediate / Advanced / Expert) — shown to participants.
|
|
Optional
flag
|
Type : boolean
|
Decorators :
@Expose() @IsOptional() @IsBoolean()
|
|
|
|
Optional
is_published
|
Type : boolean
|
Decorators :
@Expose() @IsOptional() @IsBoolean()
|
|
|
|
Optional
knowledge_review_id
|
Type : number
|
Decorators :
@Expose() @IsOptional() @IsInt()
|
|
|
|
Optional
outline
|
Type : string
|
Decorators :
@Expose() @IsOptional() @IsString()
|
|
|
|
Optional
quiz_difficulty_level
|
Type : BatAnswerLevel | null
|
Decorators :
@Expose() @Transform( => ) @IsOptional() @IsEnum(BatAnswerLevel)
|
|
|
Empty string from Select must become null or @IsEnum fails (422).
|
|
Optional
sort_order
|
Type : number
|
Decorators :
@Expose() @IsOptional() @IsInt()
|
|
|
|
Optional
time_frame
|
Type : string
|
Decorators :
@Expose() @IsOptional() @IsString()
|
|
|
|
title
|
Type : string
|
Decorators :
@Expose() @IsNotEmpty() @IsString()
|
|
|
|
Optional
top_tips
|
Type : string
|
Decorators :
@Expose() @IsOptional() @IsString()
|
|
|
|
Optional
topic_objectives
|
Type : string
|
Decorators :
@Expose() @IsOptional() @IsString()
|
|
|
import { getConnectedRel } from "@bish-nest/core/utils/dto.util";
import { BatAnswerLevel, ContentType, Course, CourseModule, DifficultyLevel } from "@prisma/client";
import { Exclude, Expose, Transform } from "class-transformer";
import { IsBoolean, IsEnum, IsIn, IsInt, IsNotEmpty, IsOptional, IsString } from "class-validator";
import { COURSE_MODULE_PAGE_DIFFICULTY_LEVEL_VALUES } from "./course-module-page-difficulty-level.constants";
/**
* Full save payload when the linked course has **no** enrollments:
* course, course module, and content type may be updated.
*/
@Exclude()
export class CourseModulePageSaveDto {
@Transform(({ obj }) => getConnectedRel(obj, obj.course_id, "course"))
@Expose()
course!: Course;
@Transform(({ obj }) => getConnectedRel(obj, obj.course_module_id, "course_module"))
@Expose()
courseModule!: CourseModule;
@Expose() @IsNotEmpty() @IsString() title!: string;
@Expose() @IsNotEmpty() @IsEnum(ContentType) content_type!: ContentType;
@Expose() @IsOptional() @IsString() outline?: string;
@Expose() @IsOptional() @IsString() topic_objectives?: string;
@Expose() @IsOptional() @IsString() top_tips?: string;
@Expose() @IsOptional() @IsInt() knowledge_review_id?: number;
/** Empty string from Select must become null or @IsEnum fails (422). */
@Expose()
@Transform(({ value }) => (value === "" ? null : value))
@IsOptional()
@IsEnum(BatAnswerLevel)
quiz_difficulty_level?: BatAnswerLevel | null;
/** General per-page difficulty (Foundation / Intermediate / Advanced / Expert) — shown to participants. */
@Expose()
@Transform(({ value }) => (value === "" ? null : value))
@IsOptional()
@IsIn([...COURSE_MODULE_PAGE_DIFFICULTY_LEVEL_VALUES])
difficulty_level?: DifficultyLevel | null;
@Expose() @IsOptional() @IsInt() sort_order?: number;
@Expose() @IsOptional() @IsBoolean() is_published?: boolean;
@Expose() @IsOptional() @IsString() time_frame?: string;
@Expose() @IsOptional() @IsBoolean() flag?: boolean;
}