diff --git a/src/app/api/super-admin/OfficeFoldersController.ts b/src/app/api/super-admin/OfficeFoldersController.ts index 85c52667..ed2dbce1 100644 --- a/src/app/api/super-admin/OfficeFoldersController.ts +++ b/src/app/api/super-admin/OfficeFoldersController.ts @@ -47,10 +47,11 @@ export default class OfficeFoldersController extends ApiController { //init OfficeFolder resource with request body values const officeFolderRessource = OfficeFolder.hydrate(req.body); await officeFolderRessource.validateOrReject?.({ groups: ["createFolder"] , forbidUnknownValues: false }); - + const officeFolderNumberExist = await this.officeFoldersService.get({where: {folder_number: officeFolderRessource.folder_number}}); + - if (officeFolderNumberExist) { + if (officeFolderNumberExist.length > 0) { this.httpValidationError(response, [{ property: "folder_number", constraints: {