File

apps/recallassess/recallassess-api/src/api/admin/course-module-page/dto/course-module-page-save-when-enrolled.dto.ts

Description

Save payload when the linked course has at least one enrollment. Course, course module, and content type are not part of this DTO — they cannot be changed via API.

Index

Properties

Properties

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 { BatAnswerLevel, 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";

/**
 * Save payload when the linked course has at least one enrollment.
 * Course, course module, and content type are not part of this DTO — they cannot be changed via API.
 */
@Exclude()
export class CourseModulePageSaveWhenEnrolledDto {
  @Expose() @IsNotEmpty() @IsString() title!: string;

  @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;
}

results matching ""

    No results matching ""