Files
mattermost-mobile/app/database/server/models/slash_command.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

54 lines
1.9 KiB
TypeScript

// 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 {field, immutableRelation} from '@nozbe/watermelondb/decorators';
import {MM_TABLES} from '@constants/database';
import Team from '@typings/database/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 SlashCommand extends Model {
/** table (entity name) : SlashCommand */
static table = SLASH_COMMAND;
/** associations : Describes every relationship to this entity. */
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;
/** team : The related parent TEAM record */
@immutableRelation(TEAM, 'team_id') team!: Relation<Team>;
}