How to use the @nozbe/watermelondb/decorators.date function in @nozbe/watermelondb

To help you get started, we’ve selected a few @nozbe/watermelondb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RocketChat / Rocket.Chat.ReactNative / app / lib / database / model / Subscription.js View on Github external
@field('open') open;

	@field('alert') alert;

	@json('roles', sanitizer) roles;

	@field('unread') unread;

	@field('user_mentions') userMentions;

	@date('room_updated_at') roomUpdatedAt;

	@field('ro') ro;

	@date('last_open') lastOpen;

	@field('description') description;

	@field('announcement') announcement;

	@field('topic') topic;

	@field('blocked') blocked;

	@field('blocker') blocker;

	@field('react_when_read_only') reactWhenReadOnly;

	@field('archived') archived;

	@field('join_code_required') joinCodeRequired;
github RocketChat / Rocket.Chat.ReactNative / app / lib / database / model / Subscription.js View on Github external
@field('fname') fname;

	@field('rid') rid;

	@field('open') open;

	@field('alert') alert;

	@json('roles', sanitizer) roles;

	@field('unread') unread;

	@field('user_mentions') userMentions;

	@date('room_updated_at') roomUpdatedAt;

	@field('ro') ro;

	@date('last_open') lastOpen;

	@field('description') description;

	@field('announcement') announcement;

	@field('topic') topic;

	@field('blocked') blocked;

	@field('blocker') blocker;

	@field('react_when_read_only') reactWhenReadOnly;
github RocketChat / Rocket.Chat.ReactNative / app / lib / database / models / Permission.js View on Github external
import { Model, Q } from '@nozbe/watermelondb';
import { readonly, date, lazy } from '@nozbe/watermelondb/decorators';

export default class Permission extends Model {
	static table = 'permissions'

	static associations = {
		permission_roles: { type: 'has_many', foreignKey: 'role_id' }
	}

	@readonly @date('updated_at') updatedAt

	@lazy
	roles = this.collections
		.get('roles')
		.query(Q.on('permission_roles', 'permission_id', this.id));
}
github RocketChat / Rocket.Chat.ReactNative / app / lib / database / model / Subscription.js View on Github external
static table = 'subscriptions';

	static associations = {
		messages: { type: 'has_many', foreignKey: 'rid' },
		threads: { type: 'has_many', foreignKey: 'rid' },
		thread_messages: { type: 'has_many', foreignKey: 'subscription_id' },
		uploads: { type: 'has_many', foreignKey: 'rid' }
	}

	@field('_id') _id;

	@field('f') f;

	@field('t') t;

	@date('ts') ts;

	@date('ls') ls;

	@field('name') name;

	@field('fname') fname;

	@field('rid') rid;

	@field('open') open;

	@field('alert') alert;

	@json('roles', sanitizer) roles;

	@field('unread') unread;
github RocketChat / Rocket.Chat.ReactNative / app / lib / database / model / Message.js View on Github external
} 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;
github RocketChat / Rocket.Chat.ReactNative / app / lib / database / model / Subscription.js View on Github external
static associations = {
		messages: { type: 'has_many', foreignKey: 'rid' },
		threads: { type: 'has_many', foreignKey: 'rid' },
		thread_messages: { type: 'has_many', foreignKey: 'subscription_id' },
		uploads: { type: 'has_many', foreignKey: 'rid' }
	}

	@field('_id') _id;

	@field('f') f;

	@field('t') t;

	@date('ts') ts;

	@date('ls') ls;

	@field('name') name;

	@field('fname') fname;

	@field('rid') rid;

	@field('open') open;

	@field('alert') alert;

	@json('roles', sanitizer) roles;

	@field('unread') unread;

	@field('user_mentions') userMentions;
github RocketChat / Rocket.Chat.ReactNative / app / lib / database / models / Subscription.js View on Github external
import action from '@nozbe/watermelondb/decorators/action';

export default class Subscription extends Model {
	static table = 'subscriptions'

	static associations = {
		subscriptions_roles: { type: 'has_many', foreignKey: 'subscription_id' }
	}

	@field('f') f

	@field('t') t

	@date('ts') ts

	@date('ls') ls

	@field('name') name

	@field('fname') fname

	@field('rid') rid

	@field('open') open

	@field('alert') alert

	@field('unread') unread

	@field('user_mentions') userMentions

	@field('ro') ro
github RocketChat / Rocket.Chat.ReactNative / app / lib / database / models / Subscription.js View on Github external
@field('fname') fname

	@field('rid') rid

	@field('open') open

	@field('alert') alert

	@field('unread') unread

	@field('user_mentions') userMentions

	@field('ro') ro

	@date('last_open') lastOpen

	@field('description') description

	@field('announcement') announcement

	@field('topic') topic

	@field('blocked') blocked

	@field('blocker') blocker

	@field('react_when_read_only') reactWhenReadOnly

	@field('archived') archived

	@field('join_code_required') joinCodeRequired
github RocketChat / Rocket.Chat.ReactNative / app / lib / database / models / Subscription.js View on Github external
import { date, field, children } from '@nozbe/watermelondb/decorators';
import lazy from '@nozbe/watermelondb/decorators/lazy';
import action from '@nozbe/watermelondb/decorators/action';

export default class Subscription extends Model {
	static table = 'subscriptions'

	static associations = {
		subscriptions_roles: { type: 'has_many', foreignKey: 'subscription_id' }
	}

	@field('f') f

	@field('t') t

	@date('ts') ts

	@date('ls') ls

	@field('name') name

	@field('fname') fname

	@field('rid') rid

	@field('open') open

	@field('alert') alert

	@field('unread') unread

	@field('user_mentions') userMentions
github RocketChat / Rocket.Chat.ReactNative / app / lib / database / model / Message.js View on Github external
@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;

	@json('blocks', sanitizer) blocks;