41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { BaseStatusDto } from 'src/core/modules/infrastructure/dto/base-status.dto';
|
|
import { ItemQueueEntity } from '../../domain/entities/item-queue.entity';
|
|
import { IsArray, IsString } from 'class-validator';
|
|
import { ItemType } from '../../constants';
|
|
import { ApiProperty } from '@nestjs/swagger';
|
|
import { ItemEntity } from 'src/modules/item-related/item/domain/entities/item.entity';
|
|
import { Exclude, Transform } from 'class-transformer';
|
|
|
|
export class ItemQueueDto extends BaseStatusDto implements ItemQueueEntity {
|
|
@Exclude()
|
|
items: ItemEntity[];
|
|
|
|
@ApiProperty({ name: 'name', required: true, example: 'Bundling w Entrance' })
|
|
@IsString()
|
|
name: string;
|
|
|
|
@ApiProperty({
|
|
name: 'information',
|
|
required: false,
|
|
example: 'Running text untuk display antrian',
|
|
})
|
|
@IsString()
|
|
information: string;
|
|
|
|
@ApiProperty({
|
|
type: 'string',
|
|
required: true,
|
|
description: `Select (${JSON.stringify(Object.values(ItemType))})`,
|
|
example: ItemType.BUNDLING,
|
|
})
|
|
item_type: ItemType;
|
|
|
|
@ApiProperty({ type: [String], required: true })
|
|
@Transform((body) => {
|
|
return Array.isArray(body.value) ? body.value : [body.value];
|
|
})
|
|
@IsArray()
|
|
@IsString({ each: true })
|
|
item_ids: string[];
|
|
}
|