backend validation wip
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user