apps/recallassess/recallassess-api/src/api/client/participant/dto/participant-list-response.dto.ts
Participant-specific list response Uses extended metadata that includes participant status counts
Properties |
constructor(data: CLParticipantDto[], page: number, limit: number, totalCount: number, activeCount: number, inactiveCount: number, replacedCount: number)
|
| data |
Type : CLParticipantDto[]
|
Decorators :
@ApiProperty({description: 'Array of participant data items', type: undefined})
|
| meta |
Type : CLParticipantMetaData
|
Decorators :
@ApiProperty({description: 'Pagination metadata with participant counts', type: CLParticipantMetaData})
|
import { CLListResponse, CLMetaData } from "@api/shared/dto";
import { ApiProperty } from "@nestjs/swagger";
import { Exclude, Expose } from "class-transformer";
import { CLParticipantDto } from "./participant.dto";
/**
* Extended metadata specifically for participant list responses
* Includes participant status counts in addition to standard pagination metadata
*/
@Exclude()
export class CLParticipantMetaData extends CLMetaData {
@Expose()
@ApiProperty({ description: "Total count of active participants", example: 50 })
active_count!: number;
@Expose()
@ApiProperty({ description: "Total count of inactive participants", example: 30 })
inactive_count!: number;
@Expose()
@ApiProperty({ description: "Total count of replaced participants", example: 20 })
replaced_count!: number;
}
/**
* Participant-specific list response
* Uses extended metadata that includes participant status counts
*/
@Exclude()
export class CLParticipantListResponse extends CLListResponse<CLParticipantDto> {
@ApiProperty({ description: "Array of participant data items", type: [CLParticipantDto] })
declare data: CLParticipantDto[];
@ApiProperty({ description: "Pagination metadata with participant counts", type: CLParticipantMetaData })
declare meta: CLParticipantMetaData;
constructor(
data: CLParticipantDto[],
page: number,
limit: number,
totalCount: number,
activeCount: number,
inactiveCount: number,
replacedCount: number,
) {
super(data, page, limit, totalCount);
// Override meta with extended metadata
this.meta = {
page,
limit,
total_count: totalCount,
total_pages: Math.ceil(totalCount / limit),
has_next_page: page * limit < totalCount,
has_previous_page: page > 1,
active_count: activeCount,
inactive_count: inactiveCount,
replaced_count: replacedCount,
};
}
}
// Re-export with both names for backward compatibility during migration
export { CLParticipantListResponse as ParticipantListResponse, CLParticipantMetaData as ParticipantMetaData };