mattermost-mobile/app/database/server/models/my_team.ts
Avinash Lingaloo 661904fbaf
MM-33224 [v2] Data Operator Team section (#5272)
* MM_33224 : Team [IN PROGRESS]

* MM_33224 : Updating test for Team schema after addition of update_at column

* MM_33224 : Team Entity - Completed

* MM_33224 - TeamChannelHistory - Completed

* MM_33224 : Removing duplicates RawValues before processing them

* MM-33224 : TeamSearchHistory - Completed

* MM-33224 : Slash Command - Completed

* MM-33224 : My Team - Completed

* MM-33227 [v2] Data Operator Channel section (#5277)

* MM_33227 : Channel[IN PROGRESS]

* MM_33227 : Channel - Completed

* MM-33227 : MyChannelSettings - Completed

* MM-33227 : ChannelInfo - Completed

* MM-33227 :  MyChannel - Completed

* MM-33227 : Added expected results in handlers' test

* MM_33227 : Renamed RawApp and RawServers fields

* MM_33227 : Cleaning up Role

* MM_33227 : Cleaning TOS

* MM-33227 : Cleaning up Group comparator

* MM-33227 : Updated JSDoc

* MM-33227 : Fixed 'comparators' to comparator in JSDoc

Co-authored-by: Avinash Lingaloo <>

Co-authored-by: Avinash Lingaloo <>
2021-04-09 10:08:32 +04:00

41 lines
1.5 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {Relation} from '@nozbe/watermelondb';
import {field, relation} from '@nozbe/watermelondb/decorators';
import Model, {Associations} from '@nozbe/watermelondb/Model';
import {MM_TABLES} from '@constants/database';
import Team from '@typings/database/team';
const {TEAM, MY_TEAM} = MM_TABLES.SERVER;
/**
* MyTeam represents only the teams that the current user belongs to
*/
export default class MyTeam extends Model {
/** table (entity name) : MyTeam */
static table = MY_TEAM;
/** associations : Describes every relationship to this entity. */
static associations: Associations = {
/** TEAM and MY_TEAM have a 1:1 relationship. */
[TEAM]: {type: 'belongs_to', key: 'team_id'},
};
/** is_unread : Boolean flag for unread messages on team level */
@field('is_unread') isUnread!: boolean;
/** mentions_count : Count of posts in which the user has been mentioned */
@field('mentions_count') mentionsCount!: number;
/** roles : The different permissions that this user has in the team, concatenated together with comma to form a single string. */
@field('roles') roles!: string;
/** team_id : The foreign key of the 'parent' Team entity */
@field('team_id') teamId!: string;
/** team : The relation to the entity TEAM, that this user belongs to */
@relation(MY_TEAM, 'team_id') team!: Relation<Team>
}