update commission validate
This commit is contained in:
@@ -47,15 +47,6 @@ export class ServiceSchema extends PothosSchema {
|
|||||||
}),
|
}),
|
||||||
commission: t.exposeFloat('commission', {
|
commission: t.exposeFloat('commission', {
|
||||||
description: 'The commission of the service.',
|
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', {
|
rating: t.expose('rating', {
|
||||||
type: 'Float',
|
type: 'Float',
|
||||||
@@ -75,7 +66,11 @@ export class ServiceSchema extends PothosSchema {
|
|||||||
resolve: async (service) => {
|
resolve: async (service) => {
|
||||||
// get file id from imageFileUrl
|
// get file id from imageFileUrl
|
||||||
const imageFileId = service.imageFileUrl?.split('/').pop()?.split('?')[0]
|
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', {
|
status: t.expose('status', {
|
||||||
|
|||||||
Reference in New Issue
Block a user