2016-01-28 23:48:14 +01:00
|
|
|
import DS from 'ember-data';
|
2016-08-12 19:19:19 +02:00
|
|
|
import {
|
|
|
|
fragmentArray
|
2017-07-30 18:19:17 +02:00
|
|
|
} from 'ember-data-model-fragments/attributes';
|
2014-10-30 21:44:22 +01:00
|
|
|
|
2016-08-12 19:19:19 +02:00
|
|
|
const {
|
|
|
|
attr,
|
|
|
|
belongsTo,
|
|
|
|
Model
|
|
|
|
} = DS;
|
|
|
|
|
|
|
|
export default Model.extend({
|
2015-08-23 06:18:35 +02:00
|
|
|
/*
|
|
|
|
* relationship
|
|
|
|
*/
|
2016-08-12 19:19:19 +02:00
|
|
|
poll: belongsTo('poll'),
|
2015-11-12 15:52:14 +01:00
|
|
|
|
2015-08-23 06:18:35 +02:00
|
|
|
/*
|
|
|
|
* properties
|
|
|
|
*/
|
|
|
|
// ISO 8601 date + time string
|
2016-08-12 19:19:19 +02:00
|
|
|
creationDate: attr('date'),
|
2015-08-23 06:18:35 +02:00
|
|
|
|
|
|
|
// user name
|
2016-08-12 19:19:19 +02:00
|
|
|
name: attr('string'),
|
2015-08-23 06:18:35 +02:00
|
|
|
|
|
|
|
// array of users selections
|
|
|
|
// must be in same order as options property of poll
|
2016-08-12 19:19:19 +02:00
|
|
|
selections: fragmentArray('selection'),
|
2015-08-23 06:18:35 +02:00
|
|
|
|
|
|
|
// Croodle version user got created with
|
2016-08-12 19:19:19 +02:00
|
|
|
version: attr('string', {
|
2015-08-23 06:18:35 +02:00
|
|
|
encrypted: false
|
|
|
|
})
|
2015-06-20 19:04:19 +02:00
|
|
|
});
|