fix folders middleware
This commit is contained in:
parent
ae254bf895
commit
4dcc53f555
@ -9,16 +9,16 @@ export default async function folderHandler(req: Request, response: Response, ne
|
|||||||
const uid = req.path && req.path.split("/")[5];
|
const uid = req.path && req.path.split("/")[5];
|
||||||
const office = req.body.office;
|
const office = req.body.office;
|
||||||
const officeFolderNumber = req.body.folder_number;
|
const officeFolderNumber = req.body.folder_number;
|
||||||
const deedType = req.body.deed.deed_type;
|
const deed = req.body.deed;
|
||||||
|
|
||||||
if (office && office.uid != officeId) {
|
if (office && office.uid != officeId) {
|
||||||
response.sendStatus(HttpCodes.UNAUTHORIZED);
|
response.sendStatus(HttpCodes.UNAUTHORIZED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deedType) {
|
if (deed) {
|
||||||
const deedTypeService = Container.get(DeedTypesService);
|
const deedTypeService = Container.get(DeedTypesService);
|
||||||
const deedTypeWithOffice = await deedTypeService.getByUidWithOffice(deedType.uid!);
|
const deedTypeWithOffice = await deedTypeService.getByUidWithOffice(deed.deedType.uid!);
|
||||||
if (!deedTypeWithOffice) {
|
if (!deedTypeWithOffice) {
|
||||||
response.sendStatus(HttpCodes.NOT_FOUND);
|
response.sendStatus(HttpCodes.NOT_FOUND);
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user