'use strict' /** * Copyright (c) 2017~2020, OBCon Inc. * All rights reserved. */ /** * @file * @copyright 2017~2020, OBCon Inc. * @author gye hyun james kim [pnuskgh@gmail.com] */ // let moment = require('moment'); let Sequelize = require('sequelize'); //--- http://docs.sequelizejs.com/ let Model = utils.getClass('include', 'model.js'); class Devicedata7sModel extends Model { constructor() { super(); this._title = '수신감도 데이터'; this._database = db.db_scada; this._tableName = 'devicedata7'; this._define = config.databases.scada.define; this._timestamps = false; //--- createdAt, updatedAt 필드를 사용하지 않는다. } get fields() { return { siteKey: { //--- 사이트 아이디 type: Sequelize.STRING(8), allowNull: false, unique: false, validate: { }, title: '사이트', strType: 'string' }, type: { //--- 단말기 타입 type: Sequelize.STRING(2), allowNull: false, defaultValue: '7', validate: { }, title: '단말기 타입', strType: 'select', enum: this.getTypeEnum() }, deviceKey: { //--- 장비 아이디, RTU ID type: Sequelize.STRING(8), allowNull: false, unique: false, validate: { }, title: '아이디', strType: 'string' }, statusDatetime: { //--- 장비 상태 수집 일자 (YYYYMMDDHHmmss) type: Sequelize.STRING(14), allowNull: true, validate: { }, title: '발생일자', strType: 'string' }, sensitivityRsrp: { type: Sequelize.INTEGER(6), allowNull: true, defaultValue: 0, validate: { }, title: '수신감도 RSRP', strType: 'integer' }, sensitivitySnr: { type: Sequelize.FLOAT, allowNull: true, defaultValue: 0.0, validate: { }, title: '수신감도 SNR', strType: 'float' }, sensitivityRsrq: { type: Sequelize.INTEGER(6), allowNull: true, defaultValue: 0, validate: { }, title: '수신감도 RSRQ', strType: 'integer' }, temperature: { //--- 온도 type: Sequelize.FLOAT, allowNull: true, defaultValue: 0.0, validate: { }, title: '온도', strType: 'float' }, humidity: { type: Sequelize.INTEGER(3), allowNull: true, defaultValue: 0, validate: { }, title: '습도', strType: 'integer' }, batteryVoltage: { type: Sequelize.FLOAT, allowNull: true, defaultValue: 0.0, validate: { }, title: '배터리 전압', strType: 'float' }, latitude: { //--- 위도 type: Sequelize.DECIMAL(10, 6), allowNull: true, validate: { }, title: '위도', strType: 'float' }, longitude: { //--- 경도 type: Sequelize.DECIMAL(10, 6), allowNull: true, validate: { }, title: '경도', strType: 'float' }, dataMode: { type: Sequelize.STRING(1), allowNull: true, validate: { }, title: '데이터 모드', strType: 'string', enum: [ ['0', '0. 통신주기(분)'], ['1', '1. 통신주기(시)'], ] }, networkCycle: { type: Sequelize.INTEGER(2), allowNull: true, defaultValue: 0.0, validate: { }, title: '통신 주기', strType: 'integer' } }; } } module.exports = Devicedata7sModel;