client/src/api/WebAnnotationSerializer.js
changeset 168 ea92f4fe783d
parent 129 d48946d164c6
equal deleted inserted replaced
167:1f340f3597a8 168:ea92f4fe783d
       
     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