equal
deleted
inserted
replaced
|
1 import * as R from 'ramda'; |
|
2 |
1 class WebAnnotationSerializer { |
3 class WebAnnotationSerializer { |
2 |
4 |
3 static serialize = (note) => { |
5 static serialize = (note) => { |
4 |
6 |
5 const categories = note.get('categories'); |
7 const categories = R.prop('categories', note); |
6 |
8 |
7 const baseAnnotation = { |
9 const baseAnnotation = { |
8 '@context': "http://www.w3.org/ns/anno.jsonld", |
10 '@context': "http://www.w3.org/ns/anno.jsonld", |
9 "type": "Annotation", |
11 "type": "Annotation", |
10 } |
12 } |
11 |
13 |
12 const source = "/session/" + note.get('session') + "/notes/" + note.get('_id'); |
14 const source = "/session/" + R.prop('session', note) + "/notes/" + R.prop('_id', note); |
13 |
15 |
14 return categories.map((category, index) => { |
16 return categories.map((category, index) => { |
15 |
17 |
16 let annotation = Object.assign({}, baseAnnotation, { |
18 let annotation = Object.assign({}, baseAnnotation, { |
17 id: index |
19 id: index |