summaryrefslogtreecommitdiffstats
path: root/server/models
diff options
context:
space:
mode:
authorJannik Schönartz2018-10-10 17:00:56 +0200
committerJannik Schönartz2018-10-10 17:00:56 +0200
commit353761b07015a26841549cc259ae0687bc8e4865 (patch)
tree4df55e5d5990a2d0bc150dd5d1c768915f2d3dff /server/models
parent[webapp/configurator] fix deleted configs/entries still being selected after ... (diff)
downloadbas-353761b07015a26841549cc259ae0687bc8e4865.tar.gz
bas-353761b07015a26841549cc259ae0687bc8e4865.tar.xz
bas-353761b07015a26841549cc259ae0687bc8e4865.zip
[registration] Add dbs and code for the registration scripts
Add Table for the registration hooks. Add Table for the hooks - groups association. Add nexthook for the minilinux to pull the next bash script. Add state for setting the new script after completing the current one.
Diffstat (limited to 'server/models')
-rw-r--r--server/models/client.js3
-rw-r--r--server/models/registrationhook.js24
2 files changed, 26 insertions, 1 deletions
diff --git a/server/models/client.js b/server/models/client.js
index c279cfc..6483573 100644
--- a/server/models/client.js
+++ b/server/models/client.js
@@ -11,7 +11,8 @@ module.exports = (sequelize, DataTypes) => {
description: DataTypes.STRING(2048),
ip: DataTypes.STRING,
mac: DataTypes.STRING,
- uuid: DataTypes.STRING
+ uuid: DataTypes.STRING,
+ registrationState: DataTypes.STRING
}, {
timestamps: false
})
diff --git a/server/models/registrationhook.js b/server/models/registrationhook.js
new file mode 100644
index 0000000..0b7566d
--- /dev/null
+++ b/server/models/registrationhook.js
@@ -0,0 +1,24 @@
+'use strict'
+module.exports = (sequelize, DataTypes) => {
+ var registrationhook = sequelize.define('registrationhook', {
+ id: {
+ allowNull: false,
+ autoIncrement: true,
+ primaryKey: true,
+ type: DataTypes.INTEGER
+ },
+ sortvalue: DataTypes.INTEGER,
+ type: DataTypes.STRING,
+ script: {
+ allowNull: true,
+ type: DataTypes.BLOB
+ }
+ }, {
+ timestamps: false
+ })
+ registrationhook.associate = function (models) {
+ var RegistrationhookXGroup = sequelize.define('registrationhook_x_group', {}, { timestamps: false, freezeTableName: true })
+ registrationhook.belongsToMany(models.group, { as: 'groups', through: RegistrationhookXGroup, foreignKey: 'registraionhookId', otherKey: 'groupId' })
+ }
+ return registrationhook
+} \ No newline at end of file