Fixed unique folder number
This commit is contained in:
parent
941163822c
commit
831733d090
@ -47,10 +47,11 @@ export default class OfficeFoldersController extends ApiController {
|
|||||||
//init OfficeFolder resource with request body values
|
//init OfficeFolder resource with request body values
|
||||||
const officeFolderRessource = OfficeFolder.hydrate<OfficeFolder>(req.body);
|
const officeFolderRessource = OfficeFolder.hydrate<OfficeFolder>(req.body);
|
||||||
await officeFolderRessource.validateOrReject?.({ groups: ["createFolder"] , forbidUnknownValues: false });
|
await officeFolderRessource.validateOrReject?.({ groups: ["createFolder"] , forbidUnknownValues: false });
|
||||||
|
|
||||||
const officeFolderNumberExist = await this.officeFoldersService.get({where: {folder_number: officeFolderRessource.folder_number}});
|
const officeFolderNumberExist = await this.officeFoldersService.get({where: {folder_number: officeFolderRessource.folder_number}});
|
||||||
|
|
||||||
|
|
||||||
if (officeFolderNumberExist) {
|
if (officeFolderNumberExist.length > 0) {
|
||||||
this.httpValidationError(response, [{
|
this.httpValidationError(response, [{
|
||||||
property: "folder_number",
|
property: "folder_number",
|
||||||
constraints: {
|
constraints: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user