125 lines
2.4 KiB
JavaScript
125 lines
2.4 KiB
JavaScript
module.exports = (sequelize, Sequelize) => {
|
|
const Controller = sequelize.define('controller', {
|
|
name: {
|
|
type: Sequelize.STRING,
|
|
defaultValue: ''
|
|
},
|
|
spec: {
|
|
type: Sequelize.STRING,
|
|
defaultValue: ''
|
|
},
|
|
mac_address: {
|
|
type: Sequelize.STRING,
|
|
defaultValue: ''
|
|
},
|
|
ip_address: {
|
|
type: Sequelize.STRING,
|
|
defaultValue: ''
|
|
},
|
|
configuration: {
|
|
type: Sequelize.JSONB,
|
|
defaultValue: {}
|
|
},
|
|
wifi_name: {
|
|
type: Sequelize.STRING,
|
|
defaultValue: ''
|
|
},
|
|
wifi_password: {
|
|
type: Sequelize.STRING,
|
|
defaultValue: ''
|
|
},
|
|
mqtt_id: {
|
|
type: Sequelize.STRING,
|
|
defaultValue: ''
|
|
},
|
|
mqtt_address: {
|
|
type: Sequelize.STRING,
|
|
defaultValue: ''
|
|
},
|
|
api_mqtt_address: {
|
|
type: Sequelize.STRING,
|
|
defaultValue: ''
|
|
},
|
|
// group/user: {
|
|
// admin: [id...],
|
|
// normal: [id...],
|
|
// guest: [id...]
|
|
// }
|
|
group_auth: {
|
|
type: Sequelize.JSONB,
|
|
defaultValue: {
|
|
owner: [],
|
|
maintainer: [],
|
|
guest: []
|
|
}
|
|
},
|
|
user_auth: {
|
|
type: Sequelize.JSONB,
|
|
defaultValue: {
|
|
owner: [],
|
|
maintainer: [],
|
|
guest: []
|
|
}
|
|
},
|
|
device: {
|
|
type: Sequelize.JSONB,
|
|
defaultValue: {
|
|
auto_join: [],
|
|
scanned: []
|
|
}
|
|
},
|
|
device_scanned: {
|
|
type: Sequelize.JSONB,
|
|
defaultValue: {}
|
|
},
|
|
device_auto_join: {
|
|
type: Sequelize.JSONB,
|
|
defaultValue: {}
|
|
},
|
|
// project/task: {
|
|
// running: [id...],
|
|
// library: [id...]
|
|
// }
|
|
project: {
|
|
type: Sequelize.STRING,
|
|
defaultValue: ''
|
|
},
|
|
task: {
|
|
type: Sequelize.STRING,
|
|
defaultValue: ''
|
|
},
|
|
// task: {
|
|
// type: Sequelize.JSONB,
|
|
// defaultValue: {
|
|
// running: [],
|
|
// library: []
|
|
// }
|
|
// },
|
|
software_version: {
|
|
type: Sequelize.STRING,
|
|
defaultValue: ''
|
|
},
|
|
status: {
|
|
type: Sequelize.STRING,
|
|
defaultValue: ''
|
|
},
|
|
deleted: {
|
|
type: Sequelize.BOOLEAN,
|
|
defaultValue: false
|
|
},
|
|
created_at: {
|
|
type: Sequelize.DATE,
|
|
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP')
|
|
},
|
|
updated_at: {
|
|
type: Sequelize.DATE,
|
|
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP')
|
|
}
|
|
},
|
|
{
|
|
timestamps: false
|
|
})
|
|
|
|
return Controller
|
|
}
|