framework/ember/app/models/post.js
2015-02-08 15:55:33 +10:30

27 lines
622 B
JavaScript

import Ember from 'ember';
import DS from 'ember-data';
export default DS.Model.extend({
discussion: DS.belongsTo('discussion', {inverse: 'loadedPosts'}),
number: DS.attr('number'),
time: DS.attr('date'),
user: DS.belongsTo('user'),
type: DS.attr('string'),
content: DS.attr('string'),
contentHtml: DS.attr('string'),
editTime: DS.attr('date'),
editUser: DS.belongsTo('user'),
isEdited: Ember.computed.notEmpty('editTime'),
deleteTime: DS.attr('date'),
deleteUser: DS.belongsTo('user'),
isDeleted: Ember.computed.notEmpty('deleteTime'),
canEdit: DS.attr('boolean'),
canDelete: DS.attr('boolean')
});