@zetra/citrineos-data 1.8.3-fork.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +9 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/dtos/GenerateCertificateChainRequest.d.ts +13 -0
- package/dist/interfaces/dtos/GenerateCertificateChainRequest.js +30 -0
- package/dist/interfaces/dtos/GenerateCertificateChainRequest.js.map +1 -0
- package/dist/interfaces/dtos/InstallRootCertificateRequest.d.ts +9 -0
- package/dist/interfaces/dtos/InstallRootCertificateRequest.js +22 -0
- package/dist/interfaces/dtos/InstallRootCertificateRequest.js.map +1 -0
- package/dist/interfaces/dtos/RegenerateExistingCertificate.d.ts +4 -0
- package/dist/interfaces/dtos/RegenerateExistingCertificate.js +8 -0
- package/dist/interfaces/dtos/RegenerateExistingCertificate.js.map +1 -0
- package/dist/interfaces/dtos/TlsCertificatesRequest.d.ts +7 -0
- package/dist/interfaces/dtos/TlsCertificatesRequest.js +17 -0
- package/dist/interfaces/dtos/TlsCertificatesRequest.js.map +1 -0
- package/dist/interfaces/dtos/UploadExistingCertificate.d.ts +6 -0
- package/dist/interfaces/dtos/UploadExistingCertificate.js +10 -0
- package/dist/interfaces/dtos/UploadExistingCertificate.js.map +1 -0
- package/dist/interfaces/index.d.ts +35 -0
- package/dist/interfaces/index.js +28 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/projections/AuthorizationRestrictions.d.ts +18 -0
- package/dist/interfaces/projections/AuthorizationRestrictions.js +5 -0
- package/dist/interfaces/projections/AuthorizationRestrictions.js.map +1 -0
- package/dist/interfaces/projections/schemas/AuthorizationRestrictionsSchema.json +20 -0
- package/dist/interfaces/projections/schemas/TariffSchema.json +37 -0
- package/dist/interfaces/queries/Authorization.d.ts +5 -0
- package/dist/interfaces/queries/Authorization.js +17 -0
- package/dist/interfaces/queries/Authorization.js.map +1 -0
- package/dist/interfaces/queries/ChargingStation.d.ts +5 -0
- package/dist/interfaces/queries/ChargingStation.js +18 -0
- package/dist/interfaces/queries/ChargingStation.js.map +1 -0
- package/dist/interfaces/queries/Connection.d.ts +5 -0
- package/dist/interfaces/queries/Connection.js +17 -0
- package/dist/interfaces/queries/Connection.js.map +1 -0
- package/dist/interfaces/queries/Model.d.ts +5 -0
- package/dist/interfaces/queries/Model.js +18 -0
- package/dist/interfaces/queries/Model.js.map +1 -0
- package/dist/interfaces/queries/NetworkProfile.d.ts +11 -0
- package/dist/interfaces/queries/NetworkProfile.js +36 -0
- package/dist/interfaces/queries/NetworkProfile.js.map +1 -0
- package/dist/interfaces/queries/RootCertificate.d.ts +4 -0
- package/dist/interfaces/queries/RootCertificate.js +100 -0
- package/dist/interfaces/queries/RootCertificate.js.map +1 -0
- package/dist/interfaces/queries/Subscription.d.ts +1 -0
- package/dist/interfaces/queries/Subscription.js +37 -0
- package/dist/interfaces/queries/Subscription.js.map +1 -0
- package/dist/interfaces/queries/Tariff.d.ts +5 -0
- package/dist/interfaces/queries/Tariff.js +17 -0
- package/dist/interfaces/queries/Tariff.js.map +1 -0
- package/dist/interfaces/queries/Tenant.d.ts +5 -0
- package/dist/interfaces/queries/Tenant.js +41 -0
- package/dist/interfaces/queries/Tenant.js.map +1 -0
- package/dist/interfaces/queries/TlsCertificate.d.ts +5 -0
- package/dist/interfaces/queries/TlsCertificate.js +32 -0
- package/dist/interfaces/queries/TlsCertificate.js.map +1 -0
- package/dist/interfaces/queries/TransactionEvent.d.ts +6 -0
- package/dist/interfaces/queries/TransactionEvent.js +23 -0
- package/dist/interfaces/queries/TransactionEvent.js.map +1 -0
- package/dist/interfaces/queries/UpdateChargingStationPasswordQuery.d.ts +5 -0
- package/dist/interfaces/queries/UpdateChargingStationPasswordQuery.js +17 -0
- package/dist/interfaces/queries/UpdateChargingStationPasswordQuery.js.map +1 -0
- package/dist/interfaces/queries/VariableAttribute.d.ts +21 -0
- package/dist/interfaces/queries/VariableAttribute.js +71 -0
- package/dist/interfaces/queries/VariableAttribute.js.map +1 -0
- package/dist/interfaces/queries/Websocket.d.ts +17 -0
- package/dist/interfaces/queries/Websocket.js +115 -0
- package/dist/interfaces/queries/Websocket.js.map +1 -0
- package/dist/interfaces/repositories.d.ts +164 -0
- package/dist/interfaces/repositories.js +5 -0
- package/dist/interfaces/repositories.js.map +1 -0
- package/dist/layers/sequelize/index.d.ts +51 -0
- package/dist/layers/sequelize/index.js +58 -0
- package/dist/layers/sequelize/index.js.map +1 -0
- package/dist/layers/sequelize/mapper/1.6/AuthorizationMapper.d.ts +6 -0
- package/dist/layers/sequelize/mapper/1.6/AuthorizationMapper.js +37 -0
- package/dist/layers/sequelize/mapper/1.6/AuthorizationMapper.js.map +1 -0
- package/dist/layers/sequelize/mapper/1.6/BootMapper.d.ts +4 -0
- package/dist/layers/sequelize/mapper/1.6/BootMapper.js +19 -0
- package/dist/layers/sequelize/mapper/1.6/BootMapper.js.map +1 -0
- package/dist/layers/sequelize/mapper/1.6/ChargingProfileMapper.d.ts +66 -0
- package/dist/layers/sequelize/mapper/1.6/ChargingProfileMapper.js +82 -0
- package/dist/layers/sequelize/mapper/1.6/ChargingProfileMapper.js.map +1 -0
- package/dist/layers/sequelize/mapper/1.6/LocationMapper.d.ts +6 -0
- package/dist/layers/sequelize/mapper/1.6/LocationMapper.js +69 -0
- package/dist/layers/sequelize/mapper/1.6/LocationMapper.js.map +1 -0
- package/dist/layers/sequelize/mapper/1.6/MeterValueMapper.d.ts +65 -0
- package/dist/layers/sequelize/mapper/1.6/MeterValueMapper.js +431 -0
- package/dist/layers/sequelize/mapper/1.6/MeterValueMapper.js.map +1 -0
- package/dist/layers/sequelize/mapper/1.6/index.d.ts +5 -0
- package/dist/layers/sequelize/mapper/1.6/index.js +9 -0
- package/dist/layers/sequelize/mapper/1.6/index.js.map +1 -0
- package/dist/layers/sequelize/mapper/2.0.1/AuthorizationMapper.d.ts +14 -0
- package/dist/layers/sequelize/mapper/2.0.1/AuthorizationMapper.js +153 -0
- package/dist/layers/sequelize/mapper/2.0.1/AuthorizationMapper.js.map +1 -0
- package/dist/layers/sequelize/mapper/2.0.1/BootMapper.d.ts +5 -0
- package/dist/layers/sequelize/mapper/2.0.1/BootMapper.js +29 -0
- package/dist/layers/sequelize/mapper/2.0.1/BootMapper.js.map +1 -0
- package/dist/layers/sequelize/mapper/2.0.1/ChargingProfileMapper.d.ts +84 -0
- package/dist/layers/sequelize/mapper/2.0.1/ChargingProfileMapper.js +152 -0
- package/dist/layers/sequelize/mapper/2.0.1/ChargingProfileMapper.js.map +1 -0
- package/dist/layers/sequelize/mapper/2.0.1/LocationMapper.d.ts +5 -0
- package/dist/layers/sequelize/mapper/2.0.1/LocationMapper.js +23 -0
- package/dist/layers/sequelize/mapper/2.0.1/LocationMapper.js.map +1 -0
- package/dist/layers/sequelize/mapper/2.0.1/MeterValueMapper.d.ts +45 -0
- package/dist/layers/sequelize/mapper/2.0.1/MeterValueMapper.js +375 -0
- package/dist/layers/sequelize/mapper/2.0.1/MeterValueMapper.js.map +1 -0
- package/dist/layers/sequelize/mapper/2.0.1/TransactionMapper.d.ts +5 -0
- package/dist/layers/sequelize/mapper/2.0.1/TransactionMapper.js +18 -0
- package/dist/layers/sequelize/mapper/2.0.1/TransactionMapper.js.map +1 -0
- package/dist/layers/sequelize/mapper/2.0.1/index.d.ts +6 -0
- package/dist/layers/sequelize/mapper/2.0.1/index.js +10 -0
- package/dist/layers/sequelize/mapper/2.0.1/index.js.map +1 -0
- package/dist/layers/sequelize/model/AsyncJob/AsyncJobStatus.d.ts +45 -0
- package/dist/layers/sequelize/model/AsyncJob/AsyncJobStatus.js +137 -0
- package/dist/layers/sequelize/model/AsyncJob/AsyncJobStatus.js.map +1 -0
- package/dist/layers/sequelize/model/AsyncJob/index.d.ts +1 -0
- package/dist/layers/sequelize/model/AsyncJob/index.js +5 -0
- package/dist/layers/sequelize/model/AsyncJob/index.js.map +1 -0
- package/dist/layers/sequelize/model/Authorization/Authorization.d.ts +29 -0
- package/dist/layers/sequelize/model/Authorization/Authorization.js +122 -0
- package/dist/layers/sequelize/model/Authorization/Authorization.js.map +1 -0
- package/dist/layers/sequelize/model/Authorization/LocalListAuthorization.d.ts +39 -0
- package/dist/layers/sequelize/model/Authorization/LocalListAuthorization.js +141 -0
- package/dist/layers/sequelize/model/Authorization/LocalListAuthorization.js.map +1 -0
- package/dist/layers/sequelize/model/Authorization/LocalListVersion.d.ts +15 -0
- package/dist/layers/sequelize/model/Authorization/LocalListVersion.js +74 -0
- package/dist/layers/sequelize/model/Authorization/LocalListVersion.js.map +1 -0
- package/dist/layers/sequelize/model/Authorization/LocalListVersionAuthorization.d.ts +11 -0
- package/dist/layers/sequelize/model/Authorization/LocalListVersionAuthorization.js +69 -0
- package/dist/layers/sequelize/model/Authorization/LocalListVersionAuthorization.js.map +1 -0
- package/dist/layers/sequelize/model/Authorization/SendLocalList.d.ts +17 -0
- package/dist/layers/sequelize/model/Authorization/SendLocalList.js +108 -0
- package/dist/layers/sequelize/model/Authorization/SendLocalList.js.map +1 -0
- package/dist/layers/sequelize/model/Authorization/SendLocalListAuthorization.d.ts +11 -0
- package/dist/layers/sequelize/model/Authorization/SendLocalListAuthorization.js +69 -0
- package/dist/layers/sequelize/model/Authorization/SendLocalListAuthorization.js.map +1 -0
- package/dist/layers/sequelize/model/Authorization/index.d.ts +6 -0
- package/dist/layers/sequelize/model/Authorization/index.js +10 -0
- package/dist/layers/sequelize/model/Authorization/index.js.map +1 -0
- package/dist/layers/sequelize/model/AuthorizationTenant.d.ts +5 -0
- package/dist/layers/sequelize/model/AuthorizationTenant.js +32 -0
- package/dist/layers/sequelize/model/AuthorizationTenant.js.map +1 -0
- package/dist/layers/sequelize/model/BaseModelWithTenant.d.ts +8 -0
- package/dist/layers/sequelize/model/BaseModelWithTenant.js +50 -0
- package/dist/layers/sequelize/model/BaseModelWithTenant.js.map +1 -0
- package/dist/layers/sequelize/model/Boot.d.ts +29 -0
- package/dist/layers/sequelize/model/Boot.js +112 -0
- package/dist/layers/sequelize/model/Boot.js.map +1 -0
- package/dist/layers/sequelize/model/Cdrs/Cdrs.d.ts +105 -0
- package/dist/layers/sequelize/model/Cdrs/Cdrs.js +180 -0
- package/dist/layers/sequelize/model/Cdrs/Cdrs.js.map +1 -0
- package/dist/layers/sequelize/model/Cdrs/index.d.ts +1 -0
- package/dist/layers/sequelize/model/Cdrs/index.js +2 -0
- package/dist/layers/sequelize/model/Cdrs/index.js.map +1 -0
- package/dist/layers/sequelize/model/Certificate/Certificate.d.ts +27 -0
- package/dist/layers/sequelize/model/Certificate/Certificate.js +128 -0
- package/dist/layers/sequelize/model/Certificate/Certificate.js.map +1 -0
- package/dist/layers/sequelize/model/Certificate/DeleteCertificateAttempt.d.ts +17 -0
- package/dist/layers/sequelize/model/Certificate/DeleteCertificateAttempt.js +95 -0
- package/dist/layers/sequelize/model/Certificate/DeleteCertificateAttempt.js.map +1 -0
- package/dist/layers/sequelize/model/Certificate/InstallCertificateAttempt.d.ts +17 -0
- package/dist/layers/sequelize/model/Certificate/InstallCertificateAttempt.js +98 -0
- package/dist/layers/sequelize/model/Certificate/InstallCertificateAttempt.js.map +1 -0
- package/dist/layers/sequelize/model/Certificate/InstalledCertificate.d.ts +18 -0
- package/dist/layers/sequelize/model/Certificate/InstalledCertificate.js +108 -0
- package/dist/layers/sequelize/model/Certificate/InstalledCertificate.js.map +1 -0
- package/dist/layers/sequelize/model/Certificate/index.d.ts +11 -0
- package/dist/layers/sequelize/model/Certificate/index.js +17 -0
- package/dist/layers/sequelize/model/Certificate/index.js.map +1 -0
- package/dist/layers/sequelize/model/ChangeConfiguration.d.ts +13 -0
- package/dist/layers/sequelize/model/ChangeConfiguration.js +80 -0
- package/dist/layers/sequelize/model/ChangeConfiguration.js.map +1 -0
- package/dist/layers/sequelize/model/ChargingProfile/ChargingNeeds.d.ts +27 -0
- package/dist/layers/sequelize/model/ChargingProfile/ChargingNeeds.js +99 -0
- package/dist/layers/sequelize/model/ChargingProfile/ChargingNeeds.js.map +1 -0
- package/dist/layers/sequelize/model/ChargingProfile/ChargingProfile.d.ts +31 -0
- package/dist/layers/sequelize/model/ChargingProfile/ChargingProfile.js +141 -0
- package/dist/layers/sequelize/model/ChargingProfile/ChargingProfile.js.map +1 -0
- package/dist/layers/sequelize/model/ChargingProfile/ChargingSchedule.d.ts +28 -0
- package/dist/layers/sequelize/model/ChargingProfile/ChargingSchedule.js +118 -0
- package/dist/layers/sequelize/model/ChargingProfile/ChargingSchedule.js.map +1 -0
- package/dist/layers/sequelize/model/ChargingProfile/CompositeSchedule.d.ts +16 -0
- package/dist/layers/sequelize/model/ChargingProfile/CompositeSchedule.js +86 -0
- package/dist/layers/sequelize/model/ChargingProfile/CompositeSchedule.js.map +1 -0
- package/dist/layers/sequelize/model/ChargingProfile/SalesTariff.d.ts +24 -0
- package/dist/layers/sequelize/model/ChargingProfile/SalesTariff.js +91 -0
- package/dist/layers/sequelize/model/ChargingProfile/SalesTariff.js.map +1 -0
- package/dist/layers/sequelize/model/ChargingProfile/index.d.ts +5 -0
- package/dist/layers/sequelize/model/ChargingProfile/index.js +9 -0
- package/dist/layers/sequelize/model/ChargingProfile/index.js.map +1 -0
- package/dist/layers/sequelize/model/ChargingStationSecurityInfo.d.ts +14 -0
- package/dist/layers/sequelize/model/ChargingStationSecurityInfo.js +76 -0
- package/dist/layers/sequelize/model/ChargingStationSecurityInfo.js.map +1 -0
- package/dist/layers/sequelize/model/ChargingStationSequence/ChargingStationSequence.d.ts +14 -0
- package/dist/layers/sequelize/model/ChargingStationSequence/ChargingStationSequence.js +85 -0
- package/dist/layers/sequelize/model/ChargingStationSequence/ChargingStationSequence.js.map +1 -0
- package/dist/layers/sequelize/model/ChargingStationSequence/index.d.ts +1 -0
- package/dist/layers/sequelize/model/ChargingStationSequence/index.js +5 -0
- package/dist/layers/sequelize/model/ChargingStationSequence/index.js.map +1 -0
- package/dist/layers/sequelize/model/DeviceModel/Component.d.ts +26 -0
- package/dist/layers/sequelize/model/DeviceModel/Component.js +99 -0
- package/dist/layers/sequelize/model/DeviceModel/Component.js.map +1 -0
- package/dist/layers/sequelize/model/DeviceModel/ComponentVariable.d.ts +11 -0
- package/dist/layers/sequelize/model/DeviceModel/ComponentVariable.js +69 -0
- package/dist/layers/sequelize/model/DeviceModel/ComponentVariable.js.map +1 -0
- package/dist/layers/sequelize/model/DeviceModel/EvseType.d.ts +17 -0
- package/dist/layers/sequelize/model/DeviceModel/EvseType.js +83 -0
- package/dist/layers/sequelize/model/DeviceModel/EvseType.js.map +1 -0
- package/dist/layers/sequelize/model/DeviceModel/Variable.d.ts +27 -0
- package/dist/layers/sequelize/model/DeviceModel/Variable.js +96 -0
- package/dist/layers/sequelize/model/DeviceModel/Variable.js.map +1 -0
- package/dist/layers/sequelize/model/DeviceModel/VariableAttribute.d.ts +38 -0
- package/dist/layers/sequelize/model/DeviceModel/VariableAttribute.js +242 -0
- package/dist/layers/sequelize/model/DeviceModel/VariableAttribute.js.map +1 -0
- package/dist/layers/sequelize/model/DeviceModel/VariableCharacteristics.d.ts +25 -0
- package/dist/layers/sequelize/model/DeviceModel/VariableCharacteristics.js +90 -0
- package/dist/layers/sequelize/model/DeviceModel/VariableCharacteristics.js.map +1 -0
- package/dist/layers/sequelize/model/DeviceModel/VariableStatus.d.ts +19 -0
- package/dist/layers/sequelize/model/DeviceModel/VariableStatus.js +75 -0
- package/dist/layers/sequelize/model/DeviceModel/VariableStatus.js.map +1 -0
- package/dist/layers/sequelize/model/DeviceModel/index.d.ts +6 -0
- package/dist/layers/sequelize/model/DeviceModel/index.js +10 -0
- package/dist/layers/sequelize/model/DeviceModel/index.js.map +1 -0
- package/dist/layers/sequelize/model/Location/ChargingStation.d.ts +56 -0
- package/dist/layers/sequelize/model/Location/ChargingStation.js +178 -0
- package/dist/layers/sequelize/model/Location/ChargingStation.js.map +1 -0
- package/dist/layers/sequelize/model/Location/ChargingStationNetworkProfile.d.ts +27 -0
- package/dist/layers/sequelize/model/Location/ChargingStationNetworkProfile.js +93 -0
- package/dist/layers/sequelize/model/Location/ChargingStationNetworkProfile.js.map +1 -0
- package/dist/layers/sequelize/model/Location/Connector.d.ts +32 -0
- package/dist/layers/sequelize/model/Location/Connector.js +166 -0
- package/dist/layers/sequelize/model/Location/Connector.js.map +1 -0
- package/dist/layers/sequelize/model/Location/Evse.d.ts +28 -0
- package/dist/layers/sequelize/model/Location/Evse.js +122 -0
- package/dist/layers/sequelize/model/Location/Evse.js.map +1 -0
- package/dist/layers/sequelize/model/Location/LatestStatusNotification.d.ts +16 -0
- package/dist/layers/sequelize/model/Location/LatestStatusNotification.js +74 -0
- package/dist/layers/sequelize/model/Location/LatestStatusNotification.js.map +1 -0
- package/dist/layers/sequelize/model/Location/Location.d.ts +44 -0
- package/dist/layers/sequelize/model/Location/Location.js +182 -0
- package/dist/layers/sequelize/model/Location/Location.js.map +1 -0
- package/dist/layers/sequelize/model/Location/ServerNetworkProfile.d.ts +26 -0
- package/dist/layers/sequelize/model/Location/ServerNetworkProfile.js +120 -0
- package/dist/layers/sequelize/model/Location/ServerNetworkProfile.js.map +1 -0
- package/dist/layers/sequelize/model/Location/SetNetworkProfile.d.ts +52 -0
- package/dist/layers/sequelize/model/Location/SetNetworkProfile.js +120 -0
- package/dist/layers/sequelize/model/Location/SetNetworkProfile.js.map +1 -0
- package/dist/layers/sequelize/model/Location/StatusNotification.d.ts +20 -0
- package/dist/layers/sequelize/model/Location/StatusNotification.js +100 -0
- package/dist/layers/sequelize/model/Location/StatusNotification.js.map +1 -0
- package/dist/layers/sequelize/model/Location/index.d.ts +9 -0
- package/dist/layers/sequelize/model/Location/index.js +13 -0
- package/dist/layers/sequelize/model/Location/index.js.map +1 -0
- package/dist/layers/sequelize/model/MessageInfo/MessageInfo.d.ts +29 -0
- package/dist/layers/sequelize/model/MessageInfo/MessageInfo.js +126 -0
- package/dist/layers/sequelize/model/MessageInfo/MessageInfo.js.map +1 -0
- package/dist/layers/sequelize/model/MessageInfo/index.d.ts +1 -0
- package/dist/layers/sequelize/model/MessageInfo/index.js +5 -0
- package/dist/layers/sequelize/model/MessageInfo/index.js.map +1 -0
- package/dist/layers/sequelize/model/OCPPMessage.d.ts +21 -0
- package/dist/layers/sequelize/model/OCPPMessage.js +110 -0
- package/dist/layers/sequelize/model/OCPPMessage.js.map +1 -0
- package/dist/layers/sequelize/model/Reservation.d.ts +29 -0
- package/dist/layers/sequelize/model/Reservation.js +116 -0
- package/dist/layers/sequelize/model/Reservation.js.map +1 -0
- package/dist/layers/sequelize/model/SecurityEvent.d.ts +18 -0
- package/dist/layers/sequelize/model/SecurityEvent.js +78 -0
- package/dist/layers/sequelize/model/SecurityEvent.js.map +1 -0
- package/dist/layers/sequelize/model/Subscription/Subscription.d.ts +16 -0
- package/dist/layers/sequelize/model/Subscription/Subscription.js +94 -0
- package/dist/layers/sequelize/model/Subscription/Subscription.js.map +1 -0
- package/dist/layers/sequelize/model/Subscription/index.d.ts +1 -0
- package/dist/layers/sequelize/model/Subscription/index.js +5 -0
- package/dist/layers/sequelize/model/Subscription/index.js.map +1 -0
- package/dist/layers/sequelize/model/Tariff/TariffElements.d.ts +12 -0
- package/dist/layers/sequelize/model/Tariff/TariffElements.js +57 -0
- package/dist/layers/sequelize/model/Tariff/TariffElements.js.map +1 -0
- package/dist/layers/sequelize/model/Tariff/Tariffs.d.ts +37 -0
- package/dist/layers/sequelize/model/Tariff/Tariffs.js +181 -0
- package/dist/layers/sequelize/model/Tariff/Tariffs.js.map +1 -0
- package/dist/layers/sequelize/model/Tariff/index.d.ts +1 -0
- package/dist/layers/sequelize/model/Tariff/index.js +5 -0
- package/dist/layers/sequelize/model/Tariff/index.js.map +1 -0
- package/dist/layers/sequelize/model/Tenant.d.ts +96 -0
- package/dist/layers/sequelize/model/Tenant.js +268 -0
- package/dist/layers/sequelize/model/Tenant.js.map +1 -0
- package/dist/layers/sequelize/model/TenantPartner.d.ts +14 -0
- package/dist/layers/sequelize/model/TenantPartner.js +70 -0
- package/dist/layers/sequelize/model/TenantPartner.js.map +1 -0
- package/dist/layers/sequelize/model/TransactionEvent/MeterValue.d.ts +18 -0
- package/dist/layers/sequelize/model/TransactionEvent/MeterValue.js +98 -0
- package/dist/layers/sequelize/model/TransactionEvent/MeterValue.js.map +1 -0
- package/dist/layers/sequelize/model/TransactionEvent/StartTransaction.d.ts +19 -0
- package/dist/layers/sequelize/model/TransactionEvent/StartTransaction.js +96 -0
- package/dist/layers/sequelize/model/TransactionEvent/StartTransaction.js.map +1 -0
- package/dist/layers/sequelize/model/TransactionEvent/StopTransaction.d.ts +20 -0
- package/dist/layers/sequelize/model/TransactionEvent/StopTransaction.js +100 -0
- package/dist/layers/sequelize/model/TransactionEvent/StopTransaction.js.map +1 -0
- package/dist/layers/sequelize/model/TransactionEvent/Transaction.d.ts +48 -0
- package/dist/layers/sequelize/model/TransactionEvent/Transaction.js +216 -0
- package/dist/layers/sequelize/model/TransactionEvent/Transaction.js.map +1 -0
- package/dist/layers/sequelize/model/TransactionEvent/TransactionEvent.d.ts +30 -0
- package/dist/layers/sequelize/model/TransactionEvent/TransactionEvent.js +129 -0
- package/dist/layers/sequelize/model/TransactionEvent/TransactionEvent.js.map +1 -0
- package/dist/layers/sequelize/model/TransactionEvent/index.d.ts +5 -0
- package/dist/layers/sequelize/model/TransactionEvent/index.js +9 -0
- package/dist/layers/sequelize/model/TransactionEvent/index.js.map +1 -0
- package/dist/layers/sequelize/model/VariableMonitoring/EventData.d.ts +33 -0
- package/dist/layers/sequelize/model/VariableMonitoring/EventData.js +137 -0
- package/dist/layers/sequelize/model/VariableMonitoring/EventData.js.map +1 -0
- package/dist/layers/sequelize/model/VariableMonitoring/VariableMonitoring.d.ts +28 -0
- package/dist/layers/sequelize/model/VariableMonitoring/VariableMonitoring.js +113 -0
- package/dist/layers/sequelize/model/VariableMonitoring/VariableMonitoring.js.map +1 -0
- package/dist/layers/sequelize/model/VariableMonitoring/VariableMonitoringStatus.d.ts +18 -0
- package/dist/layers/sequelize/model/VariableMonitoring/VariableMonitoringStatus.js +71 -0
- package/dist/layers/sequelize/model/VariableMonitoring/VariableMonitoringStatus.js.map +1 -0
- package/dist/layers/sequelize/model/VariableMonitoring/index.d.ts +3 -0
- package/dist/layers/sequelize/model/VariableMonitoring/index.js +7 -0
- package/dist/layers/sequelize/model/VariableMonitoring/index.js.map +1 -0
- package/dist/layers/sequelize/model/index.d.ts +22 -0
- package/dist/layers/sequelize/model/index.js +27 -0
- package/dist/layers/sequelize/model/index.js.map +1 -0
- package/dist/layers/sequelize/repository/AsyncJobStatus.d.ts +24 -0
- package/dist/layers/sequelize/repository/AsyncJobStatus.js +39 -0
- package/dist/layers/sequelize/repository/AsyncJobStatus.js.map +1 -0
- package/dist/layers/sequelize/repository/Authorization.d.ts +18 -0
- package/dist/layers/sequelize/repository/Authorization.js +51 -0
- package/dist/layers/sequelize/repository/Authorization.js.map +1 -0
- package/dist/layers/sequelize/repository/Base.d.ts +28 -0
- package/dist/layers/sequelize/repository/Base.js +135 -0
- package/dist/layers/sequelize/repository/Base.js.map +1 -0
- package/dist/layers/sequelize/repository/BaseJunction.d.ts +33 -0
- package/dist/layers/sequelize/repository/BaseJunction.js +178 -0
- package/dist/layers/sequelize/repository/BaseJunction.js.map +1 -0
- package/dist/layers/sequelize/repository/Boot.d.ts +20 -0
- package/dist/layers/sequelize/repository/Boot.js +78 -0
- package/dist/layers/sequelize/repository/Boot.js.map +1 -0
- package/dist/layers/sequelize/repository/Certificate.d.ts +11 -0
- package/dist/layers/sequelize/repository/Certificate.js +39 -0
- package/dist/layers/sequelize/repository/Certificate.js.map +1 -0
- package/dist/layers/sequelize/repository/ChangeConfiguration.d.ts +10 -0
- package/dist/layers/sequelize/repository/ChangeConfiguration.js +36 -0
- package/dist/layers/sequelize/repository/ChangeConfiguration.js.map +1 -0
- package/dist/layers/sequelize/repository/ChargingProfile.d.ts +25 -0
- package/dist/layers/sequelize/repository/ChargingProfile.js +156 -0
- package/dist/layers/sequelize/repository/ChargingProfile.js.map +1 -0
- package/dist/layers/sequelize/repository/ChargingStationSecurityInfo.d.ts +12 -0
- package/dist/layers/sequelize/repository/ChargingStationSecurityInfo.js +28 -0
- package/dist/layers/sequelize/repository/ChargingStationSecurityInfo.js.map +1 -0
- package/dist/layers/sequelize/repository/ChargingStationSequence.d.ts +21 -0
- package/dist/layers/sequelize/repository/ChargingStationSequence.js +52 -0
- package/dist/layers/sequelize/repository/ChargingStationSequence.js.map +1 -0
- package/dist/layers/sequelize/repository/DeleteCertificateAttempt.d.ts +10 -0
- package/dist/layers/sequelize/repository/DeleteCertificateAttempt.js +13 -0
- package/dist/layers/sequelize/repository/DeleteCertificateAttempt.js.map +1 -0
- package/dist/layers/sequelize/repository/DeviceModel.d.ts +36 -0
- package/dist/layers/sequelize/repository/DeviceModel.js +417 -0
- package/dist/layers/sequelize/repository/DeviceModel.js.map +1 -0
- package/dist/layers/sequelize/repository/InstallCertificateAttempt.d.ts +10 -0
- package/dist/layers/sequelize/repository/InstallCertificateAttempt.js +13 -0
- package/dist/layers/sequelize/repository/InstallCertificateAttempt.js.map +1 -0
- package/dist/layers/sequelize/repository/InstalledCertificate.d.ts +10 -0
- package/dist/layers/sequelize/repository/InstalledCertificate.js +13 -0
- package/dist/layers/sequelize/repository/InstalledCertificate.js.map +1 -0
- package/dist/layers/sequelize/repository/LocalAuthList.d.ts +20 -0
- package/dist/layers/sequelize/repository/LocalAuthList.js +192 -0
- package/dist/layers/sequelize/repository/LocalAuthList.js.map +1 -0
- package/dist/layers/sequelize/repository/Location.d.ts +30 -0
- package/dist/layers/sequelize/repository/Location.js +263 -0
- package/dist/layers/sequelize/repository/Location.js.map +1 -0
- package/dist/layers/sequelize/repository/MessageInfo.d.ts +13 -0
- package/dist/layers/sequelize/repository/MessageInfo.js +55 -0
- package/dist/layers/sequelize/repository/MessageInfo.js.map +1 -0
- package/dist/layers/sequelize/repository/OCPPMessage.d.ts +12 -0
- package/dist/layers/sequelize/repository/OCPPMessage.js +65 -0
- package/dist/layers/sequelize/repository/OCPPMessage.js.map +1 -0
- package/dist/layers/sequelize/repository/RepositoryStore.d.ts +34 -0
- package/dist/layers/sequelize/repository/RepositoryStore.js +79 -0
- package/dist/layers/sequelize/repository/RepositoryStore.js.map +1 -0
- package/dist/layers/sequelize/repository/Reservation.d.ts +15 -0
- package/dist/layers/sequelize/repository/Reservation.js +68 -0
- package/dist/layers/sequelize/repository/Reservation.js.map +1 -0
- package/dist/layers/sequelize/repository/SecurityEvent.d.ts +18 -0
- package/dist/layers/sequelize/repository/SecurityEvent.js +46 -0
- package/dist/layers/sequelize/repository/SecurityEvent.js.map +1 -0
- package/dist/layers/sequelize/repository/ServerNetworkProfile.d.ts +14 -0
- package/dist/layers/sequelize/repository/ServerNetworkProfile.js +40 -0
- package/dist/layers/sequelize/repository/ServerNetworkProfile.js.map +1 -0
- package/dist/layers/sequelize/repository/Subscription.d.ts +20 -0
- package/dist/layers/sequelize/repository/Subscription.js +32 -0
- package/dist/layers/sequelize/repository/Subscription.js.map +1 -0
- package/dist/layers/sequelize/repository/Tariff.d.ts +15 -0
- package/dist/layers/sequelize/repository/Tariff.js +64 -0
- package/dist/layers/sequelize/repository/Tariff.js.map +1 -0
- package/dist/layers/sequelize/repository/Tenant.d.ts +11 -0
- package/dist/layers/sequelize/repository/Tenant.js +21 -0
- package/dist/layers/sequelize/repository/Tenant.js.map +1 -0
- package/dist/layers/sequelize/repository/TransactionEvent.d.ts +46 -0
- package/dist/layers/sequelize/repository/TransactionEvent.js +597 -0
- package/dist/layers/sequelize/repository/TransactionEvent.js.map +1 -0
- package/dist/layers/sequelize/repository/VariableMonitoring.d.ts +20 -0
- package/dist/layers/sequelize/repository/VariableMonitoring.js +168 -0
- package/dist/layers/sequelize/repository/VariableMonitoring.js.map +1 -0
- package/dist/layers/sequelize/util.d.ts +18 -0
- package/dist/layers/sequelize/util.js +143 -0
- package/dist/layers/sequelize/util.js.map +1 -0
- package/dist/util/CryptoUtils.d.ts +6 -0
- package/dist/util/CryptoUtils.js +14 -0
- package/dist/util/CryptoUtils.js.map +1 -0
- package/dist/util/PasswordHashAlgorithm.d.ts +15 -0
- package/dist/util/PasswordHashAlgorithm.js +2 -0
- package/dist/util/PasswordHashAlgorithm.js.map +1 -0
- package/dist/util/Pbkdf2.d.ts +9 -0
- package/dist/util/Pbkdf2.js +20 -0
- package/dist/util/Pbkdf2.js.map +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { BootstrapConfig, MeterValueDto } from '@citrineos/base';
|
|
2
|
+
import { CrudRepository, OCPP1_6, OCPP2_0_1 } from '@citrineos/base';
|
|
3
|
+
import { Sequelize } from 'sequelize-typescript';
|
|
4
|
+
import type { ILogObj } from 'tslog';
|
|
5
|
+
import { Logger } from 'tslog';
|
|
6
|
+
import type { IChargingStationSequenceRepository, ITransactionEventRepository } from '../../../interfaces/index.js';
|
|
7
|
+
import { ChargingStation, Connector, Evse, MeterValue, StartTransaction, StopTransaction, Transaction, TransactionEvent } from '../model/index.js';
|
|
8
|
+
import { SequelizeRepository } from './Base.js';
|
|
9
|
+
export declare class SequelizeTransactionEventRepository extends SequelizeRepository<TransactionEvent> implements ITransactionEventRepository {
|
|
10
|
+
transaction: CrudRepository<Transaction>;
|
|
11
|
+
evse: CrudRepository<Evse>;
|
|
12
|
+
station: CrudRepository<ChargingStation>;
|
|
13
|
+
meterValue: CrudRepository<MeterValue>;
|
|
14
|
+
startTransaction: CrudRepository<StartTransaction>;
|
|
15
|
+
stopTransaction: CrudRepository<StopTransaction>;
|
|
16
|
+
connector: CrudRepository<Connector>;
|
|
17
|
+
chargingStationSequence: IChargingStationSequenceRepository;
|
|
18
|
+
constructor(config: BootstrapConfig, logger?: Logger<ILogObj>, namespace?: string, sequelizeInstance?: Sequelize, transaction?: CrudRepository<Transaction>, station?: CrudRepository<ChargingStation>, evse?: CrudRepository<Evse>, meterValue?: CrudRepository<MeterValue>, startTransaction?: CrudRepository<StartTransaction>, stopTransaction?: CrudRepository<StopTransaction>, connector?: CrudRepository<Connector>, chargingStationSequence?: IChargingStationSequenceRepository);
|
|
19
|
+
/**
|
|
20
|
+
* @param value TransactionEventRequest received from charging station. Will be used to create TransactionEvent,
|
|
21
|
+
* MeterValues, and either create or update Transaction. IdTokens (and associated AdditionalInfo) and EVSEs are
|
|
22
|
+
* assumed to already exist and will not be created as part of this call.
|
|
23
|
+
*
|
|
24
|
+
* @param stationId StationId of charging station which sent TransactionEventRequest.
|
|
25
|
+
*
|
|
26
|
+
* @returns Saved TransactionEvent
|
|
27
|
+
*/
|
|
28
|
+
createOrUpdateTransactionByTransactionEventAndStationId(tenantId: number, value: OCPP2_0_1.TransactionEventRequest, stationId: string): Promise<Transaction>;
|
|
29
|
+
readAllByStationIdAndTransactionId(tenantId: number, stationId: string, transactionId: string): Promise<TransactionEvent[]>;
|
|
30
|
+
readTransactionByStationIdAndTransactionId(tenantId: number, stationId: string, transactionId: string): Promise<Transaction | undefined>;
|
|
31
|
+
readAllTransactionsByStationIdAndEvseAndChargingStates(tenantId: number, stationId: string, evse?: OCPP2_0_1.EVSEType, chargingStates?: OCPP2_0_1.ChargingStateEnumType[] | undefined): Promise<Transaction[]>;
|
|
32
|
+
readAllActiveTransactionsByAuthorizationId(tenantId: number, authorizationId: number): Promise<Transaction[]>;
|
|
33
|
+
readAllMeterValuesByTransactionDataBaseId(tenantId: number, transactionDataBaseId: number): Promise<MeterValue[]>;
|
|
34
|
+
findByTransactionId(tenantId: number, transactionId: string): Promise<Transaction | undefined>;
|
|
35
|
+
getTransactions(tenantId: number, dateFrom?: Date, dateTo?: Date, offset?: number, limit?: number): Promise<Transaction[]>;
|
|
36
|
+
getTransactionsCount(tenantId: number, dateFrom?: Date, dateTo?: Date): Promise<number>;
|
|
37
|
+
readAllTransactionsByQuery(tenantId: number, query: object): Promise<Transaction[]>;
|
|
38
|
+
getEvseIdsWithActiveTransactionByStationId(tenantId: number, stationId: string): Promise<number[]>;
|
|
39
|
+
getActiveTransactionByStationIdAndEvseId(tenantId: number, stationId: string, evseId: number): Promise<Transaction | undefined>;
|
|
40
|
+
createMeterValue(tenantId: number, meterValue: OCPP2_0_1.MeterValueType, transactionDatabaseId?: number | null, transactionId?: string | null, tariffId?: number | null): Promise<MeterValue>;
|
|
41
|
+
updateTransactionTotalCostById(tenantId: number, totalCost: number, id: number): Promise<void>;
|
|
42
|
+
updateTransactionByMeterValues(tenantId: number, meterValues: MeterValueDto[], stationId: string, transactionId: number): Promise<void>;
|
|
43
|
+
createTransactionByStartTransaction(tenantId: number, request: OCPP1_6.StartTransactionRequest, stationId: string): Promise<Transaction>;
|
|
44
|
+
createStopTransaction(tenantId: number, transactionDatabaseId: number, stationId: string, meterStop: number, timestamp: Date, meterValues: MeterValueDto[], reason?: string): Promise<StopTransaction>;
|
|
45
|
+
updateTransactionByStationIdAndTransactionId(tenantId: number, transaction: Partial<Transaction>, transactionId: string, stationId: string): Promise<Transaction | undefined>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
import { ChargingStationSequenceTypeEnum, CrudRepository, MeterValueUtils, OCPP1_6, OCPP2_0_1, } from '@citrineos/base';
|
|
2
|
+
import { Op } from 'sequelize';
|
|
3
|
+
import { Sequelize } from 'sequelize-typescript';
|
|
4
|
+
import { Logger } from 'tslog';
|
|
5
|
+
import { OCPP2_0_1_Mapper } from '../index.js';
|
|
6
|
+
import { AuthorizationMapper } from '../mapper/2.0.1/index.js';
|
|
7
|
+
import { Authorization, AuthorizationTenant, ChargingStation, Connector, Evse, EvseType, MeterValue, StartTransaction, StopTransaction, Tariff, Transaction, TransactionEvent, } from '../model/index.js';
|
|
8
|
+
import { SequelizeRepository } from './Base.js';
|
|
9
|
+
import { SequelizeChargingStationSequenceRepository } from './ChargingStationSequence.js';
|
|
10
|
+
export class SequelizeTransactionEventRepository extends SequelizeRepository {
|
|
11
|
+
transaction;
|
|
12
|
+
evse;
|
|
13
|
+
station;
|
|
14
|
+
meterValue;
|
|
15
|
+
startTransaction;
|
|
16
|
+
stopTransaction;
|
|
17
|
+
connector;
|
|
18
|
+
chargingStationSequence;
|
|
19
|
+
constructor(config, logger, namespace = TransactionEvent.MODEL_NAME, sequelizeInstance, transaction, station, evse, meterValue, startTransaction, stopTransaction, connector, chargingStationSequence) {
|
|
20
|
+
super(config, namespace, logger, sequelizeInstance);
|
|
21
|
+
this.transaction = transaction
|
|
22
|
+
? transaction
|
|
23
|
+
: new SequelizeRepository(config, Transaction.MODEL_NAME, logger, sequelizeInstance);
|
|
24
|
+
this.evse = evse
|
|
25
|
+
? evse
|
|
26
|
+
: new SequelizeRepository(config, Evse.MODEL_NAME, logger, sequelizeInstance);
|
|
27
|
+
this.station = station
|
|
28
|
+
? station
|
|
29
|
+
: new SequelizeRepository(config, ChargingStation.MODEL_NAME, logger, sequelizeInstance);
|
|
30
|
+
this.meterValue = meterValue
|
|
31
|
+
? meterValue
|
|
32
|
+
: new SequelizeRepository(config, MeterValue.MODEL_NAME, logger, sequelizeInstance);
|
|
33
|
+
this.startTransaction = startTransaction
|
|
34
|
+
? startTransaction
|
|
35
|
+
: new SequelizeRepository(config, StartTransaction.MODEL_NAME, logger, sequelizeInstance);
|
|
36
|
+
this.stopTransaction = stopTransaction
|
|
37
|
+
? stopTransaction
|
|
38
|
+
: new SequelizeRepository(config, StopTransaction.MODEL_NAME, logger, sequelizeInstance);
|
|
39
|
+
this.connector = connector
|
|
40
|
+
? connector
|
|
41
|
+
: new SequelizeRepository(config, Connector.MODEL_NAME, logger, sequelizeInstance);
|
|
42
|
+
this.chargingStationSequence =
|
|
43
|
+
chargingStationSequence || new SequelizeChargingStationSequenceRepository(config, logger);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @param value TransactionEventRequest received from charging station. Will be used to create TransactionEvent,
|
|
47
|
+
* MeterValues, and either create or update Transaction. IdTokens (and associated AdditionalInfo) and EVSEs are
|
|
48
|
+
* assumed to already exist and will not be created as part of this call.
|
|
49
|
+
*
|
|
50
|
+
* @param stationId StationId of charging station which sent TransactionEventRequest.
|
|
51
|
+
*
|
|
52
|
+
* @returns Saved TransactionEvent
|
|
53
|
+
*/
|
|
54
|
+
async createOrUpdateTransactionByTransactionEventAndStationId(tenantId, value, stationId) {
|
|
55
|
+
return await this.s.transaction(async (sequelizeTransaction) => {
|
|
56
|
+
let finalTransaction;
|
|
57
|
+
let created = false;
|
|
58
|
+
const existingTransaction = await this.transaction.readOnlyOneByQuery(tenantId, {
|
|
59
|
+
where: {
|
|
60
|
+
stationId,
|
|
61
|
+
transactionId: value.transactionInfo.transactionId,
|
|
62
|
+
},
|
|
63
|
+
transaction: sequelizeTransaction,
|
|
64
|
+
});
|
|
65
|
+
if (existingTransaction) {
|
|
66
|
+
let evseId = existingTransaction.evseId;
|
|
67
|
+
if (!evseId && value.evse) {
|
|
68
|
+
const [evse] = await this.evse.readOrCreateByQuery(tenantId, {
|
|
69
|
+
where: {
|
|
70
|
+
tenantId,
|
|
71
|
+
stationId,
|
|
72
|
+
evseTypeId: value.evse.id,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
evseId = evse.id;
|
|
76
|
+
}
|
|
77
|
+
let connectorId = existingTransaction.connectorId;
|
|
78
|
+
let tariffId = existingTransaction.tariffId;
|
|
79
|
+
if (!connectorId && value.evse?.connectorId) {
|
|
80
|
+
const [evse] = await this.evse.readOrCreateByQuery(tenantId, {
|
|
81
|
+
where: {
|
|
82
|
+
tenantId,
|
|
83
|
+
stationId,
|
|
84
|
+
evseTypeId: value.evse.id,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
const [connector] = await this.connector.readOrCreateByQuery(tenantId, {
|
|
88
|
+
where: {
|
|
89
|
+
tenantId,
|
|
90
|
+
stationId,
|
|
91
|
+
evseId: evse.id,
|
|
92
|
+
evseTypeConnectorId: value.evse.connectorId,
|
|
93
|
+
},
|
|
94
|
+
include: [Tariff],
|
|
95
|
+
});
|
|
96
|
+
connectorId = connector.id;
|
|
97
|
+
tariffId = connector.tariffs?.[0]?.id;
|
|
98
|
+
}
|
|
99
|
+
let authorizationId = existingTransaction.authorizationId;
|
|
100
|
+
if (!authorizationId && value.idToken) {
|
|
101
|
+
// Find Authorization by IdToken
|
|
102
|
+
const authorization = await Authorization.findOne({
|
|
103
|
+
where: {
|
|
104
|
+
idToken: value.idToken.idToken,
|
|
105
|
+
idTokenType: OCPP2_0_1_Mapper.AuthorizationMapper.fromIdTokenEnumType(value.idToken.type),
|
|
106
|
+
},
|
|
107
|
+
transaction: sequelizeTransaction,
|
|
108
|
+
include: [
|
|
109
|
+
{
|
|
110
|
+
model: AuthorizationTenant,
|
|
111
|
+
as: 'tenants',
|
|
112
|
+
required: true,
|
|
113
|
+
where: { tenantId },
|
|
114
|
+
attributes: [],
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
});
|
|
118
|
+
if (authorization) {
|
|
119
|
+
authorizationId = authorization.id;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
this.logger.warn(`Authorization with idToken ${value.idToken.idToken} : ${value.idToken.type} does not exist. Transaction ${existingTransaction.transactionId} will not be associated with an authorization.`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
finalTransaction = await existingTransaction.update({
|
|
126
|
+
isActive: value.eventType !== OCPP2_0_1.TransactionEventEnumType.Ended,
|
|
127
|
+
endTime: value.eventType === OCPP2_0_1.TransactionEventEnumType.Ended
|
|
128
|
+
? value.timestamp
|
|
129
|
+
: undefined,
|
|
130
|
+
...value.transactionInfo,
|
|
131
|
+
authorizationId,
|
|
132
|
+
evseId,
|
|
133
|
+
connectorId,
|
|
134
|
+
tariffId,
|
|
135
|
+
}, {
|
|
136
|
+
transaction: sequelizeTransaction,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
const newTransaction = Transaction.build({
|
|
141
|
+
tenantId,
|
|
142
|
+
stationId,
|
|
143
|
+
isActive: value.eventType !== OCPP2_0_1.TransactionEventEnumType.Ended,
|
|
144
|
+
startTime: value.eventType === OCPP2_0_1.TransactionEventEnumType.Started
|
|
145
|
+
? value.timestamp
|
|
146
|
+
: undefined,
|
|
147
|
+
...value.transactionInfo,
|
|
148
|
+
});
|
|
149
|
+
if (value.evse) {
|
|
150
|
+
const [evse] = await this.evse.readOrCreateByQuery(tenantId, {
|
|
151
|
+
where: {
|
|
152
|
+
tenantId,
|
|
153
|
+
stationId,
|
|
154
|
+
evseTypeId: value.evse.id,
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
newTransaction.set('evseId', evse.id);
|
|
158
|
+
if (value.evse?.connectorId) {
|
|
159
|
+
const [connector] = await this.connector.readOrCreateByQuery(tenantId, {
|
|
160
|
+
where: {
|
|
161
|
+
tenantId,
|
|
162
|
+
stationId,
|
|
163
|
+
evseId: evse.id,
|
|
164
|
+
evseTypeConnectorId: value.evse.connectorId,
|
|
165
|
+
},
|
|
166
|
+
include: [Tariff],
|
|
167
|
+
});
|
|
168
|
+
newTransaction.set('connectorId', connector.id);
|
|
169
|
+
newTransaction.set('tariffId', connector.tariffs?.[0]?.id);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (value.idToken) {
|
|
173
|
+
// Find Authorization by IdToken
|
|
174
|
+
const authorization = await Authorization.findOne({
|
|
175
|
+
where: {
|
|
176
|
+
idToken: value.idToken.idToken,
|
|
177
|
+
idTokenType: OCPP2_0_1_Mapper.AuthorizationMapper.fromIdTokenEnumType(value.idToken.type),
|
|
178
|
+
},
|
|
179
|
+
transaction: sequelizeTransaction,
|
|
180
|
+
include: [
|
|
181
|
+
{
|
|
182
|
+
model: AuthorizationTenant,
|
|
183
|
+
as: 'tenants',
|
|
184
|
+
required: true,
|
|
185
|
+
where: { tenantId },
|
|
186
|
+
attributes: [],
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
});
|
|
190
|
+
if (authorization) {
|
|
191
|
+
newTransaction.set('authorizationId', authorization.id);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
this.logger.warn(`Authorization with idToken ${value.idToken.idToken} : ${value.idToken.type} does not exist. Transaction ${newTransaction.transactionId} will not be associated with an authorization.`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const chargingStation = await this.station.readByKey(tenantId, stationId);
|
|
198
|
+
if (!chargingStation) {
|
|
199
|
+
this.logger.error(`Charging station with stationId ${stationId} does not exist.`);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
if (chargingStation.locationId) {
|
|
203
|
+
newTransaction.set('locationId', chargingStation.locationId);
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
this.logger.warn(`Charging station with stationId ${stationId} does not have a locationId. Transaction ${newTransaction.transactionId} will not be associated with a location, which may prevent it from being sent to upstream partners.`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
finalTransaction = await newTransaction.save({ transaction: sequelizeTransaction });
|
|
210
|
+
created = true;
|
|
211
|
+
}
|
|
212
|
+
const transactionDatabaseId = finalTransaction.id;
|
|
213
|
+
let event = TransactionEvent.build({
|
|
214
|
+
tenantId,
|
|
215
|
+
stationId,
|
|
216
|
+
transactionDatabaseId,
|
|
217
|
+
...value,
|
|
218
|
+
});
|
|
219
|
+
if (value.idToken && value.idToken.type !== OCPP2_0_1.IdTokenEnumType.NoAuthorization) {
|
|
220
|
+
const authorization = await Authorization.findOne({
|
|
221
|
+
where: {
|
|
222
|
+
idToken: value.idToken.idToken,
|
|
223
|
+
idTokenType: AuthorizationMapper.fromIdTokenEnumType(value.idToken.type),
|
|
224
|
+
},
|
|
225
|
+
transaction: sequelizeTransaction,
|
|
226
|
+
include: [
|
|
227
|
+
{
|
|
228
|
+
model: AuthorizationTenant,
|
|
229
|
+
as: 'tenants',
|
|
230
|
+
required: true,
|
|
231
|
+
where: { tenantId },
|
|
232
|
+
attributes: [],
|
|
233
|
+
},
|
|
234
|
+
],
|
|
235
|
+
});
|
|
236
|
+
if (!authorization) {
|
|
237
|
+
this.logger.warn(`Authorization not found for ${value.idToken.idToken}:${value.idToken.type}`);
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
event.idTokenValue = authorization.idToken;
|
|
241
|
+
event.idTokenType = authorization.idTokenType ? authorization.idTokenType : undefined;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
event = await event.save({ transaction: sequelizeTransaction });
|
|
245
|
+
if (value.meterValue && value.meterValue.length > 0) {
|
|
246
|
+
const meterValueTypes = value.meterValue.map((meterValue) => OCPP2_0_1_Mapper.MeterValueMapper.fromMeterValueType(meterValue));
|
|
247
|
+
const newMeterValues = await Promise.all(meterValueTypes.map(async (meterValueType) => {
|
|
248
|
+
const savedMeterValue = await MeterValue.create({
|
|
249
|
+
tenantId,
|
|
250
|
+
transactionEventId: event.id,
|
|
251
|
+
transactionDatabaseId: transactionDatabaseId,
|
|
252
|
+
transactionId: finalTransaction.transactionId,
|
|
253
|
+
tariffId: finalTransaction.tariffId,
|
|
254
|
+
...meterValueType,
|
|
255
|
+
}, { transaction: sequelizeTransaction });
|
|
256
|
+
this.meterValue.emit('created', [savedMeterValue]);
|
|
257
|
+
return savedMeterValue;
|
|
258
|
+
}));
|
|
259
|
+
if (finalTransaction.meterStart === null || finalTransaction.meterStart === undefined) {
|
|
260
|
+
const meterStart = MeterValueUtils.getMeterStart(meterValueTypes);
|
|
261
|
+
await finalTransaction.update({
|
|
262
|
+
totalKwh: MeterValueUtils.getTotalKwh(meterValueTypes, finalTransaction.totalKwh ?? 0, meterStart ?? undefined),
|
|
263
|
+
meterStart: meterStart,
|
|
264
|
+
}, { transaction: sequelizeTransaction });
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
await finalTransaction.update({
|
|
268
|
+
totalKwh: MeterValueUtils.getTotalKwh(meterValueTypes, finalTransaction.totalKwh ?? 0, finalTransaction.meterStart ?? undefined),
|
|
269
|
+
}, { transaction: sequelizeTransaction });
|
|
270
|
+
}
|
|
271
|
+
// Included for ease of access after creation
|
|
272
|
+
finalTransaction.meterValues = newMeterValues;
|
|
273
|
+
}
|
|
274
|
+
// Optimize: Skip eager loading of all MeterValues to reduce memory usage during long charging sessions
|
|
275
|
+
// For register-based calculations (most common), we only need first and last meter values
|
|
276
|
+
this.emit('created', [event]);
|
|
277
|
+
this.transaction.emit(created ? 'created' : 'updated', [finalTransaction]);
|
|
278
|
+
return finalTransaction;
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
async readAllByStationIdAndTransactionId(tenantId, stationId, transactionId) {
|
|
282
|
+
// Optimize memory: Skip eager loading of MeterValues to avoid loading large arrays
|
|
283
|
+
// MeterValues can be loaded separately per TransactionEvent if needed
|
|
284
|
+
return await super
|
|
285
|
+
.readAllByQuery(tenantId, {
|
|
286
|
+
where: { stationId },
|
|
287
|
+
include: [{ model: Transaction, where: { transactionId } }, Evse],
|
|
288
|
+
// Removed MeterValue eager loading to prevent memory issues with many meter values
|
|
289
|
+
})
|
|
290
|
+
.then((transactionEvents) => {
|
|
291
|
+
transactionEvents?.forEach((transactionEvent) => (transactionEvent.transaction = undefined));
|
|
292
|
+
return transactionEvents;
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
async readTransactionByStationIdAndTransactionId(tenantId, stationId, transactionId) {
|
|
296
|
+
// Optimize memory: Skip eager loading of all MeterValues to avoid memory issues
|
|
297
|
+
// MeterValues can be loaded separately if needed using readAllMeterValuesByTransactionDataBaseId
|
|
298
|
+
return await this.transaction.readOnlyOneByQuery(tenantId, {
|
|
299
|
+
where: { stationId, transactionId },
|
|
300
|
+
// Removed MeterValue eager loading to prevent memory leaks during long charging sessions
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
async readAllTransactionsByStationIdAndEvseAndChargingStates(tenantId, stationId, evse, chargingStates) {
|
|
304
|
+
const includeObj = evse
|
|
305
|
+
? [
|
|
306
|
+
{
|
|
307
|
+
model: Evse,
|
|
308
|
+
where: { evseTypeId: evse.id },
|
|
309
|
+
},
|
|
310
|
+
]
|
|
311
|
+
: [];
|
|
312
|
+
if (evse?.connectorId) {
|
|
313
|
+
includeObj.push({
|
|
314
|
+
model: Connector,
|
|
315
|
+
where: { evseTypeConnectorId: evse.connectorId },
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
return await this.transaction
|
|
319
|
+
.readAllByQuery(tenantId, {
|
|
320
|
+
where: {
|
|
321
|
+
stationId,
|
|
322
|
+
...(chargingStates ? { chargingState: { [Op.in]: chargingStates } } : {}),
|
|
323
|
+
},
|
|
324
|
+
include: includeObj,
|
|
325
|
+
})
|
|
326
|
+
.then((row) => row);
|
|
327
|
+
}
|
|
328
|
+
async readAllActiveTransactionsByAuthorizationId(tenantId, authorizationId) {
|
|
329
|
+
return await this.transaction.readAllByQuery(tenantId, {
|
|
330
|
+
where: { isActive: true, authorizationId },
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
async readAllMeterValuesByTransactionDataBaseId(tenantId, transactionDataBaseId) {
|
|
334
|
+
return this.meterValue
|
|
335
|
+
.readAllByQuery(tenantId, {
|
|
336
|
+
where: { transactionDatabaseId: transactionDataBaseId },
|
|
337
|
+
})
|
|
338
|
+
.then((row) => row);
|
|
339
|
+
}
|
|
340
|
+
async findByTransactionId(tenantId, transactionId) {
|
|
341
|
+
return this.transaction.readOnlyOneByQuery(tenantId, {
|
|
342
|
+
where: { transactionId },
|
|
343
|
+
include: [
|
|
344
|
+
{ model: TransactionEvent, as: Transaction.TRANSACTION_EVENTS_ALIAS, include: [EvseType] },
|
|
345
|
+
MeterValue,
|
|
346
|
+
],
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
async getTransactions(tenantId, dateFrom, dateTo, offset, limit) {
|
|
350
|
+
const queryOptions = {
|
|
351
|
+
where: {},
|
|
352
|
+
include: [
|
|
353
|
+
{ model: TransactionEvent, as: Transaction.TRANSACTION_EVENTS_ALIAS, include: [EvseType] },
|
|
354
|
+
MeterValue,
|
|
355
|
+
],
|
|
356
|
+
};
|
|
357
|
+
if (dateFrom) {
|
|
358
|
+
queryOptions.where.updatedAt = queryOptions.where.updatedAt || {};
|
|
359
|
+
queryOptions.where.updatedAt[Op.gte] = dateFrom;
|
|
360
|
+
}
|
|
361
|
+
if (dateTo) {
|
|
362
|
+
queryOptions.where.updatedAt = queryOptions.where.updatedAt || {};
|
|
363
|
+
queryOptions.where.updatedAt[Op.lt] = dateTo;
|
|
364
|
+
}
|
|
365
|
+
if (offset) {
|
|
366
|
+
queryOptions.offset = offset;
|
|
367
|
+
}
|
|
368
|
+
if (limit) {
|
|
369
|
+
queryOptions.limit = limit;
|
|
370
|
+
}
|
|
371
|
+
return this.transaction.readAllByQuery(tenantId, queryOptions);
|
|
372
|
+
}
|
|
373
|
+
async getTransactionsCount(tenantId, dateFrom, dateTo) {
|
|
374
|
+
const queryOptions = {
|
|
375
|
+
where: {},
|
|
376
|
+
};
|
|
377
|
+
if (dateFrom) {
|
|
378
|
+
queryOptions.where.updatedAt = queryOptions.where.updatedAt || {};
|
|
379
|
+
queryOptions.where.updatedAt[Op.gte] = dateFrom;
|
|
380
|
+
}
|
|
381
|
+
if (dateTo) {
|
|
382
|
+
queryOptions.where.updatedAt = queryOptions.where.updatedAt || {};
|
|
383
|
+
queryOptions.where.updatedAt[Op.lt] = dateTo;
|
|
384
|
+
}
|
|
385
|
+
return Transaction.count(queryOptions);
|
|
386
|
+
}
|
|
387
|
+
async readAllTransactionsByQuery(tenantId, query) {
|
|
388
|
+
return await this.transaction.readAllByQuery(tenantId, query);
|
|
389
|
+
}
|
|
390
|
+
async getEvseIdsWithActiveTransactionByStationId(tenantId, stationId) {
|
|
391
|
+
const activeTransactions = await this.transaction.readAllByQuery(tenantId, {
|
|
392
|
+
where: {
|
|
393
|
+
stationId: stationId,
|
|
394
|
+
isActive: true,
|
|
395
|
+
},
|
|
396
|
+
include: [Evse],
|
|
397
|
+
});
|
|
398
|
+
const evseIds = [];
|
|
399
|
+
activeTransactions.forEach((transaction) => {
|
|
400
|
+
const evseId = transaction.evse?.evseTypeId;
|
|
401
|
+
if (evseId) {
|
|
402
|
+
evseIds.push(evseId);
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
return evseIds;
|
|
406
|
+
}
|
|
407
|
+
async getActiveTransactionByStationIdAndEvseId(tenantId, stationId, evseId) {
|
|
408
|
+
return await this.transaction
|
|
409
|
+
.readAllByQuery(tenantId, {
|
|
410
|
+
where: {
|
|
411
|
+
stationId,
|
|
412
|
+
isActive: true,
|
|
413
|
+
},
|
|
414
|
+
include: [
|
|
415
|
+
{
|
|
416
|
+
model: TransactionEvent,
|
|
417
|
+
as: Transaction.TRANSACTION_EVENTS_ALIAS,
|
|
418
|
+
include: [EvseType],
|
|
419
|
+
},
|
|
420
|
+
MeterValue,
|
|
421
|
+
{ model: Evse, where: { evseTypeId: evseId }, required: true },
|
|
422
|
+
],
|
|
423
|
+
})
|
|
424
|
+
.then((transactions) => {
|
|
425
|
+
if (transactions.length > 1) {
|
|
426
|
+
transactions.sort((t1, t2) => t2.updatedAt.getTime() - t1.updatedAt.getTime());
|
|
427
|
+
}
|
|
428
|
+
return transactions[0];
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
async createMeterValue(tenantId, meterValue, transactionDatabaseId, transactionId, tariffId) {
|
|
432
|
+
const meterValueType = OCPP2_0_1_Mapper.MeterValueMapper.fromMeterValueType(meterValue);
|
|
433
|
+
const savedMeterValue = await MeterValue.create({
|
|
434
|
+
tenantId,
|
|
435
|
+
transactionDatabaseId: transactionDatabaseId,
|
|
436
|
+
transactionId,
|
|
437
|
+
tariffId,
|
|
438
|
+
...meterValueType,
|
|
439
|
+
});
|
|
440
|
+
this.meterValue.emit('created', [savedMeterValue]);
|
|
441
|
+
return savedMeterValue;
|
|
442
|
+
}
|
|
443
|
+
async updateTransactionTotalCostById(tenantId, totalCost, id) {
|
|
444
|
+
await this.transaction.updateByKey(tenantId, { totalCost: totalCost }, id.toString());
|
|
445
|
+
}
|
|
446
|
+
async updateTransactionByMeterValues(tenantId, meterValues, stationId, transactionId) {
|
|
447
|
+
// Find existing transaction
|
|
448
|
+
const transaction = await this.readTransactionByStationIdAndTransactionId(tenantId, stationId, transactionId.toString());
|
|
449
|
+
if (!transaction) {
|
|
450
|
+
this.logger.error(`Transaction ${transactionId} on station ${stationId} does not exist.`);
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
// Store meter values
|
|
454
|
+
await Promise.all(meterValues.map(async (meterValue) => {
|
|
455
|
+
meterValue.transactionDatabaseId = transaction.id;
|
|
456
|
+
meterValue.transactionId = transaction.transactionId;
|
|
457
|
+
meterValue.tariffId = transaction.tariffId;
|
|
458
|
+
const createdMeterValue = await MeterValue.create(meterValue);
|
|
459
|
+
this.meterValue.emit('created', [createdMeterValue]);
|
|
460
|
+
}));
|
|
461
|
+
if (transaction.meterStart === null || transaction.meterStart === undefined) {
|
|
462
|
+
const meterStart = MeterValueUtils.getMeterStart(meterValues);
|
|
463
|
+
await transaction.update({
|
|
464
|
+
totalKwh: MeterValueUtils.getTotalKwh(meterValues, transaction.totalKwh ?? 0, meterStart ?? undefined),
|
|
465
|
+
meterStart: meterStart,
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
else {
|
|
469
|
+
await transaction.update({
|
|
470
|
+
totalKwh: MeterValueUtils.getTotalKwh(meterValues, transaction.totalKwh ?? 0, transaction.meterStart ?? undefined),
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
async createTransactionByStartTransaction(tenantId, request, stationId) {
|
|
475
|
+
return await this.s.transaction(async (sequelizeTransaction) => {
|
|
476
|
+
// Build StartTransaction event
|
|
477
|
+
let event = StartTransaction.build({
|
|
478
|
+
tenantId,
|
|
479
|
+
stationId,
|
|
480
|
+
...request,
|
|
481
|
+
});
|
|
482
|
+
// Associate Connector with StartTransaction
|
|
483
|
+
const connector = await this.connector.readOnlyOneByQuery(tenantId, {
|
|
484
|
+
where: {
|
|
485
|
+
connectorId: request.connectorId,
|
|
486
|
+
stationId,
|
|
487
|
+
},
|
|
488
|
+
include: [Tariff],
|
|
489
|
+
sequelizeTransaction,
|
|
490
|
+
});
|
|
491
|
+
if (!connector) {
|
|
492
|
+
this.logger.error(`Unable to find connector ${request.connectorId}.`);
|
|
493
|
+
throw new Error(`Unable to find connector ${request.connectorId}.`);
|
|
494
|
+
}
|
|
495
|
+
event.connectorDatabaseId = connector.id;
|
|
496
|
+
// Find Authorization by IdToken
|
|
497
|
+
const authorization = await Authorization.findOne({
|
|
498
|
+
where: {
|
|
499
|
+
idToken: request.idTag,
|
|
500
|
+
},
|
|
501
|
+
transaction: sequelizeTransaction,
|
|
502
|
+
include: [
|
|
503
|
+
{
|
|
504
|
+
model: AuthorizationTenant,
|
|
505
|
+
as: 'tenants',
|
|
506
|
+
required: true,
|
|
507
|
+
where: { tenantId },
|
|
508
|
+
attributes: [],
|
|
509
|
+
},
|
|
510
|
+
],
|
|
511
|
+
});
|
|
512
|
+
if (!authorization) {
|
|
513
|
+
this.logger.warn(`Authorization with idToken ${request.idTag} does not exist.`);
|
|
514
|
+
}
|
|
515
|
+
// Generate transactionId
|
|
516
|
+
const transactionId = await this.chargingStationSequence.getNextSequenceValue(tenantId, stationId, ChargingStationSequenceTypeEnum.transactionId);
|
|
517
|
+
// Store transaction in db
|
|
518
|
+
let newTransaction = Transaction.build({
|
|
519
|
+
tenantId,
|
|
520
|
+
stationId,
|
|
521
|
+
evseId: connector.evseId,
|
|
522
|
+
connectorId: connector.id,
|
|
523
|
+
tariffId: connector.tariffs?.[0]?.id,
|
|
524
|
+
isActive: true,
|
|
525
|
+
transactionId: transactionId.toString(),
|
|
526
|
+
authorizationId: authorization ? authorization.id : null,
|
|
527
|
+
meterStart: request.meterStart,
|
|
528
|
+
startTime: request.timestamp,
|
|
529
|
+
});
|
|
530
|
+
const chargingStation = await this.station.readByKey(tenantId, stationId);
|
|
531
|
+
if (chargingStation) {
|
|
532
|
+
if (chargingStation.locationId) {
|
|
533
|
+
newTransaction.set('locationId', chargingStation.locationId);
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
this.logger.warn(`Charging station with stationId ${stationId} does not have a locationId. Transaction ${newTransaction.transactionId} will not be associated with a location, which may prevent it from being sent to upstream partners.`);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
newTransaction = await newTransaction.save({ transaction: sequelizeTransaction });
|
|
540
|
+
// Store StartTransaction in db
|
|
541
|
+
event.transactionDatabaseId = newTransaction.id;
|
|
542
|
+
event = await event.save({ transaction: sequelizeTransaction });
|
|
543
|
+
this.startTransaction.emit('created', [event]);
|
|
544
|
+
// Return the new transaction with StartTransaction and IdToken
|
|
545
|
+
await newTransaction.reload({
|
|
546
|
+
include: [{ model: StartTransaction }],
|
|
547
|
+
transaction: sequelizeTransaction,
|
|
548
|
+
});
|
|
549
|
+
this.transaction.emit('created', [newTransaction]);
|
|
550
|
+
return newTransaction;
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
async createStopTransaction(tenantId, transactionDatabaseId, stationId, meterStop, timestamp, meterValues, reason) {
|
|
554
|
+
const transaction = await this.transaction.readOnlyOneByQuery(tenantId, {
|
|
555
|
+
where: { id: transactionDatabaseId },
|
|
556
|
+
include: [StartTransaction],
|
|
557
|
+
});
|
|
558
|
+
if (!transaction) {
|
|
559
|
+
this.logger.error(`Transaction with id ${transactionDatabaseId} not found.`);
|
|
560
|
+
throw new Error(`Transaction with id ${transactionDatabaseId} not found.`);
|
|
561
|
+
}
|
|
562
|
+
const stopTransaction = await StopTransaction.create({
|
|
563
|
+
tenantId,
|
|
564
|
+
stationId,
|
|
565
|
+
transactionDatabaseId,
|
|
566
|
+
meterStop,
|
|
567
|
+
timestamp: timestamp.toISOString(),
|
|
568
|
+
reason,
|
|
569
|
+
});
|
|
570
|
+
this.stopTransaction.emit('created', [stopTransaction]);
|
|
571
|
+
await transaction.update({
|
|
572
|
+
endTime: timestamp,
|
|
573
|
+
isActive: false,
|
|
574
|
+
});
|
|
575
|
+
if (meterValues.length > 0) {
|
|
576
|
+
await Promise.all(meterValues.map(async (meterValue) => {
|
|
577
|
+
meterValue.transactionDatabaseId = transactionDatabaseId;
|
|
578
|
+
const createdMeterValue = MeterValue.build(meterValue);
|
|
579
|
+
createdMeterValue.stopTransactionDatabaseId = stopTransaction.id;
|
|
580
|
+
await createdMeterValue.save();
|
|
581
|
+
this.meterValue.emit('created', [createdMeterValue]);
|
|
582
|
+
}));
|
|
583
|
+
}
|
|
584
|
+
return stopTransaction;
|
|
585
|
+
}
|
|
586
|
+
async updateTransactionByStationIdAndTransactionId(tenantId, transaction, transactionId, stationId) {
|
|
587
|
+
const transactions = await this.transaction.updateAllByQuery(tenantId, transaction, {
|
|
588
|
+
where: {
|
|
589
|
+
// unique constraint
|
|
590
|
+
transactionId,
|
|
591
|
+
stationId,
|
|
592
|
+
},
|
|
593
|
+
});
|
|
594
|
+
return transactions.length > 0 ? transactions[0] : undefined;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
//# sourceMappingURL=TransactionEvent.js.map
|