Files
controller-wisetopapiserver/src/db/schema/controller.model.js
T

125 lines
2.4 KiB
JavaScript
Raw Normal View History

2021-03-24 16:09:53 +08:00
module.exports = (sequelize, Sequelize) => {
const Controller = sequelize.define('controller', {
name: {
2021-04-26 10:04:27 +08:00
type: Sequelize.STRING,
defaultValue: ''
2021-03-24 16:09:53 +08:00
},
spec: {
2021-04-26 10:04:27 +08:00
type: Sequelize.STRING,
defaultValue: ''
2021-03-24 16:09:53 +08:00
},
mac_address: {
2021-04-26 10:04:27 +08:00
type: Sequelize.STRING,
defaultValue: ''
2021-03-24 16:09:53 +08:00
},
ip_address: {
2021-03-31 19:51:05 +08:00
type: Sequelize.STRING,
defaultValue: ''
},
configuration: {
type: Sequelize.JSONB,
defaultValue: {}
2021-03-24 16:09:53 +08:00
},
2021-05-19 20:50:57 +08:00
wifi_name: {
type: Sequelize.STRING,
defaultValue: ''
},
2021-03-24 19:37:32 +08:00
wifi_password: {
type: Sequelize.STRING,
2021-04-26 10:04:27 +08:00
defaultValue: ''
2021-03-24 19:37:32 +08:00
},
2021-06-28 08:58:23 +08:00
mqtt_id: {
type: Sequelize.STRING,
defaultValue: ''
},
2021-03-24 16:09:53 +08:00
mqtt_address: {
2021-03-31 19:51:05 +08:00
type: Sequelize.STRING,
defaultValue: ''
},
api_mqtt_address: {
type: Sequelize.STRING,
defaultValue: ''
2021-03-24 16:09:53 +08:00
},
2021-03-24 19:37:32 +08:00
// group/user: {
// admin: [id...],
// normal: [id...],
// guest: [id...]
// }
group_auth: {
2021-03-24 16:09:53 +08:00
type: Sequelize.JSONB,
2021-03-31 19:51:05 +08:00
defaultValue: {
owner: [],
maintainer: [],
guest: []
}
2021-03-24 16:09:53 +08:00
},
2021-03-24 19:37:32 +08:00
user_auth: {
2021-03-24 16:09:53 +08:00
type: Sequelize.JSONB,
2021-03-31 19:51:05 +08:00
defaultValue: {
owner: [],
maintainer: [],
guest: []
}
2021-03-24 16:09:53 +08:00
},
device: {
type: Sequelize.JSONB,
2021-03-31 19:51:05 +08:00
defaultValue: {
auto_join: [],
scanned: []
}
2021-03-24 16:09:53 +08:00
},
2021-06-28 08:58:23 +08:00
device_scanned: {
type: Sequelize.JSONB,
defaultValue: {}
},
device_auto_join: {
type: Sequelize.JSONB,
defaultValue: {}
},
2021-03-24 19:37:32 +08:00
// project/task: {
// running: [id...],
// library: [id...]
// }
2021-03-24 16:09:53 +08:00
project: {
2021-06-28 08:58:23 +08:00
type: Sequelize.STRING,
defaultValue: ''
2021-03-24 16:09:53 +08:00
},
task: {
2021-06-28 08:58:23 +08:00
type: Sequelize.STRING,
defaultValue: ''
2021-03-24 16:09:53 +08:00
},
2021-06-28 08:58:23 +08:00
// task: {
// type: Sequelize.JSONB,
// defaultValue: {
// running: [],
// library: []
// }
// },
2021-03-24 16:09:53 +08:00
software_version: {
2021-05-19 20:50:57 +08:00
type: Sequelize.STRING,
defaultValue: ''
2021-03-24 16:09:53 +08:00
},
2021-06-28 08:58:23 +08:00
status: {
type: Sequelize.STRING,
defaultValue: ''
},
2021-03-31 19:51:05 +08:00
deleted: {
type: Sequelize.BOOLEAN,
defaultValue: false
},
2021-03-24 16:09:53 +08:00
created_at: {
type: Sequelize.DATE,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP')
},
updated_at: {
type: Sequelize.DATE,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP')
}
},
{
timestamps: false
})
return Controller
}