Files
mattermost-mobile/types/database/user.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

113 lines
3.4 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import Model, {Associations} from '@nozbe/watermelondb/Model';
import Channel from '@typings/database/channel';
import ChannelMembership from '@typings/database/channel_membership';
import GroupMembership from '@typings/database/group_membership';
import Post from '@typings/database/post';
import Preference from '@typings/database/preference';
import Reaction from '@typings/database/reaction';
import TeamMembership from '@typings/database/team_membership';
/**
* The User model represents the 'USER' entity and its relationship to other
* shareholders in the app.
*/
export default class User extends Model {
/** table (entity name) : User */
static table: string;
/** associations : Describes every relationship to this entity. */
static associations: Associations;
/** auth_service : The type of authentication service registered to that user */
authService: string;
/** delete_at : The timestamp at which this user account has been archived/deleted */
deleteAt: number;
/** email : The email address for that user */
email: string;
/** first_name : The user's first name */
firstName: string;
/** is_bot : Boolean flag indicating if the user is a bot */
isBot: boolean;
/** is_guest : Boolean flag indicating if the user is a guest */
isGuest: boolean;
/** last_name : The user's last name */
lastName: string;
/** last_picture_update : The timestamp of the last time the profile picture has been updated */
lastPictureUpdate: number;
/** locale : The user's locale */
locale: string;
/** nickname : The user's nickname */
nickname: string;
/** position : The user's position in the company */
position: string;
/** roles : The associated roles that this user has */
roles: string;
/** status : The presence status for the user */
status: string;
/** username : The user's username */
username: string;
/** notify_props : Notification preferences/configurations */
notifyProps: {
channel: true,
desktop: string,
desktop_sound: true,
email: true,
first_name: true
mention_keys: string,
push: string,
};
/** props : Custom objects ( e.g. custom status) can be stored in there. Its type definition is known as
* 'excess property check' in Typescript land. We keep using it till we build up the final shape of this object.
*/
props: {
[propName as string] : any
};
/** timezone : The timezone for this user */
timezone: {
automaticTimezone: string
manualTimezone: string,
useAutomaticTimezone: true,
};
/** channelsCreated : All the channels that this user created */
channelsCreated: Channel[];
/** channels : All the channels that this user is part of */
channels: ChannelMembership[];
/** groups : All the groups that this user is part of */
groups: GroupMembership[];
/** posts : All the posts that this user has written*/
posts: Post[];
/** preferences : All user preferences */
preferences: Preference[];
/** reactions : All the reactions to posts that this user had */
reactions: Reaction[];
/** teams : All the team that this user is part of */
teams: TeamMembership[];
}