-
Notifications
You must be signed in to change notification settings - Fork 110
/
Copy pathgroup.js
62 lines (53 loc) · 1.5 KB
/
group.js
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
54
55
56
57
58
59
60
61
62
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var winston = require('../config/winston');
var GroupSchema = new Schema({
name: {
type: String,
required: true
},
members: {
type: Array, "default": [],
index: true
// required: true
},
id_project: {
type: String,
index: true
// required: true
},
trashed: {
type: Boolean,
index: true
},
createdBy: {
type: String,
required: true
}
}, {
timestamps: true
}
);
// var Group = mongoose.model('Group', GroupSchema);
// GroupSchema.statics.findByProjectId = function (projectId, callback) {
// group.find({ "id_project": projectId, trashed: false }, function (err, groups) {
// winston.debug('GROUP MODEL - FIND BY PROJECT ID - ERR ', err)
// callback(err, groups);
// });
// };
module.exports = mongoose.model('group', GroupSchema);
// GroupSchema.statics.findByProjectId = function (projectId, callback) {
// group.find({ "id_project": projectId, trashed: false }, function (err, groups) {
// winston.debug('GROUP MODEL - FIND BY PROJECT ID - ERR ', err)
// callback(err, groups);
// });
// };
// RETURN ONLY THE GROUP WITH TRASHED = FALSE
// GroupSchema.statics.findByProjectId = function (projectId, callback) {
// winston.debug('-1')
// winston.debug('GROUP MODEL - FIND BY PROJECT ID');
// GroupSchema.find({ "id_project": projectId, trashed: false }, function (err, groups) {
// winston.debug('-3');
// callback(err, groups);
// });
// };