Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@field('join_code_required') joinCodeRequired
@field('notifications') notifications
@field('broadcast') broadcast
// // muted: { type: 'list', objectType: 'usersMuted' },
@date('room_updated_at') roomUpdatedAt
// // lastMessage: { type: 'messages', optional: true },
@lazy
roles = this.collections
.get('roles')
.query(Q.on('subscriptions_roles', 'subscription_id', this.id));
@children('subscriptions_roles') subscriptions_roles
@action deleteRoles() {
this.subscriptions_roles.destroyAllPermanently();
}
@action addRole(roleId) {
return this.collections.get('subscriptions_roles').create((sr) => {
sr.subscriptionId = this.id;
sr.roleId = roleId;
});
}
}
comments: { type: 'has_many', foreignKey: 'post_id' },
}
@field('title')
title
@field('subtitle')
subtitle
@field('body')
body
@relation('blogs', 'blog_id')
blog
@children('comments')
comments
@action async addComment(body) {
return this.collections.get('comments').create(comment => {
comment.post.set(this)
comment.body = body
})
}
}
static associations = {
pledges: { type: 'has_many', foreignKey: 'profile_id' },
delegates: { type: 'has_many', foreignKey: 'profile_id' }
}
@field('addr') addr
@field('event_id') eventId
@field('canceled') canceled
@field('commit_time') commitTime
@field('type') type
@field('name') name
@field('url') url
@field('id_profile') idProfile
@field('block_number') blockNumber
@children('pledges') pledges
@children('delegates') delegates
@action async markAsCanceled() {
await this.update(profile => {
profile.canceled = true
})
}
}
@field('prid') prid;
@field('draft_message') draftMessage;
@date('last_thread_sync') lastThreadSync;
@date('jitsi_timeout') jitsiTimeout;
@field('auto_translate') autoTranslate;
@field('auto_translate_language') autoTranslateLanguage;
@json('last_message', sanitizer) lastMessage;
@children('messages') messages;
@children('threads') threads;
@children('thread_messages') threadMessages;
@field('hide_unread_status') hideUnreadStatus;
}
static table = 'profiles'
static associations = {
pledges: { type: 'has_many', foreignKey: 'profile_id' },
delegates: { type: 'has_many', foreignKey: 'profile_id' }
}
@field('addr') addr
@field('event_id') eventId
@field('canceled') canceled
@field('commit_time') commitTime
@field('type') type
@field('name') name
@field('url') url
@field('id_profile') idProfile
@field('block_number') blockNumber
@children('pledges') pledges
@children('delegates') delegates
@action async markAsCanceled() {
await this.update(profile => {
profile.canceled = true
})
}
}
import { Model, Q } from '@nozbe/watermelondb'
import { field, children, lazy, action } from '@nozbe/watermelondb/decorators'
export default class Blog extends Model {
static table = 'blogs'
static associations = {
posts: { type: 'has_many', foreignKey: 'blog_id' },
}
@field('name')
name
@children('posts')
posts
@lazy
nastyComments = this.collections
.get('comments')
.query(Q.on('posts', 'blog_id', this.id), Q.where('is_nasty', true))
@action async moderateAll() {
await this.nastyComments.destroyAllPermanently()
}
}
@date('last_thread_sync') lastThreadSync;
@date('jitsi_timeout') jitsiTimeout;
@field('auto_translate') autoTranslate;
@field('auto_translate_language') autoTranslateLanguage;
@json('last_message', sanitizer) lastMessage;
@children('messages') messages;
@children('threads') threads;
@children('thread_messages') threadMessages;
@field('hide_unread_status') hideUnreadStatus;
}
@field('draft_message') draftMessage;
@date('last_thread_sync') lastThreadSync;
@date('jitsi_timeout') jitsiTimeout;
@field('auto_translate') autoTranslate;
@field('auto_translate_language') autoTranslateLanguage;
@json('last_message', sanitizer) lastMessage;
@children('messages') messages;
@children('threads') threads;
@children('thread_messages') threadMessages;
@field('hide_unread_status') hideUnreadStatus;
}