From c9f03f251df3953b98898cff30f5f8c8995896f2 Mon Sep 17 00:00:00 2001 From: Ly Tuan Kiet Date: Tue, 26 Nov 2024 21:30:26 +0700 Subject: [PATCH] update commission validate --- src/Service/service.schema.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/Service/service.schema.ts b/src/Service/service.schema.ts index 8afc265..9c43d74 100644 --- a/src/Service/service.schema.ts +++ b/src/Service/service.schema.ts @@ -47,15 +47,6 @@ export class ServiceSchema extends PothosSchema { }), commission: t.exposeFloat('commission', { description: 'The commission of the service.', - validate: (value) => { - if (value === undefined) { - return true - } - if (typeof value !== 'number' || value < 0 || value > 1) { - throw new Error('Commission must be between 0 and 1, eg: 0.05 for 5%') - } - return true - }, }), rating: t.expose('rating', { type: 'Float', @@ -75,7 +66,11 @@ export class ServiceSchema extends PothosSchema { resolve: async (service) => { // get file id from imageFileUrl const imageFileId = service.imageFileUrl?.split('/').pop()?.split('?')[0] - return await this.minioService.updatePresignUrl(imageFileId ?? '', 'files', service.imageFileUrl ?? undefined) + return await this.minioService.updatePresignUrl( + imageFileId ?? '', + 'files', + service.imageFileUrl ?? undefined, + ) }, }), status: t.expose('status', {