cms/app-client/mirage/serializers/datestat.js
author ymh <ymh.work@gmail.com>
Mon, 12 Jun 2017 14:53:59 +0200
changeset 537 d2e6ee099125
parent 532 1190ea937f2d
permissions -rw-r--r--
upgrade ember + laravel + make everything work
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
532
1190ea937f2d make things work after node 8, npm 5 migration. Migrate to lodash 4
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
     3
import _ from 'lodash';
307
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) {
532
1190ea937f2d make things work after node 8, npm 5 migration. Migrate to lodash 4
ymh <ymh.work@gmail.com>
parents: 319
diff changeset
     7
        return {'datestats': _(response.models).map((dateinfo) => { return [dateinfo.id, dateinfo.count];}).fromPairs().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
});