forked from Yara724/api
Fix searching on GET APIs
This commit is contained in:
@@ -9,9 +9,10 @@ import {
|
||||
MaxLength,
|
||||
Min,
|
||||
} from "class-validator";
|
||||
import { BlameRequestType } from "src/Types&Enums/blame-request-management/blameRequestType.enum";
|
||||
import { UNIFIED_FILE_STATUS_KEYS } from "src/helpers/unified-file-status";
|
||||
|
||||
/** Allowed sort keys for V2 list endpoints (claims / blame). */
|
||||
/** Allowed sort keys for V2 list endpoints (claims / blame / insurer files). */
|
||||
export const LIST_SORT_BY_V2 = [
|
||||
"publicId",
|
||||
"createdAt",
|
||||
@@ -21,9 +22,16 @@ export const LIST_SORT_BY_V2 = [
|
||||
|
||||
export type ListSortByV2 = (typeof LIST_SORT_BY_V2)[number];
|
||||
|
||||
export const LIST_FILE_TYPE_V2 = [
|
||||
BlameRequestType.THIRD_PARTY,
|
||||
BlameRequestType.CAR_BODY,
|
||||
] as const;
|
||||
|
||||
export type ListFileTypeV2 = (typeof LIST_FILE_TYPE_V2)[number];
|
||||
|
||||
/**
|
||||
* Optional query params for V2 lists. If neither `page` nor `limit` is sent,
|
||||
* the full filtered+sorted list is returned (backward compatible).
|
||||
* Optional query params for V2 expert/insurer file lists.
|
||||
* If neither `page` nor `limit` is sent, the full filtered+sorted list is returned.
|
||||
*/
|
||||
export class ListQueryV2Dto {
|
||||
@ApiPropertyOptional({
|
||||
@@ -68,7 +76,7 @@ export class ListQueryV2Dto {
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description:
|
||||
"Case-insensitive substring match on `publicId` and `requestNo` (and other endpoint-specific fields).",
|
||||
"Case-insensitive substring match on `publicId`, `requestNo`, status, and other endpoint-specific fields.",
|
||||
example: "A142",
|
||||
maxLength: 64,
|
||||
})
|
||||
@@ -85,4 +93,13 @@ export class ListQueryV2Dto {
|
||||
@IsOptional()
|
||||
@IsIn([...UNIFIED_FILE_STATUS_KEYS])
|
||||
unifiedStatus?: (typeof UNIFIED_FILE_STATUS_KEYS)[number];
|
||||
|
||||
@ApiPropertyOptional({
|
||||
enum: LIST_FILE_TYPE_V2,
|
||||
description:
|
||||
"Filter by blame file type: third-party liability (`THIRD_PARTY`) or car body (`CAR_BODY`).",
|
||||
})
|
||||
@IsOptional()
|
||||
@IsIn([...LIST_FILE_TYPE_V2])
|
||||
fileType?: ListFileTypeV2;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,42 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user