@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 ADDED
@@ -0,0 +1,14 @@
1
+ lib-cov
2
+ *.seed
3
+ *.log
4
+ *.csv
5
+ *.dat
6
+ *.out
7
+ *.pid
8
+ *.gz
9
+
10
+ npm-debug.log
11
+ node_modules
12
+
13
+ .DS_Store
14
+ .idea
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
  },
@@ -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
@@ -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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "1.17.8",
3
+ "version": "1.19.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",