File

apps/recallassess/recallassess-api/src/api/client/learning-group/dto/learning-group.dto.ts

Description

DTO for learning group response (license allocation)

Index

Properties

Properties

Optional allocationDate
Type : Date | null
Decorators :
@Expose()
@Transform( => )
@ApiPropertyOptional({description: 'When this license allocation was created'})
Optional completionDate
Type : Date | null
Decorators :
@Expose()
@Transform( => )
@ApiPropertyOptional({description: 'Completion date'})
Optional completionPercentage
Type : number | null
Decorators :
@Expose()
@Transform( => )
@ApiPropertyOptional({description: 'Completion percentage'})
courseId
Type : number
Decorators :
@Expose()
@Transform( => )
@ApiProperty({description: 'Course ID'})
Optional courseName
Type : string
Decorators :
@Expose()
@ApiPropertyOptional({description: 'Course name'})
Optional description
Type : string | null
Decorators :
@Expose()
@ApiPropertyOptional({description: 'Learning group description'})
Optional expectedCompletionDate
Type : Date | null
Decorators :
@Expose()
@Transform( => )
@ApiPropertyOptional({description: 'Expected completion/due date'})
id
Type : number
Decorators :
@Expose()
@ApiProperty({description: 'Learning group ID'})
isCompleted
Type : boolean
Decorators :
@Expose()
@Transform( => )
@ApiProperty({description: 'Whether the group has completed the course'})
name
Type : string
Decorators :
@Expose()
@ApiProperty({description: 'Learning group name'})
Optional participantGroupId
Type : number | null
Decorators :
@Expose()
@Transform( => )
@ApiPropertyOptional({description: 'Participant group ID'})
Optional participantGroupName
Type : string | null
Decorators :
@Expose()
@Transform( => )
@ApiPropertyOptional({description: 'Participant group/Team name'})
Optional participantInitials
Type : string[]
Decorators :
@Expose()
@Transform( => )
@ApiPropertyOptional({description: 'Full initials per learning group participant (e.g. ['JD', 'MK'])', type: undefined})
participantsCompleted
Type : number
Decorators :
@Expose()
@Transform( => )
@ApiProperty({description: 'Number of participants who completed'})
Optional participantSummaries
Type : Array<literal type>
Decorators :
@Expose()
@Transform( => )
@ApiPropertyOptional({description: 'Per-participant summary for tooltips: initials, fullName, email', type: 'array', items: undefined})
Optional startDate
Type : Date | null
Decorators :
@Expose()
@ApiPropertyOptional({description: 'Start date'})
Optional status
Type : string
Decorators :
@Expose()
@Transform( => )
@ApiPropertyOptional({description: 'Learning group status', enum: undefined})
totalParticipants
Type : number
Decorators :
@Expose()
@Transform( => )
@ApiProperty({description: 'Total number of participants'})
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { Exclude, Expose, Transform } from "class-transformer";

/**
 * DTO for learning group response (license allocation)
 */
@Exclude()
export class CLLearningGroupDto {
  @Expose()
  @ApiProperty({ description: "Learning group ID" })
  id!: number;

  @Expose()
  @ApiProperty({ description: "Learning group name" })
  name!: string;

  @Expose()
  @ApiPropertyOptional({ description: "Learning group description" })
  description?: string | null;

  @Expose()
  @Transform(({ obj }) => obj.course_id ?? obj.courseId)
  @ApiProperty({ description: "Course ID" })
  courseId!: number;

  @Expose()
  @ApiPropertyOptional({ description: "Course name" })
  courseName?: string;

  @Expose()
  @ApiPropertyOptional({ description: "Start date" })
  startDate?: Date | null;

  @Expose()
  @Transform(({ obj }) => obj.due_date ?? obj.expectedCompletionDate ?? null)
  @ApiPropertyOptional({ description: "Expected completion/due date" })
  expectedCompletionDate?: Date | null;

  @Expose()
  @Transform(({ obj }) => obj.status ?? "PENDING")
  @ApiPropertyOptional({ description: "Learning group status", enum: ["PENDING", "ACTIVE", "COMPLETED", "CANCELLED"] })
  status?: string;

  @Expose()
  @Transform(({ obj }) => obj.participant_group_id ?? obj.participantGroupId ?? null)
  @ApiPropertyOptional({ description: "Participant group ID" })
  participantGroupId?: number | null;

  @Expose()
  @Transform(({ obj }) => obj.participant_group_name ?? obj.participantGroupName ?? null)
  @ApiPropertyOptional({ description: "Participant group/Team name" })
  participantGroupName?: string | null;

  @Expose()
  @Transform(({ obj }) => obj.participantInitials ?? [])
  @ApiPropertyOptional({
    description: "Full initials per learning group participant (e.g. ['JD', 'MK'])",
    type: [String],
  })
  participantInitials?: string[];

  @Expose()
  @Transform(({ obj }) => obj.participantSummaries ?? [])
  @ApiPropertyOptional({
    description: "Per-participant summary for tooltips: initials, fullName, email",
    type: "array",
    items: {
      type: "object",
      properties: {
        initials: { type: "string" },
        fullName: { type: "string" },
        email: { type: "string" },
      },
    },
  })
  participantSummaries?: Array<{ initials: string; fullName: string; email: string }>;

  @Expose()
  @Transform(({ obj }) => obj.total_participants ?? obj.totalParticipants ?? 0)
  @ApiProperty({ description: "Total number of participants" })
  totalParticipants!: number;

  @Expose()
  @Transform(({ obj }) => obj.participants_completed ?? obj.participantsCompleted ?? 0)
  @ApiProperty({ description: "Number of participants who completed" })
  participantsCompleted!: number;

  @Expose()
  @Transform(({ obj }) => {
    const raw = obj.completion_percentage ?? obj.completionPercentage;
    return raw != null ? Number(raw) : null;
  })
  @ApiPropertyOptional({ description: "Completion percentage" })
  completionPercentage?: number | null;

  @Expose()
  @Transform(({ obj }) => obj.is_completed ?? obj.isCompleted ?? false)
  @ApiProperty({ description: "Whether the group has completed the course" })
  isCompleted!: boolean;

  @Expose()
  @Transform(({ obj }) => obj.completion_date ?? obj.completionDate ?? null)
  @ApiPropertyOptional({ description: "Completion date" })
  completionDate?: Date | null;

  @Expose()
  @Transform(({ obj }) => obj.created_at ?? obj.allocationDate ?? null)
  @ApiPropertyOptional({ description: "When this license allocation was created" })
  allocationDate?: Date | null;
}

results matching ""

    No results matching ""