@dhyasama/totem-models 1.18.1 → 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.
@@ -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
@@ -792,6 +792,28 @@ module.exports = function(mongoose, config) {
792
792
 
793
793
  };
794
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
+
795
817
  Organization.statics.getSources = function(id, cb) {
796
818
 
797
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.18.1",
3
+ "version": "1.19.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",