feat: config dto type on bookmark report

pull/8/head
Firman Ramdhani 2024-07-03 11:56:00 +07:00
parent c0f8d5ad9d
commit e586a7bad1
4 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,4 @@
export * from './report-config.constant'; export * from './report-config.constant';
export * from './report-group.constant'; export * from './report-group.constant';
export * from './report-status.constant'; export * from './report-status.constant';
export * from './report-bookmark-type.constant';

View File

@ -0,0 +1,4 @@
export enum REPORT_BOOKMARK_TYPE {
table_config = 'table_config',
filter = 'filter',
}

View File

@ -1,5 +1,6 @@
import { ApiProperty } from '@nestjs/swagger'; import { ApiProperty } from '@nestjs/swagger';
import { IsBoolean, IsObject, IsString, ValidateIf } from 'class-validator'; import { IsBoolean, IsObject, IsString, ValidateIf } from 'class-validator';
import { REPORT_BOOKMARK_TYPE } from '../constant';
export class CreateReportBookmarkDto { export class CreateReportBookmarkDto {
@ApiProperty({ name: 'group_name', required: true }) @ApiProperty({ name: 'group_name', required: true })
@ -20,7 +21,7 @@ export class CreateReportBookmarkDto {
@ApiProperty({ name: 'type', required: true }) @ApiProperty({ name: 'type', required: true })
@IsBoolean() @IsBoolean()
type: 'table_config' | 'filter'; type: REPORT_BOOKMARK_TYPE;
@ApiProperty({ @ApiProperty({
name: 'configuration', name: 'configuration',

View File

@ -1,5 +1,6 @@
import { ApiProperty } from '@nestjs/swagger'; import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer'; import { Transform } from 'class-transformer';
import { REPORT_BOOKMARK_TYPE } from '../constant';
export class GetReportBookmarkDto { export class GetReportBookmarkDto {
@ApiProperty({ type: ['string'], required: false }) @ApiProperty({ type: ['string'], required: false })
@ -18,5 +19,5 @@ export class GetReportBookmarkDto {
@Transform((body) => { @Transform((body) => {
return Array.isArray(body.value) ? body.value : [body.value]; return Array.isArray(body.value) ? body.value : [body.value];
}) })
types?: string[]; types?: REPORT_BOOKMARK_TYPE[];
} }