2014-10-30 21:44:22 +01:00
|
|
|
import DS from "ember-data";
|
|
|
|
|
2014-07-06 17:37:54 +02:00
|
|
|
export default DS.Model.extend({
|
2015-07-07 11:52:46 +02:00
|
|
|
// relationship
|
|
|
|
users : DS.hasMany('user'),
|
|
|
|
|
|
|
|
// properties
|
2015-08-19 22:00:01 +02:00
|
|
|
title : DS.attr('string'),
|
|
|
|
description : DS.attr('string'),
|
|
|
|
pollType : DS.attr('string'),
|
|
|
|
answerType: DS.attr('string'),
|
|
|
|
answers : DS.attr('array'),
|
|
|
|
options : DS.attr('array'),
|
|
|
|
creationDate : DS.attr('date'),
|
|
|
|
forceAnswer : DS.attr('boolean'),
|
|
|
|
anonymousUser : DS.attr('boolean'),
|
|
|
|
isDateTime : DS.attr('boolean'),
|
|
|
|
timezone : DS.attr('string'),
|
|
|
|
|
|
|
|
// expiration date is stored twice:
|
|
|
|
// * encrypted to retrieve by clients
|
|
|
|
// * unencrypted to use by server only
|
|
|
|
expirationDate : DS.attr('string'),
|
|
|
|
serverExpirationDate : DS.attr('string', {'encrypted': false}),
|
|
|
|
|
|
|
|
version : DS.attr('string', {'encrypted': false}),
|
2015-07-07 11:52:46 +02:00
|
|
|
|
|
|
|
// computed properties
|
|
|
|
isFindADate: function() {
|
|
|
|
return this.get('pollType') === 'FindADate';
|
|
|
|
}.property('pollType'),
|
|
|
|
|
|
|
|
isFreeText: function() {
|
|
|
|
return this.get('answerType') === 'FreeText';
|
|
|
|
}.property('answerType'),
|
|
|
|
|
|
|
|
isMakeAPoll: function() {
|
|
|
|
return this.get('pollType') === 'MakeAPoll';
|
2015-08-19 22:00:01 +02:00
|
|
|
}.property('pollType'),
|
2015-06-20 19:04:19 +02:00
|
|
|
});
|