summaryrefslogtreecommitdiffstats
path: root/server/models
diff options
context:
space:
mode:
authorChristian Hofmaier2018-08-05 01:48:06 +0200
committerChristian Hofmaier2018-08-05 01:48:06 +0200
commit0d653469ea504bd8f638d0534e20b69ce977d319 (patch)
tree54125f18c9400052b8fd3b9635c6f362b8647d9d /server/models
parent[permissions] add permission management (diff)
parent[webapp/groups] add generic table actions component for search and pagination... (diff)
downloadbas-0d653469ea504bd8f638d0534e20b69ce977d319.tar.gz
bas-0d653469ea504bd8f638d0534e20b69ce977d319.tar.xz
bas-0d653469ea504bd8f638d0534e20b69ce977d319.zip
merge
Diffstat (limited to 'server/models')
-rw-r--r--server/models/backend.js19
-rw-r--r--server/models/client.js5
-rw-r--r--server/models/group.js10
3 files changed, 28 insertions, 6 deletions
diff --git a/server/models/backend.js b/server/models/backend.js
index 4ed5fce..62b936a 100644
--- a/server/models/backend.js
+++ b/server/models/backend.js
@@ -9,7 +9,24 @@ module.exports = (sequelize, DataTypes) => {
},
name: DataTypes.STRING,
type: DataTypes.STRING,
- credentials: DataTypes.STRING(2048)
+ credentials: {
+ allowNull: false,
+ type: DataTypes.STRING(2048),
+ defaultValue: '[]'
+ },
+ groups: {
+ allowNull: false,
+ type: DataTypes.STRING(4096),
+ defaultValue: '[]'
+ },
+ clients: {
+ allowNull: false,
+ type: DataTypes.STRING(4096),
+ defaultValue: '[]'
+ },
+ sync: {
+ type: DataTypes.STRING(1024)
+ }
}, {
timestamps: false
})
diff --git a/server/models/client.js b/server/models/client.js
index ad3bc28..5789788 100644
--- a/server/models/client.js
+++ b/server/models/client.js
@@ -8,15 +8,16 @@ module.exports = (sequelize, DataTypes) => {
type: DataTypes.INTEGER
},
name: DataTypes.STRING,
+ description: DataTypes.STRING(2048),
ip: DataTypes.STRING,
mac: DataTypes.STRING,
uuid: DataTypes.STRING
}, {
timestamps: false
})
- var GroupXClient = sequelize.define('group_x_client', {}, { timestamps: false, freezeTableName: true })
client.associate = function (models) {
- client.belongsToMany(models.group, { as: 'groups', through: GroupXClient, foreignKey: 'clientId', otherKey: 'groupId'})
+ var GroupXClient = sequelize.define('group_x_client', {}, { timestamps: false, freezeTableName: true })
+ client.belongsToMany(models.group, { as: 'groups', through: GroupXClient, foreignKey: 'clientId', otherKey: 'groupId' })
}
return client
}
diff --git a/server/models/group.js b/server/models/group.js
index 9151db5..62a5665 100644
--- a/server/models/group.js
+++ b/server/models/group.js
@@ -7,13 +7,17 @@ module.exports = (sequelize, DataTypes) => {
primaryKey: true,
type: DataTypes.INTEGER
},
- name: DataTypes.STRING
+ name: DataTypes.STRING,
+ description: DataTypes.STRING(2048)
}, {
timestamps: false
})
- var GroupXGroup = sequelize.define('group_x_group', {}, { timestamps: false, freezeTableName: true })
group.associate = function (models) {
- group.belongsToMany(group, { as: 'parents', through: GroupXGroup, foreignKey: 'childId', otherKey: 'parentId'})
+ var GroupXGroup = sequelize.define('group_x_group', {}, { timestamps: false, freezeTableName: true })
+ var GroupXClient = sequelize.define('group_x_client', {}, { timestamps: false, freezeTableName: true })
+ group.belongsToMany(group, { as: 'parents', through: GroupXGroup, foreignKey: 'childId', otherKey: 'parentId' })
+ group.belongsToMany(group, { as: 'subgroups', through: GroupXGroup, foreignKey: 'parentId', otherKey: 'childId' })
+ group.belongsToMany(models.client, { as: 'clients', through: GroupXClient, foreignKey: 'groupId', otherKey: 'clientId' })
}
return group
}