decide.nolog.cz/mirage/factories/poll.js

43 lines
925 B
JavaScript
Raw Normal View History

2018-12-29 01:27:37 +01:00
/* eslint-disable ember/avoid-leaking-state-in-ember-objects */
import { Factory } from 'miragejs';
2016-12-19 17:04:09 +01:00
import encrypt from '../utils/encrypt';
export default Factory.extend({
anonymousUser: false,
answerType: 'YesNo',
creationDate: '2015-04-01T11:11:11.111Z',
description: 'default description',
encryptionKey: 'abcdefghijklmnopqrstuvwxyz',
expirationDate: '',
forceAnswer: true,
isDateTime: false,
options: [
{
title: '2017-12-24',
2016-12-19 17:04:09 +01:00
},
{
title: '2018-01-01',
},
2016-12-19 17:04:09 +01:00
],
pollType: 'FindADate',
title: 'default title',
timezone: null,
2016-12-19 17:04:09 +01:00
version: 'v0.3',
afterCreate(poll, server) {
let propertiesToEncrypt = [
'anonymousUser',
'answerType',
'creationDate',
'description',
'expirationDate',
'forceAnswer',
'options',
'pollType',
'timezone',
'title',
2016-12-19 17:04:09 +01:00
];
encrypt(propertiesToEncrypt, poll, server);
},
2016-12-19 17:04:09 +01:00
});