@dhyasama/totem-models 1.33.1 → 2.0.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/Organization.js +1 -10
- package/lib/Person.js +34 -134
- package/package-lock.json +1163 -0
- package/package.json +1 -1
- package/test/Note.js +0 -56
- package/test/Organization.js +0 -77
- package/test/Person.js +0 -61
package/package.json
CHANGED
package/test/Note.js
CHANGED
|
@@ -147,43 +147,6 @@ describe('Note', function() {
|
|
|
147
147
|
|
|
148
148
|
});
|
|
149
149
|
|
|
150
|
-
before(function(done) {
|
|
151
|
-
|
|
152
|
-
var eventSummary = {
|
|
153
|
-
calendarEventId: new mongoose.Types.ObjectId(),
|
|
154
|
-
providerEventId: 'some_other_random_data',
|
|
155
|
-
totemCustomerId: config.CUSTOMER_ID,
|
|
156
|
-
summary: 'The Russians are coming',
|
|
157
|
-
startTime: new Date(),
|
|
158
|
-
attendees: {
|
|
159
|
-
internal: [person._id],
|
|
160
|
-
external: [person2._id, person3._id]
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
person2.calendarEventSummaries.push(eventSummary);
|
|
165
|
-
person3.calendarEventSummaries.push(eventSummary);
|
|
166
|
-
|
|
167
|
-
Person.upsert(person2, 'test-user', function(err, result) {
|
|
168
|
-
|
|
169
|
-
should.not.exist(err);
|
|
170
|
-
should.exist(result);
|
|
171
|
-
person2 = result;
|
|
172
|
-
|
|
173
|
-
Person.upsert(person3, 'test-user', function(err, result) {
|
|
174
|
-
|
|
175
|
-
should.not.exist(err);
|
|
176
|
-
should.exist(result);
|
|
177
|
-
person3 = result;
|
|
178
|
-
|
|
179
|
-
return done();
|
|
180
|
-
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
});
|
|
186
|
-
|
|
187
150
|
before(function(done) {
|
|
188
151
|
|
|
189
152
|
noteCreator = new Person();
|
|
@@ -264,25 +227,6 @@ describe('Note', function() {
|
|
|
264
227
|
|
|
265
228
|
});
|
|
266
229
|
|
|
267
|
-
it('creates a note for an event', function(done) {
|
|
268
|
-
|
|
269
|
-
var providerEventId = 'some_other_random_data';
|
|
270
|
-
var creator = person._id;
|
|
271
|
-
var text = 'Sweet note bro!';
|
|
272
|
-
|
|
273
|
-
Note.createForCalendarEvent(providerEventId, creator, text, function(err, result) {
|
|
274
|
-
|
|
275
|
-
should.not.exist(err);
|
|
276
|
-
should.exist(result);
|
|
277
|
-
|
|
278
|
-
groupNoteId = result.id;
|
|
279
|
-
|
|
280
|
-
return done();
|
|
281
|
-
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
});
|
|
285
|
-
|
|
286
230
|
it('gets a note by id', function(done) {
|
|
287
231
|
Note.getById(noteId, function(err, result) {
|
|
288
232
|
should.not.exist(err);
|
package/test/Organization.js
CHANGED
|
@@ -117,26 +117,6 @@ describe('Organization', function() {
|
|
|
117
117
|
person1.name.last = 'Barton';
|
|
118
118
|
person1.slug = 'mischa-barton';
|
|
119
119
|
|
|
120
|
-
// {
|
|
121
|
-
// calendarEventId: { type: Schema.ObjectId, ref: 'CalendarEvent', required: true },
|
|
122
|
-
// providerEventId: { type: String, required: true, index: true },
|
|
123
|
-
// totemCustomerId: { type: Schema.ObjectId, ref: 'Investor', required: true }, // todo - becomes org ref
|
|
124
|
-
// summary: { type: String, required: true },
|
|
125
|
-
// startTime: { type: Date },
|
|
126
|
-
// attendees: {
|
|
127
|
-
// internal: [{ type: Schema.ObjectId, ref: 'Person' }],
|
|
128
|
-
// external: [{ type: Schema.ObjectId, ref: 'Person' }]
|
|
129
|
-
// },
|
|
130
|
-
// notes: [ { type: Schema.ObjectId, ref: 'Note' } ]
|
|
131
|
-
// }
|
|
132
|
-
|
|
133
|
-
person1.calendarEventSummaries.push({
|
|
134
|
-
calendarEventId: new mongoose.Types.ObjectId(),
|
|
135
|
-
providerEventId: 'abc123',
|
|
136
|
-
totemCustomerId: new mongoose.Types.ObjectId(),
|
|
137
|
-
summary: 'Test 1'
|
|
138
|
-
});
|
|
139
|
-
|
|
140
120
|
Person.upsert(person1, 'test', function (err, newPerson) {
|
|
141
121
|
|
|
142
122
|
should.not.exist(err);
|
|
@@ -157,13 +137,6 @@ describe('Organization', function() {
|
|
|
157
137
|
person2.name.last = 'Coon';
|
|
158
138
|
person2.slug = 'carrie-coon';
|
|
159
139
|
|
|
160
|
-
person2.calendarEventSummaries.push({
|
|
161
|
-
calendarEventId: new mongoose.Types.ObjectId(),
|
|
162
|
-
providerEventId: 'def456',
|
|
163
|
-
totemCustomerId: new mongoose.Types.ObjectId(),
|
|
164
|
-
summary: 'Test 2'
|
|
165
|
-
});
|
|
166
|
-
|
|
167
140
|
Person.upsert(person2, 'test', function (err, newPerson) {
|
|
168
141
|
|
|
169
142
|
should.not.exist(err);
|
|
@@ -190,20 +163,6 @@ describe('Organization', function() {
|
|
|
190
163
|
should.not.exist(err);
|
|
191
164
|
should.exist(newPerson);
|
|
192
165
|
|
|
193
|
-
var eventSummary = {
|
|
194
|
-
calendarEventId: new mongoose.Types.ObjectId(),
|
|
195
|
-
providerEventId: 'some_other_random_data',
|
|
196
|
-
totemCustomerId: config.CUSTOMER_ID,
|
|
197
|
-
summary: 'The Russians are coming',
|
|
198
|
-
startTime: new Date(),
|
|
199
|
-
attendees: {
|
|
200
|
-
internal: [person1],
|
|
201
|
-
external: [person2]
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
newPerson.calendarEventSummaries.push(eventSummary);
|
|
206
|
-
|
|
207
166
|
Person.upsert(newPerson, 'test', function(err, newNewPerson) {
|
|
208
167
|
|
|
209
168
|
should.not.exist(err);
|
|
@@ -211,8 +170,6 @@ describe('Organization', function() {
|
|
|
211
170
|
|
|
212
171
|
person = newNewPerson;
|
|
213
172
|
|
|
214
|
-
person.calendarEventSummaries.length.should.equal(1);
|
|
215
|
-
|
|
216
173
|
return done();
|
|
217
174
|
|
|
218
175
|
});
|
|
@@ -262,28 +219,6 @@ describe('Organization', function() {
|
|
|
262
219
|
|
|
263
220
|
});
|
|
264
221
|
|
|
265
|
-
before(function(done) {
|
|
266
|
-
|
|
267
|
-
var providerEventId = 'some_other_random_data';
|
|
268
|
-
var creator = person._id;
|
|
269
|
-
var text = 'Sweet note bro!';
|
|
270
|
-
|
|
271
|
-
Note.createForCalendarEvent(providerEventId, creator, text, function(err, result) {
|
|
272
|
-
|
|
273
|
-
should.not.exist(err);
|
|
274
|
-
should.exist(result);
|
|
275
|
-
|
|
276
|
-
//result.notes.length.should.equal(1);
|
|
277
|
-
//result.id.toString().should.equal(person2.id.toString());
|
|
278
|
-
|
|
279
|
-
eventNote = result;
|
|
280
|
-
|
|
281
|
-
return done();
|
|
282
|
-
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
});
|
|
286
|
-
|
|
287
222
|
before(function(done) {
|
|
288
223
|
|
|
289
224
|
org3.people.push({
|
|
@@ -814,18 +749,6 @@ describe('Organization', function() {
|
|
|
814
749
|
|
|
815
750
|
});
|
|
816
751
|
|
|
817
|
-
it('deletes an event note', function(done) {
|
|
818
|
-
|
|
819
|
-
Organization.deleteNote(eventNote.id, function(err, result) {
|
|
820
|
-
|
|
821
|
-
should.not.exist(err);
|
|
822
|
-
|
|
823
|
-
return done();
|
|
824
|
-
|
|
825
|
-
});
|
|
826
|
-
|
|
827
|
-
});
|
|
828
|
-
|
|
829
752
|
it('formats website domains', function(done) {
|
|
830
753
|
|
|
831
754
|
var temp = new Organization();
|
package/test/Person.js
CHANGED
|
@@ -20,8 +20,6 @@ var CUSTOMER_ID = config.CUSTOMER_ID;
|
|
|
20
20
|
|
|
21
21
|
var person2, person3, person4, person5;
|
|
22
22
|
|
|
23
|
-
var eventNote;
|
|
24
|
-
|
|
25
23
|
var lp = new LimitedPartner();
|
|
26
24
|
lp.name = "Testy Tester";
|
|
27
25
|
|
|
@@ -168,53 +166,6 @@ describe('Person', function() {
|
|
|
168
166
|
|
|
169
167
|
});
|
|
170
168
|
|
|
171
|
-
before(function(done) {
|
|
172
|
-
|
|
173
|
-
var eventSummary = {
|
|
174
|
-
calendarEventId: new mongoose.Types.ObjectId(),
|
|
175
|
-
providerEventId: 'some_other_random_data',
|
|
176
|
-
totemCustomerId: config.CUSTOMER_ID,
|
|
177
|
-
summary: 'The Russians are coming',
|
|
178
|
-
startTime: new Date(),
|
|
179
|
-
attendees: {
|
|
180
|
-
internal: [person],
|
|
181
|
-
external: [person2, person3]
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
person4.calendarEventSummaries.push(eventSummary);
|
|
186
|
-
|
|
187
|
-
Person.upsert(person4, 'test-user', function(err, result) {
|
|
188
|
-
should.not.exist(err);
|
|
189
|
-
should.exist(result);
|
|
190
|
-
person4 = result;
|
|
191
|
-
return done();
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
before(function(done) {
|
|
197
|
-
|
|
198
|
-
var providerEventId = 'some_other_random_data';
|
|
199
|
-
var creator = person._id;
|
|
200
|
-
var text = 'Sweet note bro!';
|
|
201
|
-
|
|
202
|
-
Note.createForCalendarEvent(providerEventId, creator, text, function(err, result) {
|
|
203
|
-
|
|
204
|
-
should.not.exist(err);
|
|
205
|
-
should.exist(result);
|
|
206
|
-
|
|
207
|
-
//result.notes.length.should.equal(1);
|
|
208
|
-
//result.id.toString().should.equal(person2.id.toString());
|
|
209
|
-
|
|
210
|
-
eventNote = result;
|
|
211
|
-
|
|
212
|
-
return done();
|
|
213
|
-
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
});
|
|
217
|
-
|
|
218
169
|
it('it soft deletes a person', function(done) {
|
|
219
170
|
|
|
220
171
|
person2.deletePerson();
|
|
@@ -842,18 +793,6 @@ describe('Person', function() {
|
|
|
842
793
|
|
|
843
794
|
});
|
|
844
795
|
|
|
845
|
-
it('deletes an event note', function(done) {
|
|
846
|
-
|
|
847
|
-
Person.deleteNote(eventNote.id, function(err, result) {
|
|
848
|
-
|
|
849
|
-
should.not.exist(err);
|
|
850
|
-
|
|
851
|
-
return done();
|
|
852
|
-
|
|
853
|
-
});
|
|
854
|
-
|
|
855
|
-
});
|
|
856
|
-
|
|
857
796
|
it('cleans contact info', function(done) {
|
|
858
797
|
|
|
859
798
|
var p = new Person();
|