UNPKG

@citrineos/data

Version:

The OCPP data module which includes all persistence layer implementation.

85 lines 3.19 kB
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import { DEFAULT_TENANT_ID } from '@citrineos/base'; import { BeforeCreate, BeforeUpdate, BelongsTo, Column, DataType, ForeignKey, Model, Table, } from 'sequelize-typescript'; import { ChargingStation } from '../Location/index.js'; import { Tenant } from '../Tenant.js'; let ChargingStationSequence = class ChargingStationSequence extends Model { static MODEL_NAME = 'ChargingStationSequence'; type; value; static setDefaultTenant(instance) { if (instance.tenantId == null) { instance.tenantId = DEFAULT_TENANT_ID; } } constructor(...args) { super(...args); if (this.tenantId == null) { this.tenantId = DEFAULT_TENANT_ID; } } }; __decorate([ ForeignKey(() => ChargingStation), Column({ type: DataType.STRING(36), allowNull: false, unique: 'stationId_type', }), __metadata("design:type", String) ], ChargingStationSequence.prototype, "stationId", void 0); __decorate([ Column({ type: DataType.STRING, allowNull: false, unique: 'stationId_type', }), __metadata("design:type", String) ], ChargingStationSequence.prototype, "type", void 0); __decorate([ Column({ type: DataType.BIGINT, allowNull: false, defaultValue: 0, }), __metadata("design:type", Number) ], ChargingStationSequence.prototype, "value", void 0); __decorate([ BelongsTo(() => ChargingStation), __metadata("design:type", Function) ], ChargingStationSequence.prototype, "station", void 0); __decorate([ ForeignKey(() => Tenant), Column({ type: DataType.INTEGER, allowNull: false, onUpdate: 'CASCADE', onDelete: 'RESTRICT', }), __metadata("design:type", Number) ], ChargingStationSequence.prototype, "tenantId", void 0); __decorate([ BelongsTo(() => Tenant), __metadata("design:type", Object) ], ChargingStationSequence.prototype, "tenant", void 0); __decorate([ BeforeUpdate, BeforeCreate, __metadata("design:type", Function), __metadata("design:paramtypes", [ChargingStationSequence]), __metadata("design:returntype", void 0) ], ChargingStationSequence, "setDefaultTenant", null); ChargingStationSequence = __decorate([ Table, __metadata("design:paramtypes", [Object]) ], ChargingStationSequence); export { ChargingStationSequence }; //# sourceMappingURL=ChargingStationSequence.js.map