Ghost/core/server/models/role.js
Sebastian Gierlinger ac7f4f05c4 Add validation from schema.js
closes #1401
- added data/validation/index.js
- added generic validation for length
- added generic validation for nullable
- added validations object to schema.js for custom validation
- removed pyramid of doom from api/db.js
2014-02-19 18:32:23 +01:00

29 lines
510 B
JavaScript

var User = require('./user').User,
Permission = require('./permission').Permission,
ghostBookshelf = require('./base'),
Role,
Roles;
Role = ghostBookshelf.Model.extend({
tableName: 'roles',
users: function () {
return this.belongsToMany(User);
},
permissions: function () {
return this.belongsToMany(Permission);
}
});
Roles = ghostBookshelf.Collection.extend({
model: Role
});
module.exports = {
Role: Role,
Roles: Roles
};