59 lines
2.3 KiB
TypeScript
59 lines
2.3 KiB
TypeScript
|
|
import { ApiProperty } from "@nestjs/swagger"
|
||
|
|
|
||
|
|
export class PresetResponseDto {
|
||
|
|
@ApiProperty({ description: "Имя preset.", example: "card" })
|
||
|
|
name!: string
|
||
|
|
|
||
|
|
@ApiProperty({ description: "Режим preset.", enum: ["fixed", "responsive"], example: "responsive" })
|
||
|
|
mode!: string
|
||
|
|
|
||
|
|
@ApiProperty({ description: "Разрешённые форматы.", example: ["avif", "webp", "jpg"] })
|
||
|
|
formats!: readonly string[]
|
||
|
|
|
||
|
|
@ApiProperty({ description: "Разрешённые значения quality.", example: [75, 80] })
|
||
|
|
qualities!: readonly number[]
|
||
|
|
|
||
|
|
@ApiProperty({ description: "Quality по умолчанию.", example: 80 })
|
||
|
|
quality!: number
|
||
|
|
|
||
|
|
@ApiProperty({ description: "Resize mode preset.", enum: ["fit", "fill"], example: "fit" })
|
||
|
|
resize!: string
|
||
|
|
|
||
|
|
@ApiProperty({ description: "Фиксированная ширина для fixed preset.", example: 256, required: false })
|
||
|
|
width?: number
|
||
|
|
|
||
|
|
@ApiProperty({ description: "Фиксированная высота для fixed preset.", example: 256, required: false })
|
||
|
|
height?: number
|
||
|
|
|
||
|
|
@ApiProperty({ description: "Разрешённые ширины для responsive preset.", example: [320, 640, 960], required: false })
|
||
|
|
widths?: readonly number[]
|
||
|
|
}
|
||
|
|
|
||
|
|
export class CustomTransformConfigResponseDto {
|
||
|
|
@ApiProperty({ description: "Включены ли custom transforms.", example: true })
|
||
|
|
enabled!: boolean
|
||
|
|
|
||
|
|
@ApiProperty({ description: "Разрешённые форматы custom transforms.", example: ["avif", "webp", "jpg", "png"] })
|
||
|
|
formats!: readonly string[]
|
||
|
|
|
||
|
|
@ApiProperty({ description: "Максимальная ширина custom transform.", example: 4096 })
|
||
|
|
maxWidth!: number
|
||
|
|
|
||
|
|
@ApiProperty({ description: "Максимальная высота custom transform.", example: 4096 })
|
||
|
|
maxHeight!: number
|
||
|
|
|
||
|
|
@ApiProperty({ description: "Quality по умолчанию для custom transform.", example: 80 })
|
||
|
|
quality!: number
|
||
|
|
}
|
||
|
|
|
||
|
|
export class PresetsResponseDto {
|
||
|
|
@ApiProperty({ description: "Static presets.", type: [PresetResponseDto] })
|
||
|
|
presets!: PresetResponseDto[]
|
||
|
|
|
||
|
|
@ApiProperty({ description: "Custom transform config.", type: CustomTransformConfigResponseDto })
|
||
|
|
custom!: CustomTransformConfigResponseDto
|
||
|
|
|
||
|
|
@ApiProperty({ description: "Mock allowlist source hosts.", example: ["storage.yandexcloud.net"] })
|
||
|
|
allowedSourceHosts!: string[]
|
||
|
|
}
|