pricing - - definition validFrom/To
MODIFY
src/server/rest/v1/service/PricingService.ts
src/server/rest/v1/service/PricingService.ts
@@ -74,7 +74,7 @@ export default class PricingService {
return;
}
// Get the companies
- const pricingModels = await PricingStorage.getPricingDefinitions(req.tenant,
+ const pricingDefinitions = await PricingStorage.getPricingDefinitions(req.tenant,
{
// search: filteredRequest.Search,
...authorizationPricingDefinitionsFilter.filters
@@ -88,9 +88,9 @@ export default class PricingService {
authorizationPricingDefinitionsFilter.projectFields
);
// Add Auth flags
- await AuthorizationService.addPricingDefinitionsAuthorizations(req.tenant, req.user, pricingModels as PricingDataResult, authorizationPricingDefinitionsFilter);
+ await AuthorizationService.addPricingDefinitionsAuthorizations(req.tenant, req.user, pricingDefinitions as PricingDataResult, authorizationPricingDefinitionsFilter);
// Return
- res.json(pricingModels);
+ res.json(pricingDefinitions);
next();
}
@@ -151,6 +151,11 @@ export default class PricingService {
pricingDefinition.entityType = filteredRequest.entityType;
pricingDefinition.name = filteredRequest.name;
pricingDefinition.description = filteredRequest.description;
+ pricingDefinition.validFrom = filteredRequest.validFrom;
+ pricingDefinition.validTo = filteredRequest.validTo;
+ pricingDefinition.connectorTypes = filteredRequest.connectorTypes;
+ pricingDefinition.minOutputPowerkW = filteredRequest.minOutputPowerkW;
+ pricingDefinition.maxOutputPowerkW = filteredRequest.maxOutputPowerkW;
pricingDefinition.restrictions = filteredRequest.restrictions;
pricingDefinition.dimensions = filteredRequest.dimensions;
pricingDefinition.lastChangedBy = { 'id': req.user.id };

MODIFY
src/server/rest/v1/service/security/PricingSecurity.ts
src/server/rest/v1/service/security/PricingSecurity.ts
@@ -43,6 +43,11 @@ export default class PricingSecurity {
entityType: sanitize(request.entityType),
name: sanitize(request.name),
description: sanitize(request.description),
+ connectorTypes: sanitize(request.connectorTypes),
+ validFrom: sanitize(request.validFrom),
+ validTo: sanitize(request.validTo),
+ minOutputPowerkW: sanitize(request.minOutputPowerkW),
+ maxOutputPowerkW: sanitize(request.maxOutputPowerkW),
// TODO - not yet sanitized properly
restrictions: sanitize(request.restrictions),
dimensions: sanitize(request.dimensions),

MODIFY
src/storage/mongodb/PricingStorage.ts
src/storage/mongodb/PricingStorage.ts
@@ -25,6 +25,11 @@ export default class PricingStorage {
entityType: pricingDefinition.entityType,
name: pricingDefinition.name,
description: pricingDefinition.description,
+ validFrom: Utils.convertToDate(pricingDefinition.validFrom),
+ validTo: Utils.convertToDate(pricingDefinition.validTo),
+ connectorTypes: pricingDefinition.connectorTypes,
+ maxOutputPowerkW: pricingDefinition.maxOutputPowerkW,
+ minOutputPowerkW: pricingDefinition.minOutputPowerkW,
restrictions: pricingDefinition.restrictions,
dimensions: pricingDefinition.dimensions,
};

MODIFY
src/types/Pricing.ts
src/types/Pricing.ts
@@ -30,6 +30,8 @@ export default interface PricingDefinition extends CreatedUpdatedProps, Authoriz
entityType: PricingEntity; // Type of the entity this model belongs to
name: string, // Short marketing name - e.g.: BLUE Tariff,
description: string, // A long description to explain it, e.g.: Time-based pricing for low charging stations
+ validFrom: Date,
+ validTo: Date,
connectorTypes?: ConnectorType[], // Connector types allowed to use this tariff
minOutputPowerkW?: number, // Minimum power in kW, for example 0, valid from this charging speed
maxOutputPowerkW?: number, // Maximum power in kW, for example 20, valid up to this charging speed

pricing - - definition validFrom/To