backend validation wip

This commit is contained in:
newtbot
2024-01-02 02:53:44 +08:00
parent a058b1ba70
commit 6342d5a4cb
13 changed files with 410 additions and 211 deletions

View File

@ -5,38 +5,39 @@ const { locationModel } = require("./locationModel");
const { sensorModel } = require("./sensorModel");
//sequelize.sync();
const sensorDataModel = sequelize.define("sensorData",
const sensorDataModel = sequelize.define(
"sensorData",
{
id: {
type: DataTypes.INTEGER,
allowNull: true,
primaryKey: true,
autoIncrement: true,
autoIncrement: true,
},
id_sensor: {
type: DataTypes.INTEGER,
allowNull: false,
length: 100,
//FK
references: {
model: sensorModel,
key: "id",
},
},
id_location: {
type: DataTypes.INTEGER,
allowNull: false,
length: 100,
//FK
references: {
model: locationModel,
key: "id",
},
},
sensordata: {
type: DataTypes.JSON,
allowNull: false,
},
id_sensor: {
type: DataTypes.INTEGER,
allowNull: false,
length: 100,
//FK
references: {
model: sensorModel,
key: 'id'
}
},
id_location: {
type: DataTypes.INTEGER,
allowNull: false,
length: 100,
//FK
references: {
model: locationModel,
key: 'id'
}
},
Sensordata: {
type: DataTypes.JSON,
allowNull: false,
},
createdAt: {
type: DataTypes.DATE,
allowNull: true,