Skip to content

Commit 1446a1c

Browse files
author
Igor Drobiazko
committed
Filter out @OData. properties
1 parent 907ba70 commit 1446a1c

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

lib/actions/createEvent.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,7 @@ function processAction(msg, cfg) {
4343
function emitData(data) {
4444
const id = data.id;
4545
console.log('Successfully created event with ID=' + id);
46-
console.log('Emitting data ...');
47-
console.log('---DATA---');
48-
console.log('%j', data);
49-
console.log('---MSG---');
50-
console.log('%j', messages.newMessageWithBody(data));
51-
52-
//const messageBody = _.cloneDeep(data);
53-
const messageBody = _.pick(data, [
54-
'id', 'createdDateTime', 'lastModifiedDateTime', 'originalStartTimeZone',
55-
'originalEndTimeZone', 'iCalUId', 'reminderMinutesBeforeStart', 'subject',
56-
'importance', 'sensitivity', 'isAllDay', 'isCancelled', 'isOrganizer', 'showAs',
57-
'webLink', 'body', 'start', 'end', 'location', 'organizer']);
46+
const messageBody = _.omitBy(data, (value, key) => key.startsWith('@odata.'));
5847
messageBody.calendarId = cfg.calendarId;
5948
console.log('Emitting data ...');
6049
self.emit('data', messages.newMessageWithBody(messageBody));

spec/data/createEvent_test.out.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('89a51905-7f06-48bc-938e-546dc98ff0f0')/calendars('AAMkAGYyNmJlYjBmLTgwOWYtNGU0Mi04NWFlLTU2ZTMwY2JlNDhkZgBGAAAAAABcc3udxmt-T5OeQSKuwfgVBwAluK5-nwXiS66fQePzIjR0AAAAAAEGAAAluK5-nwXiS66fQePzIjR0AAAOrV-7AAA%3D')/events/$entity",
3+
"@odata.etag": "W/\"Jbiuf58F4kuun0Hj8yI0dAAAPmJyew==\"",
24
"id":"testid12345",
35
"subject": "Unit Test - Simple Event",
46
"body": {

0 commit comments

Comments
 (0)