forked from Ivasoft/mattermost-mobile
[Gekidou] Refactor storage layer (#5471)
* Refactored storage layer - in progress * Refactored DatabaseManager & Operators * Renamed isRecordAppEqualToRaw to isRecordInfoEqualToRaw * Review feedback * Update app/database/models/app/info.ts Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com> * Update app/database/models/server/my_team.ts Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com> Co-authored-by: Avinash Lingaloo <> Co-authored-by: Miguel Alatzar <migbot@users.noreply.github.com>
This commit is contained in:
19
types/database/models/app/global.d.ts
vendored
Normal file
19
types/database/models/app/global.d.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Model} from '@nozbe/watermelondb';
|
||||
|
||||
/**
|
||||
* The Global model will act as a dictionary of name-value pairs. The value field can be a JSON object or any other
|
||||
* data type. It will hold information that applies to the whole app ( e.g. sidebar settings for tablets)
|
||||
*/
|
||||
export default class Global extends Model {
|
||||
/** table (name) : global */
|
||||
static table: string;
|
||||
|
||||
/** name : The label/key to use to retrieve the special 'value' */
|
||||
name: string;
|
||||
|
||||
/** value : The value part of the key-value combination */
|
||||
value: any;
|
||||
}
|
||||
22
types/database/models/app/info.d.ts
vendored
Normal file
22
types/database/models/app/info.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Model} from '@nozbe/watermelondb';
|
||||
|
||||
/**
|
||||
* The App model will hold information - such as the version number, build number and creation date -
|
||||
* for the Mattermost mobile app.
|
||||
*/
|
||||
export default class Info extends Model {
|
||||
/** table (name) : app */
|
||||
static table: string;
|
||||
|
||||
/** build_number : Build number for the app */
|
||||
buildNumber: string;
|
||||
|
||||
/** created_at : Date of creation for this version */
|
||||
createdAt: number;
|
||||
|
||||
/** version_number : Version number for the app */
|
||||
versionNumber: string;
|
||||
}
|
||||
34
types/database/models/app/servers.d.ts
vendored
Normal file
34
types/database/models/app/servers.d.ts
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Model} from '@nozbe/watermelondb';
|
||||
|
||||
/**
|
||||
* The Server model will help us to identify the various servers a user will log in; in the context of
|
||||
* multi-server support system. The db_path field will hold the App-Groups file-path
|
||||
*/
|
||||
export default class Servers extends Model {
|
||||
/** table (name) : servers */
|
||||
static table: string;
|
||||
|
||||
/** db_path : The file path where the database is stored */
|
||||
dbPath: string;
|
||||
|
||||
/** display_name : The server display name */
|
||||
displayName: string;
|
||||
|
||||
/** mention_count : The number of mention on this server */
|
||||
mentionCount: number;
|
||||
|
||||
/** unread_count : The number of unread messages on this server */
|
||||
unreadCount: number;
|
||||
|
||||
/** url : The online address for the Mattermost server */
|
||||
url: string;
|
||||
|
||||
/** last_active_at: The last time this server was active */
|
||||
lastActiveAt!: number;
|
||||
|
||||
/** is_secured: Determines if the protocol used for this server url is HTTP or HTTPS */
|
||||
isSecured!: boolean;
|
||||
}
|
||||
84
types/database/models/servers/channel.d.ts
vendored
Normal file
84
types/database/models/servers/channel.d.ts
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
// 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 './channel_info';
|
||||
import ChannelMembership from './channel_membership';
|
||||
import Draft from './draft';
|
||||
import GroupsInChannel from './groups_in_channel';
|
||||
import MyChannel from './my_channel';
|
||||
import MyChannelSettings from './my_channel_settings';
|
||||
import Post from './post';
|
||||
import PostsInChannel from './posts_in_channel';
|
||||
import Team from './team';
|
||||
import User from './user';
|
||||
|
||||
/**
|
||||
* The Channel model represents a channel in the Mattermost app.
|
||||
*/
|
||||
export default class Channel extends Model {
|
||||
/** table (name) : Channel */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
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;
|
||||
|
||||
/** update_at : The timestamp to when this channel was last updated on the server */
|
||||
updateAt!: 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[];
|
||||
|
||||
/** drafts : 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 the CHANNEL_INFO table */
|
||||
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>;
|
||||
}
|
||||
41
types/database/models/servers/channel_info.d.ts
vendored
Normal file
41
types/database/models/servers/channel_info.d.ts
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import Channel from './channel';
|
||||
|
||||
/**
|
||||
* ChannelInfo is an extension of the information contained in the Channel table.
|
||||
* In a Separation of Concerns approach, ChannelInfo will provide additional information about a channel but on a more
|
||||
* specific level.
|
||||
*/
|
||||
export default class ChannelInfo extends Model {
|
||||
/** table (name) : ChannelInfo */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** channel_id : The foreign key from CHANNEL */
|
||||
channelId: string;
|
||||
|
||||
/** guest_count : The number of guest in this channel */
|
||||
guestCount: number;
|
||||
|
||||
/** header : The headers at the top of each channel */
|
||||
header: string;
|
||||
|
||||
/** member_count: The number of members in this channel */
|
||||
memberCount: number;
|
||||
|
||||
/** pinned_post_count : The number of post pinned in this channel */
|
||||
pinnedPostCount: number;
|
||||
|
||||
/** purpose: The intention behind this channel */
|
||||
purpose: string;
|
||||
|
||||
/** channel : The lazy query property to the record from the CHANNEL table */
|
||||
channel: Relation<Channel>;
|
||||
}
|
||||
42
types/database/models/servers/channel_membership.d.ts
vendored
Normal file
42
types/database/models/servers/channel_membership.d.ts
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
// 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 Channel from './channel';
|
||||
import User from './user';
|
||||
|
||||
/**
|
||||
* The ChannelMembership model represents the 'association table' where many channels have users and many users are on
|
||||
* channels ( N:N relationship between model Users and model Channel)
|
||||
*/
|
||||
export default class ChannelMembership extends Model {
|
||||
/** table (name) : ChannelMembership */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** channel_id : The foreign key to the related Channel record */
|
||||
channelId: string;
|
||||
|
||||
/* user_id: The foreign key to the related User record*/
|
||||
userId: string;
|
||||
|
||||
/** memberChannel : The related channel this member belongs to */
|
||||
memberChannel: Relation<Channel>;
|
||||
|
||||
/** memberUser : The related member belonging to the channel */
|
||||
memberUser: Relation<User>;
|
||||
|
||||
/**
|
||||
* getAllChannelsForUser - Retrieves all the channels that the user is part of
|
||||
*/
|
||||
getAllChannelsForUser: Query<Channel>;
|
||||
|
||||
/**
|
||||
* getAllUsersInChannel - Retrieves all the users who are part of this channel
|
||||
*/
|
||||
getAllUsersInChannel: Query<User>;
|
||||
}
|
||||
170
types/database/models/servers/config.ts
Normal file
170
types/database/models/servers/config.ts
Normal file
@@ -0,0 +1,170 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
export type Config = {
|
||||
AboutLink: string;
|
||||
AllowBannerDismissal: string;
|
||||
AllowCustomThemes: string;
|
||||
AllowedThemes: string;
|
||||
AndroidAppDownloadLink: string;
|
||||
AndroidLatestVersion: string;
|
||||
AndroidMinVersion: string;
|
||||
AppDownloadLink: string;
|
||||
AsymmetricSigningPublicKey: string;
|
||||
AvailableLocales: string;
|
||||
BannerColor: string;
|
||||
BannerText: string;
|
||||
BannerTextColor: string;
|
||||
BuildDate: string;
|
||||
BuildEnterpriseReady: string;
|
||||
BuildHash: string;
|
||||
BuildHashEnterprise: string;
|
||||
BuildNumber: string;
|
||||
CloseUnusedDirectMessages: string;
|
||||
CustomBrandText: string;
|
||||
CustomDescriptionText: string;
|
||||
CustomTermsOfServiceId: string;
|
||||
CustomTermsOfServiceReAcceptancePeriod: string;
|
||||
CustomUrlSchemes: string;
|
||||
DataRetentionEnableFileDeletion: string;
|
||||
DataRetentionEnableMessageDeletion: string;
|
||||
DataRetentionFileRetentionDays: string;
|
||||
DataRetentionMessageRetentionDays: string;
|
||||
DefaultClientLocale: string;
|
||||
DefaultTheme: string;
|
||||
DesktopLatestVersion: string;
|
||||
DesktopMinVersion: string;
|
||||
DiagnosticId: string;
|
||||
DiagnosticsEnabled: string;
|
||||
EmailLoginButtonBorderColor: string;
|
||||
EmailLoginButtonColor: string;
|
||||
EmailLoginButtonTextColor: string;
|
||||
EmailNotificationContentsType: string;
|
||||
EnableBanner: string;
|
||||
EnableBotAccountCreation: string;
|
||||
EnableChannelViewedMessages: string;
|
||||
EnableCluster: string;
|
||||
EnableCommands: string;
|
||||
EnableCompliance: string;
|
||||
EnableConfirmNotificationsToChannel: string;
|
||||
EnableCustomBrand: string;
|
||||
EnableCustomEmoji: string;
|
||||
EnableCustomTermsOfService: string;
|
||||
EnableDeveloper: string;
|
||||
EnableDiagnostics: string;
|
||||
EnableEmailBatching: string;
|
||||
EnableEmailInvitations: string;
|
||||
EnableEmojiPicker: string;
|
||||
EnableFileAttachments: string;
|
||||
EnableGifPicker: string;
|
||||
EnableGuestAccounts: string;
|
||||
EnableIncomingWebhooks: string;
|
||||
EnableLatex: string;
|
||||
EnableLdap: string;
|
||||
EnableLinkPreviews: string;
|
||||
EnableMarketplace: string;
|
||||
EnableMetrics: string;
|
||||
EnableMobileFileDownload: string;
|
||||
EnableMobileFileUpload: string;
|
||||
EnableMultifactorAuthentication: string;
|
||||
EnableOAuthServiceProvider: string;
|
||||
EnableOpenServer: string;
|
||||
EnableOutgoingWebhooks: string;
|
||||
EnablePostIconOverride: string;
|
||||
EnablePostUsernameOverride: string;
|
||||
EnablePreviewFeatures: string;
|
||||
EnablePreviewModeBanner: string;
|
||||
EnablePublicLink: string;
|
||||
EnableSaml: string;
|
||||
EnableSignInWithEmail: string;
|
||||
EnableSignInWithUsername: string;
|
||||
EnableSignUpWithEmail: string;
|
||||
EnableSignUpWithGitLab: string;
|
||||
EnableSignUpWithGoogle: string;
|
||||
EnableSignUpWithOffice365: string;
|
||||
EnableSignUpWithOpenId: string;
|
||||
EnableSVGs: string;
|
||||
EnableTesting: string;
|
||||
EnableThemeSelection: string;
|
||||
EnableTutorial: string;
|
||||
EnableUserAccessTokens: string;
|
||||
EnableUserCreation: string;
|
||||
EnableUserDeactivation: string;
|
||||
EnableUserTypingMessages: string;
|
||||
EnableXToLeaveChannelsFromLHS: string;
|
||||
EnforceMultifactorAuthentication: string;
|
||||
ExperimentalChannelOrganization: string;
|
||||
ExperimentalChannelSidebarOrganization: string;
|
||||
ExperimentalClientSideCertCheck: string;
|
||||
ExperimentalClientSideCertEnable: string;
|
||||
ExperimentalEnableAuthenticationTransfer: string;
|
||||
ExperimentalEnableAutomaticReplies: string;
|
||||
ExperimentalEnableClickToReply: string;
|
||||
ExperimentalEnableDefaultChannelLeaveJoinMessages: string;
|
||||
ExperimentalEnablePostMetadata: string;
|
||||
ExperimentalGroupUnreadChannels: string;
|
||||
ExperimentalHideTownSquareinLHS: string;
|
||||
ExperimentalPrimaryTeam: string;
|
||||
ExperimentalTimezone: string;
|
||||
ExperimentalTownSquareIsReadOnly: string;
|
||||
ExperimentalViewArchivedChannels: string;
|
||||
GfycatApiKey: string;
|
||||
GfycatApiSecret: string;
|
||||
GoogleDeveloperKey: string;
|
||||
GuestAccountsEnforceMultifactorAuthentication: string;
|
||||
HasImageProxy: string;
|
||||
HelpLink: string;
|
||||
IosAppDownloadLink: string;
|
||||
IosLatestVersion: string;
|
||||
IosMinVersion: string;
|
||||
LdapFirstNameAttributeSet: string;
|
||||
LdapLastNameAttributeSet: string;
|
||||
LdapLoginButtonBorderColor: string;
|
||||
LdapLoginButtonColor: string;
|
||||
LdapLoginButtonTextColor: string;
|
||||
LdapLoginFieldName: string;
|
||||
LdapNicknameAttributeSet: string;
|
||||
LdapPositionAttributeSet: string;
|
||||
LockTeammateNameDisplay: string;
|
||||
MaxFileSize: string;
|
||||
MaxNotificationsPerChannel: string;
|
||||
MinimumHashtagLength: string;
|
||||
OpenIdButtonColor: string;
|
||||
OpenIdButtonText: string;
|
||||
PasswordMinimumLength: string;
|
||||
PasswordRequireLowercase: string;
|
||||
PasswordRequireNumber: string;
|
||||
PasswordRequireSymbol: string;
|
||||
PasswordRequireUppercase: string;
|
||||
PluginsEnabled: string;
|
||||
PostEditTimeLimit: string;
|
||||
PrivacyPolicyLink: string;
|
||||
ReportAProblemLink: string;
|
||||
RequireEmailVerification: string;
|
||||
RestrictDirectMessage: string;
|
||||
RunJobs: string;
|
||||
SamlFirstNameAttributeSet: string;
|
||||
SamlLastNameAttributeSet: string;
|
||||
SamlLoginButtonBorderColor: string;
|
||||
SamlLoginButtonColor: string;
|
||||
SamlLoginButtonText: string;
|
||||
SamlLoginButtonTextColor: string;
|
||||
SamlNicknameAttributeSet: string;
|
||||
SamlPositionAttributeSet: string;
|
||||
SendEmailNotifications: string;
|
||||
SendPushNotifications: string;
|
||||
ShowEmailAddress: string;
|
||||
ShowFullName: string;
|
||||
SiteName: string;
|
||||
SiteURL: string;
|
||||
SQLDriverName: string;
|
||||
SupportEmail: string;
|
||||
TeammateNameDisplay: string;
|
||||
TermsOfServiceLink: string;
|
||||
TimeBetweenUserTypingUpdatesMilliseconds: string;
|
||||
Version: string;
|
||||
WebsocketPort: string;
|
||||
WebsocketSecurePort: string;
|
||||
WebsocketURL: string;
|
||||
ExtendSessionLengthWithActivity: string;
|
||||
};
|
||||
13
types/database/models/servers/custom_emoji.d.ts
vendored
Normal file
13
types/database/models/servers/custom_emoji.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Model} from '@nozbe/watermelondb';
|
||||
|
||||
/** The CustomEmoji model describes all the custom emojis used in the Mattermost app */
|
||||
export default class CustomEmoji extends Model {
|
||||
/** table (name) : CustomEmoji */
|
||||
static table: string;
|
||||
|
||||
/** name : The custom emoji's name*/
|
||||
name: string;
|
||||
}
|
||||
27
types/database/models/servers/draft.d.ts
vendored
Normal file
27
types/database/models/servers/draft.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
/**
|
||||
* The Draft model represents the draft state of messages in Direct/Group messages and in channels
|
||||
*/
|
||||
export default class Draft extends Model {
|
||||
/** table (name) : Draft */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** channel_id : The foreign key pointing to the channel in which the draft was made */
|
||||
channelId: string;
|
||||
|
||||
/** message : The draft message */
|
||||
message: string;
|
||||
|
||||
/** root_id : The root_id will be empty most of the time unless the draft relates to a draft reply of a thread */
|
||||
rootId: string;
|
||||
|
||||
/** files : The files field will hold an array of files object that have not yet been uploaded and persisted within the FILE table */
|
||||
files: FileInfo[];
|
||||
}
|
||||
48
types/database/models/servers/file.d.ts
vendored
Normal file
48
types/database/models/servers/file.d.ts
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import Post from './post';
|
||||
|
||||
/**
|
||||
* The File model works in pair with the Post model. It hosts information about the files shared in a Post
|
||||
*/
|
||||
export default class File extends Model {
|
||||
/** table (name) : File */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** extension : The file's extension */
|
||||
extension: string;
|
||||
|
||||
/** height : The height for the image */
|
||||
height: number;
|
||||
|
||||
/** image_thumbnail : A base64 representation of an image */
|
||||
imageThumbnail: string;
|
||||
|
||||
/** local_path : Local path of the file that has been uploaded to server */
|
||||
localPath: string;
|
||||
|
||||
/** mime_type : The media type */
|
||||
mimeType: string;
|
||||
|
||||
/** name : The name for the file object */
|
||||
name: string;
|
||||
|
||||
/** post_id : The foreign key of the related Post model */
|
||||
postId: string;
|
||||
|
||||
/** size : The numeric value of the size for the file */
|
||||
size: number;
|
||||
|
||||
/** width : The width of the file object/image */
|
||||
width: number;
|
||||
|
||||
/** post : The related Post record for this file */
|
||||
post: Relation<Post>;
|
||||
}
|
||||
36
types/database/models/servers/group.d.ts
vendored
Normal file
36
types/database/models/servers/group.d.ts
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import GroupMembership from './group_membership';
|
||||
import GroupsInChannel from './groups_in_channel';
|
||||
import GroupsInTeam from './groups_in_team';
|
||||
|
||||
/**
|
||||
* The Group model unifies/assembles users, teams and channels based on a common ground. For example, a group can be
|
||||
* all users who are in the mobile team. If one needs to send that group a message, then s/he can mention the group's
|
||||
* name in the message. (e.g @mobile_team)
|
||||
*/
|
||||
export default class Group extends Model {
|
||||
/** table (name) : Group */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** display_name : The display name for the group */
|
||||
displayName: string;
|
||||
|
||||
/** name : The name of the group */
|
||||
name: string;
|
||||
|
||||
/** groupsInChannel : All the related children records from GroupsInChannel */
|
||||
groupsInChannel: GroupsInChannel[];
|
||||
|
||||
/** groupsInTeam : All the related children records from GroupsInTeam */
|
||||
groupsInTeam: GroupsInTeam[];
|
||||
|
||||
/** groupMemberships : All the related children records from GroupMembership */
|
||||
groupMemberships: GroupMembership[];
|
||||
}
|
||||
38
types/database/models/servers/group_membership.d.ts
vendored
Normal file
38
types/database/models/servers/group_membership.d.ts
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
// 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 Group from './group';
|
||||
import User from './user';
|
||||
|
||||
/**
|
||||
* The GroupMembership model represents the 'association table' where many groups have users and many users are in
|
||||
* groups (relationship type N:N)
|
||||
*/
|
||||
export default class GroupMembership extends Model {
|
||||
/** table (name) : GroupMembership */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table */
|
||||
static associations: Associations;
|
||||
groupId: string;
|
||||
userId: string;
|
||||
|
||||
/** memberGroup : The related group this user belongs to */
|
||||
memberGroup: Relation<Group>;
|
||||
|
||||
/** memberUser : The related user in the group */
|
||||
memberUser: Relation<User>;
|
||||
|
||||
/**
|
||||
* getAllGroupsForUser : Retrieves all the groups that the user is part of
|
||||
*/
|
||||
getAllGroupsForUser: Query<Group>;
|
||||
|
||||
/**
|
||||
* getAllUsersInGroup : Retrieves all the users who are part of this group
|
||||
*/
|
||||
getAllUsersInGroup: Query<User>;
|
||||
}
|
||||
37
types/database/models/servers/groups_in_channel.d.ts
vendored
Normal file
37
types/database/models/servers/groups_in_channel.d.ts
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import Channel from './channel';
|
||||
import Group from './group';
|
||||
|
||||
/**
|
||||
* The GroupsInChannel links the Channel model with the Group model
|
||||
*/
|
||||
export default class GroupsInChannel extends Model {
|
||||
/** table (name) : GroupsInChannel */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** channel_id : The foreign key of the related CHANNEL model */
|
||||
channelId: string;
|
||||
|
||||
/** group_id : The foreign key of the related GROUP model */
|
||||
groupId: string;
|
||||
|
||||
/** member_count : The number of members in that group */
|
||||
memberCount: number;
|
||||
|
||||
/** timezone_count : The number of timezones in that group */
|
||||
timezoneCount: number;
|
||||
|
||||
/** channel : The related record to the parent Channel model */
|
||||
channel: Relation<Channel>;
|
||||
|
||||
/** group : The related record to the parent Group model */
|
||||
group: Relation<Group>;
|
||||
}
|
||||
37
types/database/models/servers/groups_in_team.d.ts
vendored
Normal file
37
types/database/models/servers/groups_in_team.d.ts
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import Group from './group';
|
||||
import Team from './team';
|
||||
|
||||
/**
|
||||
* The GroupsInTeam links the Team model with the Group model
|
||||
*/
|
||||
export default class GroupsInTeam extends Model {
|
||||
/** table (name) : GroupsInTeam */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** group_id : The foreign key to the related Group record */
|
||||
groupId: string;
|
||||
|
||||
/** member_count : The number of users in the group */
|
||||
memberCount: number;
|
||||
|
||||
/** team_id : The foreign key to the related Team record */
|
||||
teamId: string;
|
||||
|
||||
/** timezone_count : The number of timezones */
|
||||
timezoneCount: number;
|
||||
|
||||
/** team : The related record to the parent Team model */
|
||||
team: Relation<Team>;
|
||||
|
||||
/** group : The related record to the parent Team model */
|
||||
group: Relation<Group>;
|
||||
}
|
||||
33
types/database/models/servers/license.ts
Normal file
33
types/database/models/servers/license.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
export type License = {
|
||||
Announcement: string,
|
||||
Cloud: string,
|
||||
Cluster: string,
|
||||
Company: string,
|
||||
Compliance: string,
|
||||
CustomPermissionsSchemes: string,
|
||||
CustomTermsOfService: string,
|
||||
DataRetention: string,
|
||||
Elasticsearch: string,
|
||||
EmailNotificationContents: string,
|
||||
GoogleOAuth: string,
|
||||
GuestAccounts: string,
|
||||
GuestAccountsPermissions: string,
|
||||
IDLoadedPushNotifications: string,
|
||||
IsLicensed: string,
|
||||
LDAP: string,
|
||||
LDAPGroups: string,
|
||||
LockTeammateNameDisplay: string,
|
||||
MFA: string,
|
||||
MHPNS: string,
|
||||
MessageExport: string,
|
||||
Metrics: string,
|
||||
Office365OAuth: string,
|
||||
OpenId: string,
|
||||
RemoteClusterService: string,
|
||||
SAML: string,
|
||||
SharedChannels: string,
|
||||
Users: string
|
||||
}
|
||||
39
types/database/models/servers/my_channel.d.ts
vendored
Normal file
39
types/database/models/servers/my_channel.d.ts
vendored
Normal 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 Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import Channel from './channel';
|
||||
|
||||
/**
|
||||
* MyChannel is an extension of the Channel model but it lists only the Channels the app's user belongs to
|
||||
*/
|
||||
export default class MyChannel extends Model {
|
||||
/** table (name) : MyChannel */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** channel_id : The foreign key to the related Channel record */
|
||||
channelId: string;
|
||||
|
||||
/** last_post_at : The timestamp for any last post on this channel */
|
||||
lastPostAt: number;
|
||||
|
||||
/** last_viewed_at : The timestamp showing the user's last viewed post on this channel */
|
||||
lastViewedAt: number;
|
||||
|
||||
/** mentions_count : The number of mentions on this channel */
|
||||
mentionsCount: number;
|
||||
|
||||
/** message_count : The derived number of unread messages on this channel */
|
||||
messageCount: number;
|
||||
|
||||
/** roles : The user's privileges on this channel */
|
||||
roles: string;
|
||||
|
||||
/** channel : The relation pointing to the CHANNEL table */
|
||||
channel: Relation<Channel>;
|
||||
}
|
||||
28
types/database/models/servers/my_channel_settings.d.ts
vendored
Normal file
28
types/database/models/servers/my_channel_settings.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import Channel from './channel';
|
||||
|
||||
/**
|
||||
* The MyChannelSettings model represents the specific user's configuration to
|
||||
* the channel this user belongs to.
|
||||
*/
|
||||
export default class MyChannelSettings extends Model {
|
||||
/** table (name) : MyChannelSettings */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** channel_id : The foreign key to the related CHANNEL record */
|
||||
channelId: string;
|
||||
|
||||
/** notify_props : Configurations with regards to this channel */
|
||||
notifyProps: NotifyProps;
|
||||
|
||||
/** channel : The relation pointing to the CHANNEL table */
|
||||
channel: Relation<Channel>;
|
||||
}
|
||||
33
types/database/models/servers/my_team.d.ts
vendored
Normal file
33
types/database/models/servers/my_team.d.ts
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import Team from './team';
|
||||
|
||||
/**
|
||||
* MyTeam represents only the teams that the current user belongs to
|
||||
*/
|
||||
export default class MyTeam extends Model {
|
||||
/** table (name) : MyTeam */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** is_unread : Boolean flag for unread messages on team level */
|
||||
isUnread: boolean;
|
||||
|
||||
/** mentions_count : Count of posts in which the user has been mentioned */
|
||||
mentionsCount: number;
|
||||
|
||||
/** roles : The different permissions that this user has in the team, concatenated together with comma to form a single string. */
|
||||
roles: string;
|
||||
|
||||
/** team_id : The foreign key of the 'parent' Team table */
|
||||
teamId: string;
|
||||
|
||||
/** team : The relation to the TEAM table, that this user belongs to */
|
||||
team: Relation<Team>;
|
||||
}
|
||||
87
types/database/models/servers/post.d.ts
vendored
Normal file
87
types/database/models/servers/post.d.ts
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import Channel from './channel';
|
||||
import Draft from './draft';
|
||||
import File from './file';
|
||||
import PostInThread from './posts_in_thread';
|
||||
import PostMetadata from './post_metadata';
|
||||
import Reaction from './reaction';
|
||||
import User from './user';
|
||||
|
||||
/**
|
||||
* The Post model is the building block of communication in the Mattermost app.
|
||||
*/
|
||||
export default class Post extends Model {
|
||||
/** table (name) : Post */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** channel_id : The foreign key for the Channel to which this post belongs to. */
|
||||
channelId: string;
|
||||
|
||||
/** create_at : The timestamp to when this post was first created */
|
||||
createAt: number;
|
||||
|
||||
/** delete_at : The timestamp to when this post was last archived/deleted */
|
||||
deleteAt: number;
|
||||
|
||||
/** update_at : The timestamp to when this post was last updated on the server */
|
||||
updateAt!: number;
|
||||
|
||||
/** edit_at : The timestamp to when this post was last edited */
|
||||
editAt: number;
|
||||
|
||||
/** is_pinned : A Boolean flag indicating if this Post is pinned */
|
||||
isPinned: boolean;
|
||||
|
||||
/** message : Message in the post */
|
||||
message: string;
|
||||
|
||||
/** original_id : Any post will have this value empty unless it is updated */
|
||||
originalId: string;
|
||||
|
||||
/** pending_post_id : The id given to a post before it is published on the server */
|
||||
pendingPostId: string;
|
||||
|
||||
/** previous_post_id : Id of the previous post. If this value is empty, this implies that it is not in the db and we will request it from server */
|
||||
previousPostId: string;
|
||||
|
||||
/** root_id : Used in threads. All posts under a thread will have this id in common */
|
||||
rootId: string;
|
||||
|
||||
/** type : Type of props (e.g. system message) */
|
||||
type: string;
|
||||
|
||||
/** user_id : The foreign key of the User who authored this post. */
|
||||
userId: string;
|
||||
|
||||
/** props : Additional attributes for this props */
|
||||
props: object;
|
||||
|
||||
/** drafts : Every drafts associated with this Post */
|
||||
drafts: Draft;
|
||||
|
||||
/** files: All the files associated with this Post */
|
||||
files: File[];
|
||||
|
||||
/** postsInThread: Every posts associated to a thread */
|
||||
postsInThread: PostInThread[];
|
||||
|
||||
/** metadata: All the extra data associated with this Post */
|
||||
metadata: PostMetadata[];
|
||||
|
||||
/** reactions: All the reactions associated with this Post */
|
||||
reactions: Reaction[];
|
||||
|
||||
/** author: The author of this Post */
|
||||
author: Relation<User>;
|
||||
|
||||
/** channel: The channel which is presenting this Post */
|
||||
channel: Relation<Channel>;
|
||||
}
|
||||
30
types/database/models/servers/post_metadata.d.ts
vendored
Normal file
30
types/database/models/servers/post_metadata.d.ts
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import Post from './post';
|
||||
|
||||
/**
|
||||
* PostMetadata provides additional information on a POST
|
||||
*/
|
||||
export default class PostMetadata extends Model {
|
||||
/** table (name) : PostMetadata */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** post_id : The foreign key of the parent POST model */
|
||||
postId: string;
|
||||
|
||||
/** type : The type will work in tandem with the value present in the field 'data'. One 'type' for each kind of 'data' */
|
||||
type: string;
|
||||
|
||||
/** data : Different types of data ranging from arrays, emojis, files to images and reactions. */
|
||||
data: PostMetadataTypes;
|
||||
|
||||
/** post: The record representing the POST parent. */
|
||||
post: Relation<Post>;
|
||||
}
|
||||
31
types/database/models/servers/posts_in_channel.d.ts
vendored
Normal file
31
types/database/models/servers/posts_in_channel.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import Channel from './channel';
|
||||
|
||||
/**
|
||||
* PostsInChannel model helps us to combine adjacent posts together without leaving
|
||||
* gaps in between for an efficient user reading experience of posts.
|
||||
*/
|
||||
export default class PostsInChannel extends Model {
|
||||
/** table (name) : PostsInChannel */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** channel_id : The foreign key of the related parent channel */
|
||||
channelId: string;
|
||||
|
||||
/** earliest : The earliest timestamp of the post in that channel */
|
||||
earliest: number;
|
||||
|
||||
/** latest : The latest timestamp of the post in that channel */
|
||||
latest: number;
|
||||
|
||||
/** channel : The parent record of the channel for those posts */
|
||||
channel: Relation<Channel>;
|
||||
}
|
||||
31
types/database/models/servers/posts_in_thread.d.ts
vendored
Normal file
31
types/database/models/servers/posts_in_thread.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import Post from './post';
|
||||
|
||||
/**
|
||||
* 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 (name) : PostsInThread */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** earliest : Lower bound of a timestamp range */
|
||||
earliest: number;
|
||||
|
||||
/** latest : Upper bound of a timestamp range */
|
||||
latest: number;
|
||||
|
||||
/** post_id : The foreign key of the related Post model */
|
||||
postId: string;
|
||||
|
||||
/** post : The related record to the parent Post model */
|
||||
post: Relation<Post>;
|
||||
}
|
||||
34
types/database/models/servers/preference.d.ts
vendored
Normal file
34
types/database/models/servers/preference.d.ts
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import User from './user';
|
||||
|
||||
/**
|
||||
* The Preference model hold information about the user's preference in the app.
|
||||
* This includes settings about the account, the themes, etc.
|
||||
*/
|
||||
export default class Preference extends Model {
|
||||
/** table (name) : Preference */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** category : The preference category ( e.g. Themes, Account settings etc..) */
|
||||
category: string;
|
||||
|
||||
/** name : The category name */
|
||||
name: string;
|
||||
|
||||
/** user_id : The foreign key of the user's record in this model */
|
||||
userId: string;
|
||||
|
||||
/** value : The preference's value */
|
||||
value: string;
|
||||
|
||||
/** user : The related record to the parent User model */
|
||||
user: Relation<User>;
|
||||
}
|
||||
37
types/database/models/servers/reaction.d.ts
vendored
Normal file
37
types/database/models/servers/reaction.d.ts
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import User from './user';
|
||||
import Post from './post';
|
||||
|
||||
/**
|
||||
* The Reaction Model is used to present the reactions a user had on a particular post
|
||||
*/
|
||||
export default class Reaction extends Model {
|
||||
/** table (name) : Reaction */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** create_at : Creation timestamp used for sorting reactions amongst users on a particular post */
|
||||
createAt: number;
|
||||
|
||||
/** emoji_name : The emoticon used to express the reaction */
|
||||
emojiName: string;
|
||||
|
||||
/** post_id : The related Post's foreign key on which this reaction was expressed */
|
||||
postId: string;
|
||||
|
||||
/** user_id : The related User's foreign key by which this reaction was expressed */
|
||||
userId: string;
|
||||
|
||||
/** user : The related record to the User model */
|
||||
user: Relation<User>;
|
||||
|
||||
/** post : The related record to the Post model */
|
||||
post: Relation<Post>;
|
||||
}
|
||||
16
types/database/models/servers/role.d.ts
vendored
Normal file
16
types/database/models/servers/role.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Model} from '@nozbe/watermelondb';
|
||||
|
||||
/** The Role model will describe the set of permissions for each role */
|
||||
export default class Role extends Model {
|
||||
/** table (name) : Role */
|
||||
static table: string;
|
||||
|
||||
/** name : The role's name */
|
||||
name: string;
|
||||
|
||||
/** permissions : The different permissions associated to that role */
|
||||
permissions: string[];
|
||||
}
|
||||
48
types/database/models/servers/slash_command.d.ts
vendored
Normal file
48
types/database/models/servers/slash_command.d.ts
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import Team from './team';
|
||||
|
||||
/**
|
||||
* The SlashCommand model describes the commands of the various commands available in each team.
|
||||
*/
|
||||
export default class SlashCommand extends Model {
|
||||
/** table (name) : SlashCommand */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** is_auto_complete : Boolean flag for auto-completing slash commands */
|
||||
isAutoComplete: boolean;
|
||||
|
||||
/** description : The description for the slash command */
|
||||
description: string;
|
||||
|
||||
/** display_name : The name for the command */
|
||||
displayName: string;
|
||||
|
||||
/** hint : A helpful text explaining the purpose of the command */
|
||||
hint: string;
|
||||
|
||||
/** method : API methods like HTTP */
|
||||
method: string;
|
||||
|
||||
/** team_id : The foreign key of the parent Team */
|
||||
teamId: string;
|
||||
|
||||
/** token : A key identifying this slash command */
|
||||
token: string;
|
||||
|
||||
/** trigger : A pattern/text used to recognize when a slash command needs to launch */
|
||||
trigger: string;
|
||||
|
||||
/** update_at : The timestamp to when this command was last updated on the server */
|
||||
updateAt!: number;
|
||||
|
||||
/** team : The related parent TEAM record */
|
||||
team: Relation<Team>;
|
||||
}
|
||||
20
types/database/models/servers/system.d.ts
vendored
Normal file
20
types/database/models/servers/system.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Model} from '@nozbe/watermelondb';
|
||||
|
||||
/**
|
||||
* The System model is another set of key-value pair combination but this one
|
||||
* will mostly hold configuration information about the client, the licences and some
|
||||
* custom data (e.g. recent emoji used)
|
||||
*/
|
||||
export default class System extends Model {
|
||||
/** table (name) : System */
|
||||
static table: string;
|
||||
|
||||
/** name : The name or key value for the config */
|
||||
name: string;
|
||||
|
||||
/** value : The value for that config/information */
|
||||
value: any;
|
||||
}
|
||||
72
types/database/models/servers/team.d.ts
vendored
Normal file
72
types/database/models/servers/team.d.ts
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Query} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import Channel from './channel';
|
||||
import GroupsInTeam from './groups_in_team';
|
||||
import MyTeam from './my_team';
|
||||
import SlashCommand from './slash_command';
|
||||
import TeamChannelHistory from './team_channel_history';
|
||||
import TeamMembership from './team_membership';
|
||||
import TeamSearchHistory from './team_search_history';
|
||||
|
||||
/**
|
||||
* A Team houses and enables communication to happen across channels and users.
|
||||
*/
|
||||
export default class Team extends Model {
|
||||
/** table (name) : Team */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** is_allow_open_invite : Boolean flag indicating if this team is open to the public */
|
||||
isAllowOpenInvite: boolean;
|
||||
|
||||
/** description : The description for the team */
|
||||
description: string;
|
||||
|
||||
/** display_name : The display name for the team */
|
||||
displayName: string;
|
||||
|
||||
/** update_at : The timestamp to when this team was last updated on the server */
|
||||
updateAt!: number;
|
||||
|
||||
/** is_group_constrained : Boolean flag indicating if members are managed groups */
|
||||
isGroupConstrained: boolean;
|
||||
|
||||
/** last_team_icon_updated_at : Timestamp for when this team's icon has been updated last */
|
||||
lastTeamIconUpdatedAt: number;
|
||||
|
||||
/** name : The name for the team */
|
||||
name: string;
|
||||
|
||||
/** type : The type of team ( e.g. open/private ) */
|
||||
type: string;
|
||||
|
||||
/** allowed_domains : List of domains that can join this team */
|
||||
allowedDomains: string;
|
||||
|
||||
/** channels : All the channels associated with this team */
|
||||
channels: Channel[];
|
||||
|
||||
/** groupsInTeam : All the groups associated with this team */
|
||||
groupsInTeam: GroupsInTeam[];
|
||||
|
||||
/** myTeam : Retrieves additional information about the team that this user is possibly part of. This query might yield no result if the user isn't part of a team. */
|
||||
myTeam: Query<MyTeam>;
|
||||
|
||||
/** slashCommands : All the slash commands associated with this team */
|
||||
slashCommands: SlashCommand[];
|
||||
|
||||
/** teamChannelHistory : A history of the channels in this team that has been visited, ordered by the most recent and capped to the last 5 */
|
||||
teamChannelHistory: Query<TeamChannelHistory>;
|
||||
|
||||
/** members : All the users associated with this team */
|
||||
members: TeamMembership[];
|
||||
|
||||
/** teamSearchHistories : All the searches performed on this team */
|
||||
teamSearchHistories: TeamSearchHistory[];
|
||||
}
|
||||
28
types/database/models/servers/team_channel_history.d.ts
vendored
Normal file
28
types/database/models/servers/team_channel_history.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import Team from './team';
|
||||
|
||||
/**
|
||||
* The TeamChannelHistory model helps keeping track of the last channel visited
|
||||
* by the user.
|
||||
*/
|
||||
export default class TeamChannelHistory extends Model {
|
||||
/** table (name) : TeamChannelHistory */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** team_id : The foreign key to the related Team record */
|
||||
teamId: string;
|
||||
|
||||
/** channel_ids : An array containing the last 5 channels visited within this team order by recency */
|
||||
channelIds: string[];
|
||||
|
||||
/** team : The related record from the parent Team model */
|
||||
team: Relation<Team>;
|
||||
}
|
||||
42
types/database/models/servers/team_membership.d.ts
vendored
Normal file
42
types/database/models/servers/team_membership.d.ts
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
// 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 User from './user';
|
||||
import Team from './team';
|
||||
|
||||
/**
|
||||
* The TeamMembership model represents the 'association table' where many teams have users and many users are in
|
||||
* teams (relationship type N:N)
|
||||
*/
|
||||
export default class TeamMembership extends Model {
|
||||
/** table (name) : TeamMembership */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** team_id : The foreign key to the related Team record */
|
||||
teamId: string;
|
||||
|
||||
/* user_id: The foreign key to the related User record*/
|
||||
userId: string;
|
||||
|
||||
/** memberUser: The related user in the team */
|
||||
memberUser: Relation<User>;
|
||||
|
||||
/** memberTeam : The related team of users */
|
||||
memberTeam: Relation<Team>;
|
||||
|
||||
/**
|
||||
* getAllTeamsForUser - Retrieves all the teams that the user is part of
|
||||
*/
|
||||
getAllTeamsForUser: Query<Team>;
|
||||
|
||||
/**
|
||||
* getAllUsersInTeam - Retrieves all the users who are part of this team
|
||||
*/
|
||||
getAllUsersInTeam: Query<User>;
|
||||
}
|
||||
34
types/database/models/servers/team_search_history.d.ts
vendored
Normal file
34
types/database/models/servers/team_search_history.d.ts
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Relation} from '@nozbe/watermelondb';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
|
||||
import Team from './team';
|
||||
|
||||
/**
|
||||
* The TeamSearchHistory model holds the term searched within a team. The searches are performed
|
||||
* at team level in the app.
|
||||
*/
|
||||
export default class TeamSearchHistory extends Model {
|
||||
/** table (name) : TeamSearchHistory */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** created_at : The timestamp at which this search was performed */
|
||||
createdAt: number;
|
||||
|
||||
/** team_id : The foreign key to the parent Team model */
|
||||
teamId: string;
|
||||
|
||||
/** display_term : The term that we display to the user */
|
||||
displayTerm: string;
|
||||
|
||||
/** term : The term that is sent to the server to perform the search */
|
||||
term: string;
|
||||
|
||||
/** team : The related record to the parent team model */
|
||||
team: Relation<Team>;
|
||||
}
|
||||
15
types/database/models/servers/terms_of_service.d.ts
vendored
Normal file
15
types/database/models/servers/terms_of_service.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Model} from '@nozbe/watermelondb';
|
||||
|
||||
/**
|
||||
* The model for Terms of Service
|
||||
*/
|
||||
export default class TermsOfService extends Model {
|
||||
/** table (name) : TermsOfService */
|
||||
static table: string;
|
||||
|
||||
/** accepted_at : the date the term has been accepted */
|
||||
acceptedAt: number;
|
||||
}
|
||||
101
types/database/models/servers/user.d.ts
vendored
Normal file
101
types/database/models/servers/user.d.ts
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
// 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 './channel';
|
||||
import ChannelMembership from './channel_membership';
|
||||
import GroupMembership from './group_membership';
|
||||
import Post from './post';
|
||||
import Preference from './preference';
|
||||
import Reaction from './reaction';
|
||||
import TeamMembership from './team_membership';
|
||||
|
||||
/**
|
||||
* The User model represents the 'USER' table and its relationship to other
|
||||
* shareholders in the app.
|
||||
*/
|
||||
export default class User extends Model {
|
||||
/** table (name) : User */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** auth_service : The type of authentication service registered to that user */
|
||||
authService: string;
|
||||
|
||||
/** update_at : The timestamp at which this user account has been updated */
|
||||
updateAt!: number;
|
||||
|
||||
/** 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: NotifyProps;
|
||||
|
||||
/** 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: UserProps;
|
||||
|
||||
/** timezone : The timezone for this user */
|
||||
timezone: Timezone;
|
||||
|
||||
/** 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[];
|
||||
}
|
||||
Reference in New Issue
Block a user