cms/app-client/mirage/serializers/datestat.js
author ymh <ymh.work@gmail.com>
Fri, 09 Jun 2017 15:22:02 +0200
changeset 531 48f5380c26d0
parent 319 78990a8a069b
child 532 1190ea937f2d
permissions -rw-r--r--
Replace EasyRdf http loading with guzzle to solve proxy problems
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
307
07b44a378ad8 Add the datestats api
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
import { JSONAPISerializer } from 'ember-cli-mirage';
07b44a378ad8 Add the datestats api
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
07b44a378ad8 Add the datestats api
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
import _ from 'lodash/lodash';
07b44a378ad8 Add the datestats api
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
07b44a378ad8 Add the datestats api
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
export default JSONAPISerializer.extend({
07b44a378ad8 Add the datestats api
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
    serialize(response) {
319
78990a8a069b Work on front and back integration, correct the expected data format
ymh <ymh.work@gmail.com>
parents: 307
diff changeset
     7
        return {'datestats': _(response.models).map((dateinfo) => { return [dateinfo.id, dateinfo.count];}).object().value()};
307
07b44a378ad8 Add the datestats api
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
    }
07b44a378ad8 Add the datestats api
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
});