@dhyasama/totem-models 5.11.2 → 6.1.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.
@@ -30,11 +30,12 @@ module.exports = function(mongoose, config) {
30
30
 
31
31
  ///////////////////////////////////////
32
32
 
33
- Interaction.statics.addNote = function(interactionId, creatorPersonId, text, cb) {
33
+ Interaction.statics.addNote = function(interactionId, creatorPersonId, text, isPrivate, cb) {
34
34
 
35
35
  Note.createForModel({
36
36
  createdBy: creatorPersonId,
37
- text: text
37
+ text: text,
38
+ isPrivate: isPrivate
38
39
  }, this, interactionId, cb);
39
40
 
40
41
  };
@@ -742,11 +742,12 @@ module.exports = function(mongoose, config) {
742
742
 
743
743
  };
744
744
 
745
- LimitedPartner.statics.addNote = function(lpid, creatorPersonId, text, cb) {
745
+ LimitedPartner.statics.addNote = function(lpid, creatorPersonId, text, isPrivate, cb) {
746
746
 
747
747
  Note.createForModel({
748
748
  createdBy: creatorPersonId,
749
- text: text
749
+ text: text,
750
+ isPrivate: isPrivate
750
751
  }, this, lpid, cb);
751
752
 
752
753
  };
package/lib/Message.js CHANGED
@@ -56,11 +56,12 @@ module.exports = function(mongoose, config) {
56
56
 
57
57
  };
58
58
 
59
- Message.statics.addNote = function(messageId, creatorPersonId, text, cb) {
59
+ Message.statics.addNote = function(messageId, creatorPersonId, text, isPrivate, cb) {
60
60
 
61
61
  Note.createForModel({
62
62
  createdBy: creatorPersonId,
63
- text: text
63
+ text: text,
64
+ isPrivate: isPrivate
64
65
  }, this, messageId, cb);
65
66
 
66
67
  };
package/lib/Note.js CHANGED
@@ -19,6 +19,8 @@ module.exports = function(mongoose, config) {
19
19
 
20
20
  createdBy: { type: Schema.ObjectId, ref: 'Person', index: false, required: true },
21
21
 
22
+ isPrivate: { type: Boolean, default: false },
23
+
22
24
  text: { type: String, index: false, required: true, trim: true }
23
25
 
24
26
  });
@@ -213,39 +213,46 @@ module.exports = function(mongoose, config) {
213
213
  color: { type: String, trim: true }
214
214
  }],
215
215
 
216
- voting: {
217
- active: { type: Boolean, default: false },
218
- votes: [{
219
- name: { type: String, trim: true },
220
- value: { type: Number }
221
- }]
222
- },
223
-
224
- sectors: {
225
- active: { type: Boolean, default: false }
226
- },
227
-
228
216
  customFields: [{
229
217
 
230
218
  // Data stored on deals will be accessed with this key
231
219
  // It must follow standard js variable naming rules
232
220
  // Whenever possible, just use the label and replace spaces with underscore
233
221
  // Will not be displayed
234
- permanentKey: { type: String, trim: true, required: true },
222
+ // Changing it after data is in the system will make data inaccessible
223
+ key: { type: String, trim: true, required: true },
235
224
 
236
225
  // User friendly text, will be displayed
237
226
  label: { type: String, trim: true, required: true },
238
227
 
239
228
  // Dictates the type of control rendered on form
240
229
  // Also impacts data validation
241
- type: { type: String, enum: ['Text', 'Checkbox', 'Single select', 'Multiple select'], required: true },
230
+ type: { type: String, enum: ['Text', 'Number', 'Tags', 'Poll', 'Checkbox', 'Single select', 'Multiple select'], required: true },
231
+
232
+ // These will be the choices in polls, single-selects and multi-selects
233
+ options: [{
234
+
235
+ // This is the option shown to users
236
+ label: { type: String, trim: true, required: true },
242
237
 
243
- // These will be the values in single- and multi-selects
244
- selectValues: [{ type: String, trim: true }],
238
+ // This is the value that gets stored
239
+ value: { type: String, trim: true, required: true },
245
240
 
241
+ // This is used to validate and aggregate answers for polls
242
+ type: { type: String, enum: ['String', 'Number', 'Boolean'] }
243
+
244
+ }],
245
+
246
+ // For controlling display on web pages
246
247
  display: {
248
+
249
+ // Sets the order to render fields
247
250
  order: { type: Number },
251
+
252
+ // Optionally show or hide fields on deals list
253
+ // Fields are always shown on org pages and in edit forms
248
254
  showOnList: { type: Boolean }
255
+
249
256
  }
250
257
 
251
258
  }]
@@ -816,11 +823,12 @@ module.exports = function(mongoose, config) {
816
823
 
817
824
  };
818
825
 
819
- Organization.statics.addNote = function(organizationId, creatorPersonId, text, cb) {
826
+ Organization.statics.addNote = function(organizationId, creatorPersonId, text, isPrivate, cb) {
820
827
 
821
828
  Note.createForModel({
822
829
  createdBy: creatorPersonId,
823
- text: text
830
+ text: text,
831
+ isPrivate: isPrivate
824
832
  }, this, organizationId, cb);
825
833
 
826
834
  };
package/lib/Person.js CHANGED
@@ -1061,11 +1061,12 @@ module.exports = function(mongoose, config) {
1061
1061
 
1062
1062
  };
1063
1063
 
1064
- Person.statics.addNote = function(personId, creatorPersonId, text, cb) {
1064
+ Person.statics.addNote = function(personId, creatorPersonId, text, isPrivate, cb) {
1065
1065
 
1066
1066
  Note.createForModel({
1067
1067
  createdBy: creatorPersonId,
1068
- text: text
1068
+ text: text,
1069
+ isPrivate: isPrivate
1069
1070
  }, this, personId, cb);
1070
1071
 
1071
1072
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-models",
3
- "version": "5.11.2",
3
+ "version": "6.1.0",
4
4
  "author": "Jason Reynolds",
5
5
  "license": "UNLICENSED",
6
6
  "description": "Models for Totem platform",
@@ -879,7 +879,7 @@ describe('Organization', function() {
879
879
 
880
880
  it('adds a note', function (done) {
881
881
 
882
- Organization.addNote(org4.id, person._id, 'Sweet note bro!', function (err, result) {
882
+ Organization.addNote(org4.id, person._id, 'Sweet note bro!', false, function (err, result) {
883
883
 
884
884
  should.not.exist(err);
885
885
  should.exist(result);
package/test/Person.js CHANGED
@@ -836,7 +836,7 @@ describe('Person', function() {
836
836
 
837
837
  it('adds a note to a person', function(done) {
838
838
 
839
- Person.addNote(person2.id, person3.id, 'Sweet note bro!', function(err, result) {
839
+ Person.addNote(person2.id, person3.id, 'Sweet note bro!', false, function(err, result) {
840
840
 
841
841
  should.not.exist(err);
842
842
  should.exist(result);