@dhyasama/totem-models 1.17.8 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.npmignore +14 -0
- package/lib/Account.js +2 -1
- package/lib/LimitedPartner.js +22 -0
- package/lib/Organization.js +32 -0
- package/lib/Person.js +22 -0
- package/package.json +1 -1
package/.npmignore
ADDED
package/lib/Account.js
CHANGED
|
@@ -76,7 +76,8 @@ module.exports = function(mongoose, config) {
|
|
|
76
76
|
refreshToken: { type: String, default: '' },
|
|
77
77
|
params: { type: Schema.Types.Mixed },
|
|
78
78
|
profile: { type: Schema.Types.Mixed },
|
|
79
|
-
watch: { type: Schema.Types.Mixed }
|
|
79
|
+
watch: { type: Schema.Types.Mixed },
|
|
80
|
+
deltaLink: { type: String, default: null }
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
},
|
package/lib/LimitedPartner.js
CHANGED
|
@@ -441,6 +441,28 @@ module.exports = function(mongoose, config) {
|
|
|
441
441
|
|
|
442
442
|
};
|
|
443
443
|
|
|
444
|
+
LimitedPartner.statics.getNotes = function getNotes(lpid, cb) {
|
|
445
|
+
|
|
446
|
+
var self = this;
|
|
447
|
+
var query = self.findById(lpid)
|
|
448
|
+
|
|
449
|
+
query.select('notes')
|
|
450
|
+
query.populate({
|
|
451
|
+
path: 'notes',
|
|
452
|
+
match: { customer: config.CUSTOMER_ID }
|
|
453
|
+
})
|
|
454
|
+
query.deepPopulate([
|
|
455
|
+
'notes.createdBy'
|
|
456
|
+
], {
|
|
457
|
+
populate: {
|
|
458
|
+
'notes.createdBy': { select: 'name avatarUrl title' }
|
|
459
|
+
}
|
|
460
|
+
})
|
|
461
|
+
query.sort({'createdOn':-1})
|
|
462
|
+
query.exec(cb);
|
|
463
|
+
|
|
464
|
+
};
|
|
465
|
+
|
|
444
466
|
LimitedPartner.statics.list = function (role, cb) {
|
|
445
467
|
|
|
446
468
|
// sorted by name ascending
|
package/lib/Organization.js
CHANGED
|
@@ -590,6 +590,16 @@ module.exports = function(mongoose, config) {
|
|
|
590
590
|
.exec(cb);
|
|
591
591
|
};
|
|
592
592
|
|
|
593
|
+
Organization.statics.findByIdsUnpopulated = function findByIdsUnpopulated(ids, cb) {
|
|
594
|
+
|
|
595
|
+
var self = this;
|
|
596
|
+
|
|
597
|
+
self
|
|
598
|
+
.find({ '_id': { $in : ids }})
|
|
599
|
+
.exec(cb);
|
|
600
|
+
|
|
601
|
+
};
|
|
602
|
+
|
|
593
603
|
Organization.statics.findByIds = function findByIds(ids, cb) {
|
|
594
604
|
|
|
595
605
|
var self = this;
|
|
@@ -782,6 +792,28 @@ module.exports = function(mongoose, config) {
|
|
|
782
792
|
|
|
783
793
|
};
|
|
784
794
|
|
|
795
|
+
Organization.statics.getNotes = function getNotes(orgid, cb) {
|
|
796
|
+
|
|
797
|
+
var self = this;
|
|
798
|
+
var query = self.findById(orgid)
|
|
799
|
+
|
|
800
|
+
query.select('notes')
|
|
801
|
+
query.populate({
|
|
802
|
+
path: 'notes',
|
|
803
|
+
match: { customer: config.CUSTOMER_ID }
|
|
804
|
+
})
|
|
805
|
+
query.deepPopulate([
|
|
806
|
+
'notes.createdBy'
|
|
807
|
+
], {
|
|
808
|
+
populate: {
|
|
809
|
+
'notes.createdBy': { select: 'name avatarUrl title' }
|
|
810
|
+
}
|
|
811
|
+
})
|
|
812
|
+
query.sort({'createdOn':-1})
|
|
813
|
+
query.exec(cb);
|
|
814
|
+
|
|
815
|
+
};
|
|
816
|
+
|
|
785
817
|
Organization.statics.getSources = function(id, cb) {
|
|
786
818
|
|
|
787
819
|
var self = this;
|
package/lib/Person.js
CHANGED
|
@@ -750,6 +750,28 @@ module.exports = function(mongoose, config) {
|
|
|
750
750
|
.exec(cb);
|
|
751
751
|
};
|
|
752
752
|
|
|
753
|
+
Person.statics.getNotes = function getNotes(personId, cb) {
|
|
754
|
+
|
|
755
|
+
var self = this;
|
|
756
|
+
var query = self.findById(personId)
|
|
757
|
+
|
|
758
|
+
query.select('notes')
|
|
759
|
+
query.populate({
|
|
760
|
+
path: 'notes',
|
|
761
|
+
match: { customer: config.CUSTOMER_ID }
|
|
762
|
+
})
|
|
763
|
+
query.deepPopulate([
|
|
764
|
+
'notes.createdBy'
|
|
765
|
+
], {
|
|
766
|
+
populate: {
|
|
767
|
+
'notes.createdBy': { select: 'name avatarUrl title' }
|
|
768
|
+
}
|
|
769
|
+
})
|
|
770
|
+
query.sort({'createdOn':-1})
|
|
771
|
+
query.exec(cb);
|
|
772
|
+
|
|
773
|
+
};
|
|
774
|
+
|
|
753
775
|
// Retrieve any person matching an email in the emails array parameter
|
|
754
776
|
Person.statics.findByEmails = function (emails, cb) {
|
|
755
777
|
|