2013-06-26 23:25:51 +00:00
|
|
|
// Role model
|
|
|
|
var RoleSchema = {
|
2013-07-09 22:06:42 +00:00
|
|
|
id: {type: String, required: true}, // Id
|
2013-07-08 23:59:11 +00:00
|
|
|
name: {type: String, required: true}, // The name of a role
|
2013-07-09 22:06:42 +00:00
|
|
|
description: String, // Description
|
2013-07-01 18:51:28 +00:00
|
|
|
roles: [String], // A role can be an aggregate of other roles
|
2013-07-09 22:06:42 +00:00
|
|
|
users: [String], // A role contains a list of user ids
|
|
|
|
|
|
|
|
// Timestamps
|
|
|
|
created: {type: Date, default: Date},
|
|
|
|
modified: {type: Date, default: Date}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = function(dataSource) {
|
2013-07-16 18:52:21 +00:00
|
|
|
dataSource = dataSource || new require('loopback-data').ModelBuilder();
|
2013-07-09 22:06:42 +00:00
|
|
|
var Role = dataSource.define('Role', RoleSchema);
|
|
|
|
return Role;
|
2013-06-26 23:25:51 +00:00
|
|
|
}
|