49 lines
1010 B
TypeScript
49 lines
1010 B
TypeScript
import { ApiProperty, ApiPropertyOptional, PartialType } from '@nestjs/swagger';
|
|
import { Transform } from 'class-transformer';
|
|
import {
|
|
IsBoolean,
|
|
IsEnum,
|
|
IsOptional,
|
|
IsString,
|
|
MaxLength,
|
|
MinLength,
|
|
} from 'class-validator';
|
|
import { StorageType } from 'src/objects/storage/enums/storage-type.enum';
|
|
|
|
export class StorageCreateRequestDto {
|
|
@ApiProperty()
|
|
@IsString()
|
|
@MinLength(3)
|
|
@MaxLength(32)
|
|
displayName: string;
|
|
|
|
@ApiProperty({ type: String, enum: StorageType })
|
|
@IsEnum(StorageType)
|
|
type: StorageType;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
location: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsString()
|
|
@IsOptional()
|
|
locationDescription?: string;
|
|
|
|
@ApiProperty()
|
|
@IsString()
|
|
color: string;
|
|
}
|
|
|
|
export class StorageUpdateRequestDto extends PartialType(
|
|
StorageCreateRequestDto,
|
|
) {}
|
|
|
|
export class StorageWithSetsQueryDto {
|
|
@ApiPropertyOptional()
|
|
@IsBoolean()
|
|
@IsOptional()
|
|
@Transform(({ value }) => value === 'true' || value === true)
|
|
includeWithSets?: boolean;
|
|
}
|