@golemio/energetics
Version:
Golemio Energetics Module
62 lines • 2.09 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnapoMeasurementsModel = void 0;
const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
const MeasurementConstants_1 = require("./constants/MeasurementConstants");
class EnapoMeasurementsModel extends sequelize_1.Model {
}
exports.EnapoMeasurementsModel = EnapoMeasurementsModel;
EnapoMeasurementsModel.TABLE_NAME = "enapo_measurements";
EnapoMeasurementsModel.REPOSITORY_NAME = "EnapoMeasurementsRepository";
EnapoMeasurementsModel.JSON_SCHEMA_VALIDATOR_NAME = "EnapoMeasurementsRepositoryValidator";
EnapoMeasurementsModel.attributeModel = {
eic: {
type: sequelize_1.DataTypes.STRING(50),
allowNull: false,
primaryKey: true,
},
value: {
type: sequelize_1.DataTypes.DECIMAL(30, 15),
allowNull: false,
},
timestamp: {
type: sequelize_1.DataTypes.DATE,
allowNull: false,
primaryKey: true,
},
var: {
type: sequelize_1.DataTypes.STRING(255),
allowNull: false,
primaryKey: true,
},
source: {
type: sequelize_1.DataTypes.STRING(20),
allowNull: false,
},
place_id: {
type: sequelize_1.DataTypes.STRING(50),
allowNull: false,
primaryKey: true,
},
device_serial_number: {
type: sequelize_1.DataTypes.STRING(50),
allowNull: false,
},
};
EnapoMeasurementsModel.jsonSchema = {
type: "array",
items: {
type: "object",
properties: {
eic: { type: "string" },
value: { type: "number" },
timestamp: { type: "object", required: ["toISOString"] },
var: { type: "string", enum: MeasurementConstants_1.MEASUREMENT_VARIABLES },
source: { type: "string" },
place_id: { type: "string" },
device_serial_number: { type: "string" },
},
required: ["eic", "value", "timestamp", "var", "source", "place_id", "device_serial_number"],
},
};
//# sourceMappingURL=EnapoMeasurementsModel.js.map