File

apps/recallassess/recallassess-api/src/api/integration/dto/integration-pre-bat-analysis.dto.ts

Description

DTO for metadata - only learning_group_id and plj_position are required

Index

Properties

Properties

learning_group_id
Type : number
Decorators :
@Expose()
@ApiProperty({example: 1, description: 'Learning group ID'})
@IsInt()
@IsNotEmpty()
plj_position
Type : string
Decorators :
@Expose()
@ApiProperty({example: 'PRE_BAT', description: 'Assessment type - must be PRE_BAT or POST_BAT', enum: undefined})
@IsString()
@IsNotEmpty()
@IsIn(['PRE_BAT', 'POST_BAT'])
import { ApiProperty } from "@nestjs/swagger";
import { Exclude, Expose, Type } from "class-transformer";
import { IsArray, IsIn, IsInt, IsNotEmpty, IsString, ValidateNested } from "class-validator";

/**
 * DTO for metadata - only learning_group_id and plj_position are required
 */
@Exclude()
class MetadataDto {
  @Expose()
  @ApiProperty({ example: 1, description: "Learning group ID" })
  @IsInt()
  @IsNotEmpty()
  learning_group_id!: number;

  @Expose()
  @ApiProperty({
    example: "PRE_BAT",
    description: "Assessment type - must be PRE_BAT or POST_BAT",
    enum: ["PRE_BAT", "POST_BAT"],
  })
  @IsString()
  @IsNotEmpty()
  @IsIn(["PRE_BAT", "POST_BAT"])
  plj_position!: string;
}

/**
 * DTO for a single trainee - only participant_id and pre_report are required
 */
@Exclude()
class TraineeDto {
  @Expose()
  @ApiProperty({ example: 1, description: "Participant ID" })
  @IsInt()
  @IsNotEmpty()
  participant_id!: number;

  @Expose()
  @ApiProperty({
    example: "Your overall performance on this assessment is excellent...",
    description: "Pre-report text content",
  })
  @IsString()
  @IsNotEmpty()
  pre_report!: string;
}

/**
 * DTO for the result object
 */
@Exclude()
class ResultDto {
  @Expose()
  @ApiProperty({ type: MetadataDto })
  @ValidateNested()
  @Type(() => MetadataDto)
  metadata!: MetadataDto;

  @Expose()
  @ApiProperty({ type: [TraineeDto] })
  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => TraineeDto)
  trainees!: TraineeDto[];
}

/**
 * DTO for pre-bat-analysis endpoint
 * POST /api/integration/cr/pre-bat-analysis
 *
 * Accepts CodeRythm batch response with:
 * - result.metadata.learning_group_id (required)
 * - result.metadata.plj_position (required, must be "PRE_BAT" or "POST_BAT")
 * - result.trainees[] (required, array of { participant_id, pre_report })
 */
@Exclude()
export class IntegrationPreBatAnalysisDto {
  @Expose()
  @ApiProperty({
    description: "CodeRythm response structure with metadata and trainees array",
  })
  @ValidateNested()
  @Type(() => ResultDto)
  result!: ResultDto;
}

results matching ""

    No results matching ""