Fixed Document type name unique constraints
This commit is contained in:
parent
a05be05b72
commit
609a099d0b
@ -58,6 +58,11 @@ export default class DocumentTypesController extends ApiController {
|
||||
try {
|
||||
//init DocumentType resource with request body values
|
||||
const documentTypeEntity = DocumentType.hydrate<DocumentType>(req.body);
|
||||
const doesExist = await this.documentTypesService.get({ where: { name: documentTypeEntity.name } });
|
||||
if (doesExist.length > 0) {
|
||||
this.httpBadRequest(response, "Document type name already used");
|
||||
return;
|
||||
}
|
||||
//validate user
|
||||
await validateOrReject(documentTypeEntity, { groups: ["createDocumentType"], forbidUnknownValues: false });
|
||||
//call service to get prisma entity
|
||||
|
@ -175,7 +175,6 @@ export default class OfficeFoldersController extends ApiController {
|
||||
this.httpInternalError(response, error);
|
||||
return;
|
||||
}
|
||||
this.httpSuccess(response, await this.officeFoldersService.getByUid("uid"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user