forked from Yara724/api
69 lines
1.7 KiB
TypeScript
69 lines
1.7 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
|
import { IsIn, IsISO8601, IsOptional } from "class-validator";
|
|
import {
|
|
LIST_FILE_TYPE_V2,
|
|
ListFileTypeV2,
|
|
} from "src/common/dto/list-query-v2.dto";
|
|
import {
|
|
UNIFIED_FILE_STATUS_KEYS,
|
|
UnifiedFileStatusDefinition,
|
|
UnifiedFileStatusKey,
|
|
} from "src/helpers/unified-file-status";
|
|
|
|
export class UnifiedFileStatusReportQueryDto {
|
|
@ApiPropertyOptional({
|
|
description: "Optional start datetime (ISO 8601) for portfolio date filter.",
|
|
example: "2026-01-01T00:00:00.000Z",
|
|
})
|
|
@IsOptional()
|
|
@IsISO8601({ strict: false })
|
|
from?: string;
|
|
|
|
@ApiPropertyOptional({
|
|
description: "Optional end datetime (ISO 8601) for portfolio date filter.",
|
|
example: "2026-12-31T23:59:59.999Z",
|
|
})
|
|
@IsOptional()
|
|
@IsISO8601({ strict: false })
|
|
to?: string;
|
|
|
|
@ApiPropertyOptional({
|
|
enum: LIST_FILE_TYPE_V2,
|
|
description:
|
|
"Count only files of this blame type (`THIRD_PARTY` or `CAR_BODY`).",
|
|
})
|
|
@IsOptional()
|
|
@IsIn([...LIST_FILE_TYPE_V2])
|
|
fileType?: ListFileTypeV2;
|
|
}
|
|
|
|
export class UnifiedFileStatusDefinitionDto implements UnifiedFileStatusDefinition {
|
|
@ApiProperty({ enum: UNIFIED_FILE_STATUS_KEYS })
|
|
key: UnifiedFileStatusKey;
|
|
|
|
@ApiProperty()
|
|
labelEn: string;
|
|
|
|
@ApiProperty()
|
|
labelFa: string;
|
|
|
|
@ApiProperty()
|
|
description: string;
|
|
}
|
|
|
|
export class UnifiedFileStatusReportDto {
|
|
@ApiProperty({ type: [UnifiedFileStatusDefinitionDto] })
|
|
statuses: UnifiedFileStatusDefinitionDto[];
|
|
|
|
@ApiProperty({
|
|
description: "Counts per unified status key plus `all`",
|
|
example: {
|
|
all: 42,
|
|
IN_PROGRESS: 10,
|
|
WAITING_FOR_DAMAGE_EXPERT: 5,
|
|
COMPLETED: 12,
|
|
},
|
|
})
|
|
counts: Record<string, number>;
|
|
}
|