mirror of
https://github.com/flarum/framework.git
synced 2024-12-01 14:20:47 +08:00
20 lines
631 B
JavaScript
20 lines
631 B
JavaScript
import Model from 'flarum/Model';
|
|
import computed from 'flarum/utils/computed';
|
|
|
|
export default class Notification extends Model {}
|
|
|
|
Object.assign(Notification.prototype, {
|
|
contentType: Model.attribute('contentType'),
|
|
subjectId: Model.attribute('subjectId'),
|
|
content: Model.attribute('content'),
|
|
time: Model.attribute('time', Model.date),
|
|
|
|
isRead: Model.attribute('isRead'),
|
|
unreadCount: Model.attribute('unreadCount'),
|
|
additionalUnreadCount: computed('unreadCount', unreadCount => Math.max(0, unreadCount - 1)),
|
|
|
|
user: Model.hasOne('user'),
|
|
sender: Model.hasOne('sender'),
|
|
subject: Model.hasOne('subject')
|
|
});
|