Renamed billing validator method
MODIFY
src/server/rest/v1/service/BillingService.ts
src/server/rest/v1/service/BillingService.ts
@@ -347,7 +347,7 @@ export default class BillingService {
UtilsService.assertComponentIsActiveFromToken(req.user, TenantComponents.BILLING,
Action.LIST, Entity.INVOICE, MODULE_NAME, 'handleGetInvoice');
// Filter
- const filteredRequest = BillingValidator.getInstance().validateBillingInvoiceReq(req.query);
+ const filteredRequest = BillingValidator.getInstance().validateBillingInvoiceGetReq(req.query);
UtilsService.assertIdIsProvided(action, filteredRequest.ID, MODULE_NAME, 'handleGetInvoice', req.user);
// Check Users
let userProject: string[] = [];
@@ -618,7 +618,7 @@ export default class BillingService {
UtilsService.assertComponentIsActiveFromToken(req.user, TenantComponents.BILLING,
Action.DOWNLOAD, Entity.BILLING, MODULE_NAME, 'handleDownloadInvoice');
// Filter
- const filteredRequest = BillingValidator.getInstance().validateBillingInvoiceReq(req.query);
+ const filteredRequest = BillingValidator.getInstance().validateBillingInvoiceGetReq(req.query);
// Get the Invoice
const billingInvoice = await BillingStorage.getInvoice(req.tenant, filteredRequest.ID);
UtilsService.assertObjectExists(action, billingInvoice, `Invoice ID '${filteredRequest.ID}' does not exist`,

MODIFY
src/server/rest/v1/validator/BillingValidator.ts
src/server/rest/v1/validator/BillingValidator.ts
@@ -13,7 +13,7 @@ export default class BillingValidator extends SchemaValidator {
private billingDeleteUserPaymentMethod: Schema = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/billing/billing-delete-payment-method.json`, 'utf8'));
private billingSetupUserPaymentMethod: Schema = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/billing/billing-setup-payment-method.json`, 'utf8'));
private billingInvoicesGet: Schema = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/billing/invoices-get.json`, 'utf8'));
- private billingInvoiceGetByID: Schema = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/billing/invoice-get.json`, 'utf8'));
+ private billingInvoiceGet: Schema = JSON.parse(fs.readFileSync(`${global.appRoot}/assets/server/rest/v1/schemas/billing/invoice-get.json`, 'utf8'));
private constructor() {
super('BillingValidator');
@@ -46,7 +46,7 @@ export default class BillingValidator extends SchemaValidator {
return this.validate(this.billingInvoicesGet, data);
}
- public validateBillingInvoiceReq(data: Record<string, unknown>): HttpBillingInvoiceRequest {
- return this.validate(this.billingInvoiceGetByID, data);
+ public validateBillingInvoiceGetReq(data: Record<string, unknown>): HttpBillingInvoiceRequest {
+ return this.validate(this.billingInvoiceGet, data);
}
}

Renamed billing validator method