add checks on office controller

This commit is contained in:
OxSaitama 2023-10-25 10:52:27 +02:00
parent 99985590bc
commit 73fb1b2625
3 changed files with 23 additions and 0 deletions

View File

@ -30,6 +30,13 @@ export default class OfficesController extends ApiController {
return;
}
}
if(query.where?.office_folders) delete query.where.office_folders;
if(query.include?.office_folders) {
this.httpForbidden(response, "You can't include office_folders");
return;
};
//call service to get prisma entity
const officesEntities: Offices[] = await this.officesService.get(query);
//Hydrate ressource with prisma entity

View File

@ -29,6 +29,12 @@ export default class OfficesController extends ApiController {
return;
}
}
if(query.where?.office_folders) delete query.where.office_folders;
if(query.include?.office_folders) {
this.httpForbidden(response, "You can't include office_folders");
return;
};
//call service to get prisma entity
const officesEntities: Offices[] = await this.officesService.get(query);
//Hydrate ressource with prisma entity
@ -56,6 +62,10 @@ export default class OfficesController extends ApiController {
let query;
if (req.query["q"]) {
query = JSON.parse(req.query["q"] as string);
if(query.office_folders) {
this.httpForbidden(response, "You can't include office_folders");
return;
}
}
const officeEntity = await this.officesService.getByUid(uid, query);

View File

@ -44,6 +44,12 @@ export default class OfficesController extends ApiController {
}
}
if(query.where?.office_folders) delete query.where.office_folders;
if(query.include?.office_folders) {
this.httpForbidden(response, "You can't include office_folders");
return;
};
//call service to get prisma entity
const officesEntities: Offices[] = await this.officesService.get(query);
//Hydrate ressource with prisma entity