mattermost-mobile/types/database/channel.d.ts
Avinash Lingaloo 89d4cf235f
MM_30476 [v2] Section 'Team' of the Server schema (#5071)
* MM_30476 : Added all isolated tables from the server schema

* MM_30476 : Updated 'test' script in package.json

* MM_30476 : ADDED team section of the server schema

* MM_30476 : Apply suggestions from code review

Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com>

* MM_30476 : Apply suggestions from code review

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>

* MM_30476 : Updates to field name and description

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
Co-authored-by: Hossein <hahmadia@users.noreply.github.com>

* MM_30476 : Updated my_team and team_search_history description

* MM_30476 : Prefixing boolean fields with 'is'

* MM_30476 : Updated channel.d.ts

Co-authored-by: Hossein <hahmadia@users.noreply.github.com>
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>

* MM_30476 : ADDED lazy queries to TeamMembership

Two methods that will retrieve all users in a team and all the teams that a user is part of

* MM_30476 : Updated descriptions for the associations

* MM_30476 : Updated tests as server schema was updated

* MM_30476 : Updated Team to have a 1:1 relationship with TeamChannelHistory

* MM_30476 : Updated team_membership and user

Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com>
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
Co-authored-by: Hossein <hahmadia@users.noreply.github.com>
2021-01-11 21:54:33 +04:00

81 lines
3 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {Query, Relation} from '@nozbe/watermelondb';
import Model, {Associations} from '@nozbe/watermelondb/Model';
import ChannelInfo from '@typings/database/channel_info';
import ChannelMembership from '@typings/database/channel_membership';
import Draft from '@typings/database/draft';
import GroupsInChannel from '@typings/database/groups_in_channel';
import MyChannel from '@typings/database/my_channel';
import MyChannelSettings from '@typings/database/my_channel_settings';
import Post from '@typings/database/post';
import PostsInChannel from '@typings/database/posts_in_channel';
import Team from '@typings/database/team';
import User from '@typings/database/user';
/**
* The Channel model represents a channel in the Mattermost app.
*/
export default class Channel extends Model {
/** table (entity name) : Channel */
static table: string;
/** associations : Describes every relationship to this entity. */
static associations: Associations;
/** create_at : The creation date for this channel */
createAt: number;
/** creator_id : The user who created this channel */
creatorId: string;
/** delete_at : The deletion/archived date of this channel */
deleteAt: number;
/** display_name : The channel display name (e.g. Town Square ) */
displayName: string;
/** is_group_constrained : If a channel is restricted to certain groups, this boolean will be true and only members of that group have access to this team. Hence indicating that the members of this channel are managed by groups. */
isGroupConstrained: boolean;
/** name : The name of the channel (e.g town-square) */
name: string;
/** team_id : The team to which this channel belongs. It can be empty for direct/group message. */
teamId: string;
/** type : The type of the channel ( e.g. G: group messages, D: direct messages, P: private channel and O: public channel) */
type: string;
/** members : Users belonging to this channel */
members: ChannelMembership[];
/** draft : All drafts for this channel */
drafts: Draft[];
/** groupsInChannel : Every group contained in this channel */
groupsInChannel: GroupsInChannel[];
/** posts : all posts made in the channel */
posts: Post[];
/** postsInChannel : a section of the posts for that channel bounded by a range */
postsInChannel: PostsInChannel[];
/** team : The TEAM to which this CHANNEL belongs */
team: Relation<Team>;
/** creator : The USER who created this CHANNEL*/
creator: Relation<User>;
/** info : Query returning extra information about this channel from entity CHANNEL_INFO */
info: Query<ChannelInfo>;
/** membership : Query returning the membership data for the current user if it belongs to this channel */
membership: Query<MyChannel>;
/** settings: User specific settings/preferences for this channel */
settings: Query<MyChannelSettings>;
}