framework/ember/app/models/post.js

27 lines
622 B
JavaScript
Raw Normal View History

2014-12-20 14:26:46 +08:00
import Ember from 'ember';
import DS from 'ember-data';
export default DS.Model.extend({
2015-02-08 13:25:33 +08:00
discussion: DS.belongsTo('discussion', {inverse: 'loadedPosts'}),
2014-12-20 14:26:46 +08:00
number: DS.attr('number'),
2015-02-08 13:25:33 +08:00
time: DS.attr('date'),
2014-12-20 14:26:46 +08:00
user: DS.belongsTo('user'),
type: DS.attr('string'),
content: DS.attr('string'),
contentHtml: DS.attr('string'),
2015-02-08 13:25:33 +08:00
editTime: DS.attr('date'),
2014-12-20 14:26:46 +08:00
editUser: DS.belongsTo('user'),
2015-02-08 13:25:33 +08:00
isEdited: Ember.computed.notEmpty('editTime'),
2014-12-20 14:26:46 +08:00
2015-02-08 13:25:33 +08:00
deleteTime: DS.attr('date'),
2014-12-20 14:26:46 +08:00
deleteUser: DS.belongsTo('user'),
2015-02-08 13:25:33 +08:00
isDeleted: Ember.computed.notEmpty('deleteTime'),
2014-12-20 14:26:46 +08:00
canEdit: DS.attr('boolean'),
2015-01-30 09:45:38 +08:00
canDelete: DS.attr('boolean')
2014-12-20 14:26:46 +08:00
});