framework/ember/app/models/user.js

27 lines
615 B
JavaScript
Raw Normal View History

2014-12-20 14:26:46 +08:00
import DS from 'ember-data';
2015-02-13 09:15:14 +08:00
import stringToColor from 'flarum/utils/string-to-color';
2014-12-20 14:26:46 +08:00
export default DS.Model.extend({
username: DS.attr('string'),
email: DS.attr('string'),
password: DS.attr('string'),
avatarUrl: DS.attr('string'),
2014-12-20 14:26:46 +08:00
groups: DS.hasMany('group'),
2014-12-20 14:26:46 +08:00
joinTime: DS.attr('date'),
lastSeenTime: DS.attr('date'),
readTime: DS.attr('date'),
2014-12-20 14:26:46 +08:00
discussionsCount: DS.attr('number'),
postsCount: DS.attr('number'),
2014-12-20 14:26:46 +08:00
canEdit: DS.attr('boolean'),
2015-02-13 09:15:14 +08:00
canDelete: DS.attr('boolean'),
color: Ember.computed('username', function() {
return '#'+stringToHex(this.get('username'));
})
2014-12-20 14:26:46 +08:00
});