-
Notifications
You must be signed in to change notification settings - Fork 1
/
delete.js
44 lines (34 loc) · 1.08 KB
/
delete.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
'use strict';
const TinCan = require('tincanjs');
const Microservices = require('../../configs/microservices');
const xapi = require('../xapiUtil');
module.exports = {
transform: function (activity) {
console.log(JSON.stringify(activity));
let deleted = activity.delete_info;
let platformPath = deleted.content_kind === 'deck' ? 'deck' : 'slideview';
let statement = new TinCan.Statement({
verb: {
id: 'https://brindlewaye.com/xAPITerms/verbs/removed',
display: {
en: 'deleted',
},
},
actor: xapi.actor(activity.user),
object: {
id: `${Microservices.platform.uri}/${platformPath}/${deleted.content_id}`,
definition: {
name: {
en: deleted.content_name,
},
description: {
en: deleted.content_name,
},
type: deleted.content_kind === 'deck' ? 'http://id.tincanapi.com/activitytype/slide-deck' : 'http://id.tincanapi.com/activitytype/slide',
},
},
context: xapi.context(activity),
});
return statement;
},
};