forked from Yara724/api
85 lines
2.3 KiB
TypeScript
85 lines
2.3 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
|
import { IsBoolean, IsOptional, ValidateNested } from "class-validator";
|
|
import { Type } from "class-transformer";
|
|
|
|
export class ExternalApisSettingsDto {
|
|
@ApiPropertyOptional({
|
|
description:
|
|
"Master switch: when false, all inquiries use mocks regardless of per-insurer flags (`clients.settings.externalInquiries`). Manage granular flags via `/client/{clientId}/external-inquiries`.",
|
|
example: false,
|
|
})
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
sandHubUseLiveApi?: boolean;
|
|
}
|
|
|
|
export class OfflineInquirySettingsDto {
|
|
@ApiPropertyOptional({
|
|
description:
|
|
"Master switch for seeded offline plate inquiries. When false, `offlineInquiries` hits are skipped.",
|
|
example: true,
|
|
})
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
enabled?: boolean;
|
|
}
|
|
|
|
export class UpdateSystemSettingsDto {
|
|
@ApiPropertyOptional({ type: ExternalApisSettingsDto })
|
|
@IsOptional()
|
|
@ValidateNested()
|
|
@Type(() => ExternalApisSettingsDto)
|
|
externalApis?: ExternalApisSettingsDto;
|
|
|
|
@ApiPropertyOptional({ type: OfflineInquirySettingsDto })
|
|
@IsOptional()
|
|
@ValidateNested()
|
|
@Type(() => OfflineInquirySettingsDto)
|
|
offlineInquiry?: OfflineInquirySettingsDto;
|
|
}
|
|
|
|
export class UpdateOfflineInquirySettingsDto {
|
|
@ApiProperty({
|
|
description: "Enable or disable offline seeded plate inquiries globally",
|
|
example: true,
|
|
})
|
|
@IsBoolean()
|
|
enabled: boolean;
|
|
}
|
|
|
|
export class ExternalApisSettingsViewDto {
|
|
@ApiProperty({
|
|
description:
|
|
"Stored in `system_settings.externalApis.sandHubUseLiveApi` — controls SandHubService",
|
|
example: false,
|
|
})
|
|
sandHubUseLiveApi: boolean;
|
|
}
|
|
|
|
export class OfflineInquirySettingsViewDto {
|
|
@ApiProperty({
|
|
description:
|
|
"Stored in `system_settings.offlineInquiry.enabled` — when false, offline seeds are ignored",
|
|
example: true,
|
|
})
|
|
enabled: boolean;
|
|
}
|
|
|
|
export class SystemSettingsResponseDto {
|
|
@ApiProperty({ example: "global" })
|
|
key: string;
|
|
|
|
@ApiProperty({ type: ExternalApisSettingsViewDto })
|
|
externalApis: ExternalApisSettingsViewDto;
|
|
|
|
@ApiProperty({ type: OfflineInquirySettingsViewDto })
|
|
offlineInquiry: OfflineInquirySettingsViewDto;
|
|
|
|
@ApiProperty({
|
|
description: "Human-readable mode for operators",
|
|
example: "mock",
|
|
enum: ["live", "mock"],
|
|
})
|
|
sandHubMode: "live" | "mock";
|
|
}
|