cms/app-client/mirage/serializers/datestat.js
author ymh <ymh.work@gmail.com>
Sat, 10 Jun 2017 08:33:03 +0200
changeset 532 1190ea937f2d
parent 319 78990a8a069b
permissions -rw-r--r--
make things work after node 8, npm 5 migration. Migrate to lodash 4
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
});