a
This commit is contained in:
@ -1,77 +0,0 @@
|
||||
"use strict";
|
||||
const { Sequelize, DataTypes } = require("sequelize");
|
||||
const { sequelize } = require("../mySQL");
|
||||
|
||||
const IoTModel = sequelize.define("iot-data",{
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: true,
|
||||
primaryKey: true,
|
||||
},
|
||||
psiData: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
length: 8,
|
||||
},
|
||||
humidityData: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
length: 8,
|
||||
},
|
||||
o3Data: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
length: 8,
|
||||
},
|
||||
no2Data: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
length: 8,
|
||||
},
|
||||
so2Data: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
length: 8,
|
||||
},
|
||||
coData: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
length: 8,
|
||||
},
|
||||
temperatureData: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
length: 8,
|
||||
},
|
||||
windspeedData: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
length: 8,
|
||||
},
|
||||
currentTime: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
length: 20,
|
||||
},
|
||||
regionData: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
length: 10,
|
||||
},
|
||||
createdAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
},
|
||||
updatedAt: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
timestamps: true,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
module.exports = { IoTModel };
|
@ -5,7 +5,7 @@ const { locationModel } = require("./locationModel");
|
||||
const { sensorModel } = require("./sensorModel");
|
||||
const { isJson } = require("../../Web-Server/functions/validateData");
|
||||
|
||||
//sequelize.sync();
|
||||
sequelize.sync();
|
||||
const sensorDataModel = sequelize.define(
|
||||
"sensorData",
|
||||
{
|
||||
@ -20,7 +20,7 @@ const sensorDataModel = sequelize.define(
|
||||
notEmpty: true,
|
||||
},
|
||||
},
|
||||
id_sensor: {
|
||||
sensorid: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
length: 100,
|
||||
@ -34,7 +34,7 @@ const sensorDataModel = sequelize.define(
|
||||
notEmpty: true,
|
||||
},
|
||||
},
|
||||
id_location: {
|
||||
locationid: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
length: 100,
|
||||
@ -48,7 +48,7 @@ const sensorDataModel = sequelize.define(
|
||||
notEmpty: true,
|
||||
},
|
||||
},
|
||||
sensordata: {
|
||||
measurement: {
|
||||
type: DataTypes.JSON,
|
||||
allowNull: false,
|
||||
validate: {
|
||||
|
@ -23,7 +23,7 @@ const sensorModel = sequelize.define(
|
||||
isNumeric: true,
|
||||
},
|
||||
},
|
||||
sensorname: {
|
||||
name: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
length: 10,
|
||||
@ -79,7 +79,7 @@ const sensorModel = sequelize.define(
|
||||
},
|
||||
},
|
||||
},
|
||||
location: {
|
||||
locationid: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: true,
|
||||
length: 100,
|
||||
|
Reference in New Issue
Block a user