forked from Ivasoft/mattermost-mobile
removed SlashCommands from the Server database schema (#6116)
This commit is contained in:
@@ -18,7 +18,6 @@ export {default as PostsInThreadModel} from './posts_in_thread';
|
||||
export {default as PreferenceModel} from './preference';
|
||||
export {default as ReactionModel} from './reaction';
|
||||
export {default as RoleModel} from './role';
|
||||
export {default as SlashCommandModel} from './slash_command';
|
||||
export {default as SystemModel} from './system';
|
||||
export {default as TeamChannelHistoryModel} from './team_channel_history';
|
||||
export {default as TeamMembershipModel} from './team_membership';
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
// 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 type SlashCommandModelInterface from '@typings/database/models/servers/slash_command';
|
||||
import type TeamModel from '@typings/database/models/servers/team';
|
||||
|
||||
const {SLASH_COMMAND, TEAM} = MM_TABLES.SERVER;
|
||||
|
||||
/**
|
||||
* The SlashCommand model describes the commands of the various commands available in each team.
|
||||
*/
|
||||
export default class SlashCommandModel extends Model implements SlashCommandModelInterface {
|
||||
/** table (name) : SlashCommand */
|
||||
static table = SLASH_COMMAND;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations = {
|
||||
|
||||
/** A TEAM can have multiple slash commands. (relationship is 1:N) */
|
||||
[TEAM]: {type: 'belongs_to', key: 'team_id'},
|
||||
};
|
||||
|
||||
/** is_auto_complete : Boolean flag for auto-completing slash commands */
|
||||
@field('is_auto_complete') isAutoComplete!: boolean;
|
||||
|
||||
/** description : The description for the slash command */
|
||||
@field('description') description!: string;
|
||||
|
||||
/** display_name : The name for the command */
|
||||
@field('display_name') displayName!: string;
|
||||
|
||||
/** hint : A helpful text explaining the purpose of the command */
|
||||
@field('hint') hint!: string;
|
||||
|
||||
/** method : HTTP API methods like get, put, post, patch, etc. */
|
||||
@field('method') method!: string;
|
||||
|
||||
/** team_id : The foreign key of the parent Team */
|
||||
@field('team_id') teamId!: string;
|
||||
|
||||
/** token : A key identifying this slash command */
|
||||
@field('token') token!: string;
|
||||
|
||||
/** trigger : A pattern/text used to recognize when a slash command needs to launch */
|
||||
@field('trigger') trigger!: string;
|
||||
|
||||
/** update_at : The timestamp to when this command was last updated on the server */
|
||||
@field('update_at') updateAt!: number;
|
||||
|
||||
/** team : The related parent TEAM record */
|
||||
@immutableRelation(TEAM, 'team_id') team!: Relation<TeamModel>;
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import {MM_TABLES} from '@constants/database';
|
||||
import type CategoryModel from '@typings/database/models/servers/category';
|
||||
import type ChannelModel from '@typings/database/models/servers/channel';
|
||||
import type MyTeamModel from '@typings/database/models/servers/my_team';
|
||||
import type SlashCommandModel from '@typings/database/models/servers/slash_command';
|
||||
import type TeamModelInterface from '@typings/database/models/servers/team';
|
||||
import type TeamChannelHistoryModel from '@typings/database/models/servers/team_channel_history';
|
||||
import type TeamMembershipModel from '@typings/database/models/servers/team_membership';
|
||||
@@ -22,7 +21,6 @@ const {
|
||||
CHANNEL,
|
||||
TEAM,
|
||||
MY_TEAM,
|
||||
SLASH_COMMAND,
|
||||
TEAM_CHANNEL_HISTORY,
|
||||
TEAM_MEMBERSHIP,
|
||||
TEAM_SEARCH_HISTORY,
|
||||
@@ -49,9 +47,6 @@ export default class TeamModel extends Model implements TeamModelInterface {
|
||||
/** A TEAM can be associated to one MY_TEAM (relationship is 1:1) */
|
||||
[MY_TEAM]: {type: 'has_many', foreignKey: 'id'},
|
||||
|
||||
/** A TEAM has a 1:N relationship with SLASH_COMMAND. A TEAM can possess multiple slash commands */
|
||||
[SLASH_COMMAND]: {type: 'has_many', foreignKey: 'team_id'},
|
||||
|
||||
/** A TEAM has a 1:N relationship with TEAM_MEMBERSHIP. A TEAM can regroup multiple users */
|
||||
[TEAM_MEMBERSHIP]: {type: 'has_many', foreignKey: 'team_id'},
|
||||
|
||||
@@ -98,9 +93,6 @@ export default class TeamModel extends Model implements TeamModelInterface {
|
||||
/** myTeam : Retrieves additional information about the team that this user is possibly part of. */
|
||||
@immutableRelation(MY_TEAM, 'id') myTeam!: Relation<MyTeamModel>;
|
||||
|
||||
/** slashCommands : All the slash commands associated with this team */
|
||||
@children(SLASH_COMMAND) slashCommands!: Query<SlashCommandModel>;
|
||||
|
||||
/** teamChannelHistory : A history of the channels in this team that has been visited, ordered by the most recent and capped to the last 5 */
|
||||
@immutableRelation(TEAM_CHANNEL_HISTORY, 'id') teamChannelHistory!: Relation<TeamChannelHistoryModel>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user