added new filterGetInvoiceRequest
MODIFY
src/server/rest/v1/service/BillingService.ts
src/server/rest/v1/service/BillingService.ts
@@ -307,7 +307,7 @@ export default class BillingService {
UtilsService.assertComponentIsActiveFromToken(req.user, TenantComponents.BILLING,
Action.LIST, Entity.INVOICES, MODULE_NAME, 'handleGetInvoice');
// Filter
- const filteredRequest = BillingSecurity.filterGetInvoicesRequest(req.query);
+ const filteredRequest = BillingSecurity.filterGetInvoiceRequest(req.query);
UtilsService.assertIdIsProvided(action, filteredRequest.ID, MODULE_NAME, 'handleGetInvoice', req.user);
// Check Users
let userProject: string[] = [];

MODIFY
src/server/rest/v1/service/security/BillingSecurity.ts
src/server/rest/v1/service/security/BillingSecurity.ts
@@ -35,14 +35,17 @@ export default class BillingSecurity {
if (Utils.objectHasProperty(requestQuery, 'Search')) {
filteredRequest.Search = sanitize(requestQuery.Search);
}
- if (Utils.objectHasProperty(requestQuery, 'ID')) {
- filteredRequest.ID = sanitize(requestQuery.ID);
- }
UtilsSecurity.filterSkipAndLimit(requestQuery, filteredRequest);
UtilsSecurity.filterSort(requestQuery, filteredRequest);
return filteredRequest;
}
+ static filterGetInvoiceRequest(requestQuery: any): HttpBillingInvoiceRequest {
+ return {
+ ID: sanitize(requestQuery.ID)
+ } as HttpBillingInvoiceRequest;
+ }
+
static filterForceSynchronizeUserInvoicesRequest(requestBody: any): HttpForceSynchronizeUserInvoicesRequest {
return {
userID: sanitize(requestBody.userID)

added new filterGetInvoiceRequest