add checks on office controller
This commit is contained in:
parent
99985590bc
commit
73fb1b2625
@ -30,6 +30,13 @@ export default class OfficesController extends ApiController {
|
|||||||
return;
|
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
|
//call service to get prisma entity
|
||||||
const officesEntities: Offices[] = await this.officesService.get(query);
|
const officesEntities: Offices[] = await this.officesService.get(query);
|
||||||
//Hydrate ressource with prisma entity
|
//Hydrate ressource with prisma entity
|
||||||
|
@ -29,6 +29,12 @@ export default class OfficesController extends ApiController {
|
|||||||
return;
|
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
|
//call service to get prisma entity
|
||||||
const officesEntities: Offices[] = await this.officesService.get(query);
|
const officesEntities: Offices[] = await this.officesService.get(query);
|
||||||
//Hydrate ressource with prisma entity
|
//Hydrate ressource with prisma entity
|
||||||
@ -56,6 +62,10 @@ export default class OfficesController extends ApiController {
|
|||||||
let query;
|
let query;
|
||||||
if (req.query["q"]) {
|
if (req.query["q"]) {
|
||||||
query = JSON.parse(req.query["q"] as string);
|
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);
|
const officeEntity = await this.officesService.getByUid(uid, query);
|
||||||
|
@ -43,6 +43,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
|
//call service to get prisma entity
|
||||||
const officesEntities: Offices[] = await this.officesService.get(query);
|
const officesEntities: Offices[] = await this.officesService.get(query);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user