From 07d1cc78e26b766ae172d11212e3c9a6d027da6a Mon Sep 17 00:00:00 2001 From: Firman Ramdhani <33869609+firmanramdhani@users.noreply.github.com> Date: Wed, 11 Sep 2024 11:05:36 +0700 Subject: [PATCH] feat: penyesuaian error validasi create items --- .../item-related/item/infrastructure/dto/item.dto.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/item-related/item/infrastructure/dto/item.dto.ts b/src/modules/item-related/item/infrastructure/dto/item.dto.ts index dfdd8dd..8ca6b9b 100644 --- a/src/modules/item-related/item/infrastructure/dto/item.dto.ts +++ b/src/modules/item-related/item/infrastructure/dto/item.dto.ts @@ -134,7 +134,15 @@ export class ItemDto extends BaseStatusDto implements ItemEntity { }, ], }) - @IsArray() + @IsArray({ + message: (body) => { + const value = body.value; + if (!value || value?.length === 0) { + return 'Product bundling tidak boleh kosong.'; + } + return 'Product bundling tidak sesuai.'; + }, + }) @ValidateIf((body) => body.item_type.toLowerCase() == ItemType.BUNDLING) bundling_items: ItemEntity[]; }