pos-be/src/modules/reports/shared/dto/report-bookmark.create.dto.ts

39 lines
894 B
TypeScript

import { ApiProperty } from '@nestjs/swagger';
import { IsBoolean, IsObject, IsString, ValidateIf } from 'class-validator';
import { REPORT_BOOKMARK_TYPE } from '../constant';
export class CreateReportBookmarkDto {
@ApiProperty({ name: 'group_name', required: true })
@IsString()
group_name: string;
@ApiProperty({ name: 'unique_name', required: true })
@IsString()
unique_name: string;
@ApiProperty({ name: 'label', required: true })
@IsString()
label: string;
@ApiProperty({ name: 'applied', required: true })
@IsBoolean()
applied: boolean;
@ApiProperty({
name: 'type',
required: true,
default: REPORT_BOOKMARK_TYPE.TABLE_CONFIG,
})
@IsString()
type: REPORT_BOOKMARK_TYPE;
@ApiProperty({
name: 'configuration',
type: Object,
required: true,
})
@IsObject()
@ValidateIf((body) => body.configuration)
configuration: any;
}