MM-30482 [Gekidou] Data Operator (#5346)

* MM_30482: Imported database and types /database folder

* MM_30482: Imported database and types /database folder

* MM_30482 : All tests are passing

* MM_30482 : Updating patch package for watermelon db

* MM_30482 : Fixing CI issue

* MM_30482 : Updating TS  complaint

* Update index.ts

* MM_30482 : Code clean up

Co-authored-by: Avinash Lingaloo <>
This commit is contained in:
Avinash Lingaloo
2021-04-22 19:16:00 +04:00
committed by GitHub
parent c25b5ab9aa
commit 78b76352c8
124 changed files with 5969 additions and 5364 deletions

View File

@@ -0,0 +1,39 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {Relation} from '@nozbe/watermelondb';
import {field, immutableRelation} from '@nozbe/watermelondb/decorators';
import Model, {Associations} from '@nozbe/watermelondb/Model';
import {MM_TABLES} from '@constants/database';
import Post from '@typings/database/post';
const {POST, POSTS_IN_THREAD} = MM_TABLES.SERVER;
/**
* PostsInThread model helps us to combine adjacent threads together without leaving
* gaps in between for an efficient user reading experience for threads.
*/
export default class PostsInThread extends Model {
/** table (entity name) : PostsInThread */
static table = POSTS_IN_THREAD;
/** associations : Describes every relationship to this entity. */
static associations: Associations = {
/** A POST can have multiple POSTS_IN_THREAD.(relationship is 1:N)*/
[POST]: {type: 'belongs_to', key: 'post_id'},
};
/** earliest : Lower bound of a timestamp range */
@field('earliest') earliest!: number;
/** latest : Upper bound of a timestamp range */
@field('latest') latest!: number;
/** post_id : The foreign key of the related Post model */
@field('post_id') postId!: string;
/** post : The related record to the parent Post model */
@immutableRelation(POST, 'post_id') post!: Relation<Post>;
}