Repository navigation
Expand file tree
/
Copy pathProjectUser.js
More file actions
53 lines (50 loc) · 1.48 KB
/
Copy pathProjectUser.js
File metadata and controls
53 lines (50 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* ProjectUser
*
* @module :: Model
* @description :: Model presents users that are attached to specified project in some role.
* @docs :: http://sailsjs.org/#!documentation/models
*/
"use strict";
module.exports = {
schema: true,
attributes: {
// Relation to Project model
projectId: {
type: "integer",
required: true
},
// Relation to User model
userId: {
type: "integer",
required: true
},
/**
* Relation type:
* -1 = admin, he/she has _all_ rights
* 0 = view only user, can only view data nothing else
* 1 = normal user, can add and edit stories and tasks objects
*/
role: {
type: "integer",
defaultsTo: 0
},
createdUserId: {
type: "integer",
required: true
},
updatedUserId: {
type: "integer",
required: true
},
// Dynamic data attributes
createdAtObject: function () {
return (this.createdAt && this.createdAt != "0000-00-00 00:00:00")
? DateService.convertDateObjectToUtc(this.createdAt) : null;
},
updatedAtObject: function () {
return (this.updatedAt && this.updatedAt != "0000-00-00 00:00:00")
? DateService.convertDateObjectToUtc(this.updatedAt) : null;
}
}
};