express routing

This commit is contained in:
newtbot
2023-12-19 18:51:23 +08:00
parent e9ed0144aa
commit 7c53b362eb
11 changed files with 696 additions and 41 deletions

View File

@ -0,0 +1,76 @@
"use strict";
const { Sequelize, DataTypes } = require("sequelize");
const { sequelize } = require("../mySql.js");
const IoTModel = sequelize.define("iot-data",{
// Model attributes are defined here
id: {
type: DataTypes.INTEGER,
allowNull: false,
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 };

View File

@ -1,6 +1,6 @@
'use strict';
const { Sequelize, DataTypes } = require('sequelize');
const { sequelize } = require("../mySQL.js")
const { sequelize } = require("../nySql.js")
const adminUserModel = sequelize.define('adminusers', {
// Model attributes are defined here

View File

@ -1,6 +1,6 @@
'use strict';
const { Sequelize, DataTypes } = require('sequelize');
const { sequelize } = require("../mySQL.js")
const { sequelize } = require("../mySql.js");
const userModel = sequelize.define('users', {
// Model attributes are defined here