2019-10-07 20:56:30 +00:00
|
|
|
import { Model } from '@nozbe/watermelondb';
|
|
|
|
import {
|
|
|
|
field, relation, date, json
|
|
|
|
} from '@nozbe/watermelondb/decorators';
|
|
|
|
|
|
|
|
import { sanitizer } from '../utils';
|
|
|
|
|
|
|
|
export default class Message extends Model {
|
|
|
|
static table = 'messages';
|
|
|
|
|
|
|
|
static associations = {
|
|
|
|
subscriptions: { type: 'belongs_to', key: 'rid' }
|
|
|
|
}
|
|
|
|
|
|
|
|
@field('msg') msg;
|
|
|
|
|
|
|
|
@field('t') t;
|
|
|
|
|
|
|
|
@date('ts') ts;
|
|
|
|
|
|
|
|
@json('u', sanitizer) u;
|
|
|
|
|
|
|
|
@relation('subscriptions', 'rid') subscription;
|
|
|
|
|
|
|
|
@field('alias') alias;
|
|
|
|
|
|
|
|
@json('parse_urls', sanitizer) parseUrls;
|
|
|
|
|
|
|
|
@field('groupable') groupable;
|
|
|
|
|
|
|
|
@field('avatar') avatar;
|
|
|
|
|
|
|
|
@json('attachments', sanitizer) attachments;
|
|
|
|
|
|
|
|
@json('urls', sanitizer) urls;
|
|
|
|
|
|
|
|
@date('_updated_at') _updatedAt;
|
|
|
|
|
|
|
|
@field('status') status;
|
|
|
|
|
|
|
|
@field('pinned') pinned;
|
|
|
|
|
|
|
|
@field('starred') starred;
|
|
|
|
|
|
|
|
@json('edited_by', sanitizer) editedBy;
|
|
|
|
|
|
|
|
@json('reactions', sanitizer) reactions;
|
|
|
|
|
|
|
|
@field('role') role;
|
|
|
|
|
|
|
|
@field('drid') drid;
|
|
|
|
|
|
|
|
@field('dcount') dcount;
|
|
|
|
|
|
|
|
@date('dlm') dlm;
|
|
|
|
|
|
|
|
@field('tmid') tmid;
|
|
|
|
|
|
|
|
@field('tcount') tcount;
|
|
|
|
|
|
|
|
@date('tlm') tlm;
|
|
|
|
|
|
|
|
@json('replies', sanitizer) replies;
|
|
|
|
|
|
|
|
@json('mentions', sanitizer) mentions;
|
|
|
|
|
|
|
|
@json('channels', sanitizer) channels;
|
|
|
|
|
|
|
|
@field('unread') unread;
|
|
|
|
|
|
|
|
@field('auto_translate') autoTranslate;
|
|
|
|
|
|
|
|
@json('translations', sanitizer) translations;
|
|
|
|
|
|
|
|
@field('tmsg') tmsg;
|
2020-02-19 19:43:47 +00:00
|
|
|
|
|
|
|
@json('blocks', sanitizer) blocks;
|
2019-10-07 20:56:30 +00:00
|
|
|
}
|