forked from Yara724/api
Fix 404 for invalid email of actors, added APIs for client settings
This commit is contained in:
131
src/client/dto/client-settings.dto.ts
Normal file
131
src/client/dto/client-settings.dto.ts
Normal file
@@ -0,0 +1,131 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import { Type } from "class-transformer";
|
||||
import {
|
||||
IsInt,
|
||||
IsOptional,
|
||||
Max,
|
||||
Min,
|
||||
ValidateNested,
|
||||
} from "class-validator";
|
||||
import type { MediaKind } from "../client.service";
|
||||
|
||||
export class ClientMediaLimitsDto {
|
||||
@ApiPropertyOptional({
|
||||
description: "Minimum upload size in bytes (inclusive). Omit to keep default.",
|
||||
example: 5120,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
@Min(0)
|
||||
minBytes?: number;
|
||||
|
||||
@ApiPropertyOptional({
|
||||
description: "Maximum upload size in bytes (inclusive). Cannot exceed route ceiling.",
|
||||
example: 8388608,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
maxBytes?: number;
|
||||
}
|
||||
|
||||
export class ClientMediaSettingsDto {
|
||||
@ApiPropertyOptional({ type: ClientMediaLimitsDto })
|
||||
@IsOptional()
|
||||
@ValidateNested()
|
||||
@Type(() => ClientMediaLimitsDto)
|
||||
video?: ClientMediaLimitsDto;
|
||||
|
||||
@ApiPropertyOptional({ type: ClientMediaLimitsDto })
|
||||
@IsOptional()
|
||||
@ValidateNested()
|
||||
@Type(() => ClientMediaLimitsDto)
|
||||
image?: ClientMediaLimitsDto;
|
||||
|
||||
@ApiPropertyOptional({ type: ClientMediaLimitsDto })
|
||||
@IsOptional()
|
||||
@ValidateNested()
|
||||
@Type(() => ClientMediaLimitsDto)
|
||||
voice?: ClientMediaLimitsDto;
|
||||
}
|
||||
|
||||
export class UpdateClientSettingsDto {
|
||||
@ApiPropertyOptional({
|
||||
description:
|
||||
"Max days between CAR_BODY accident date and submission. Omit to leave unchanged.",
|
||||
example: 7,
|
||||
minimum: 1,
|
||||
maximum: 365,
|
||||
})
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
@Min(1)
|
||||
@Max(365)
|
||||
carBodyAccidentMaxAgeDays?: number;
|
||||
|
||||
@ApiPropertyOptional({ type: ClientMediaSettingsDto })
|
||||
@IsOptional()
|
||||
@ValidateNested()
|
||||
@Type(() => ClientMediaSettingsDto)
|
||||
media?: ClientMediaSettingsDto;
|
||||
}
|
||||
|
||||
export class MediaLimitsResolvedDto {
|
||||
@ApiProperty({ example: 5120 })
|
||||
minBytes: number;
|
||||
|
||||
@ApiProperty({ example: 8388608 })
|
||||
maxBytes: number;
|
||||
}
|
||||
|
||||
export class MediaKindSettingsViewDto {
|
||||
@ApiPropertyOptional({ type: ClientMediaLimitsDto })
|
||||
configured: { minBytes?: number; maxBytes?: number } | null;
|
||||
|
||||
@ApiProperty({ type: MediaLimitsResolvedDto })
|
||||
effective: MediaLimitsResolvedDto;
|
||||
|
||||
@ApiProperty({ type: MediaLimitsResolvedDto })
|
||||
systemDefault: MediaLimitsResolvedDto;
|
||||
|
||||
@ApiProperty({
|
||||
description: "Hard multer ceiling for this kind on upload routes (bytes)",
|
||||
example: 10485760,
|
||||
})
|
||||
routeMaxBytes: number;
|
||||
}
|
||||
|
||||
export class CarBodyAccidentWindowViewDto {
|
||||
@ApiPropertyOptional({ example: 14, nullable: true })
|
||||
configured: number | null;
|
||||
|
||||
@ApiProperty({ example: 14 })
|
||||
effective: number;
|
||||
|
||||
@ApiProperty({ example: 7 })
|
||||
systemDefault: number;
|
||||
|
||||
@ApiProperty({ example: 1 })
|
||||
minDays: number;
|
||||
|
||||
@ApiProperty({ example: 365 })
|
||||
maxDays: number;
|
||||
}
|
||||
|
||||
export class ClientSettingsPanelResponseDto {
|
||||
@ApiProperty({ example: "507f1f77bcf86cd799439011" })
|
||||
clientId: string;
|
||||
|
||||
@ApiProperty({ type: CarBodyAccidentWindowViewDto })
|
||||
carBodyAccidentMaxAgeDays: CarBodyAccidentWindowViewDto;
|
||||
|
||||
@ApiProperty({
|
||||
description: "Per-kind upload bounds (video / image / voice)",
|
||||
example: {
|
||||
video: {},
|
||||
image: {},
|
||||
voice: {},
|
||||
},
|
||||
})
|
||||
media: Record<MediaKind, MediaKindSettingsViewDto>;
|
||||
}
|
||||
Reference in New Issue
Block a user