fix folders middleware

This commit is contained in:
OxSaitama 2023-07-10 16:22:06 +02:00
parent ae254bf895
commit 4dcc53f555

View File

@ -9,16 +9,16 @@ export default async function folderHandler(req: Request, response: Response, ne
const uid = req.path && req.path.split("/")[5];
const office = req.body.office;
const officeFolderNumber = req.body.folder_number;
const deedType = req.body.deed.deed_type;
const deed = req.body.deed;
if (office && office.uid != officeId) {
response.sendStatus(HttpCodes.UNAUTHORIZED);
return;
}
if (deedType) {
if (deed) {
const deedTypeService = Container.get(DeedTypesService);
const deedTypeWithOffice = await deedTypeService.getByUidWithOffice(deedType.uid!);
const deedTypeWithOffice = await deedTypeService.getByUidWithOffice(deed.deedType.uid!);
if (!deedTypeWithOffice) {
response.sendStatus(HttpCodes.NOT_FOUND);
return;