homemanager-be/src/app-storage/dto/storage-item-request.dto.ts

17 lines
398 B
TypeScript

import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsString, MinLength, ValidateIf } from 'class-validator';
export class StorageItemRequestQueryDto {
@ApiPropertyOptional()
@IsString()
@MinLength(2)
@ValidateIf((obj) => !obj.barcode)
searchTerm?: string;
@ApiPropertyOptional()
@IsString()
@MinLength(2)
@ValidateIf((obj) => !obj.searchTerm)
barcode?: string;
}