Files
mattermost-mobile/app/database/models/server/team_search_history.ts
Elias Nahum 8cd127a223 [Gekidou] Typings & PostMetadata structure (#5542)
* Typings & PostMetadata structure

* comment out unused code

* Remove duplicate interface

* Fix getPreferenceAsBool defaultValue
2021-07-15 11:49:02 -04:00

44 lines
1.5 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {Relation} from '@nozbe/watermelondb';
import {field, immutableRelation, text} from '@nozbe/watermelondb/decorators';
import Model, {Associations} from '@nozbe/watermelondb/Model';
import {MM_TABLES} from '@constants/database';
import type TeamModel from '@typings/database/models/servers/team';
const {TEAM, TEAM_SEARCH_HISTORY} = MM_TABLES.SERVER;
/**
* The TeamSearchHistory model holds the term searched within a team. The searches are performed
* at team level in the app.
*/
export default class TeamSearchHistoryModel extends Model {
/** table (name) : TeamSearchHistory */
static table = TEAM_SEARCH_HISTORY;
/** associations : Describes every relationship to this table. */
static associations: Associations = {
/** A TEAM can have multiple search terms */
[TEAM]: {type: 'belongs_to', key: 'team_id'},
};
/** created_at : The timestamp at which this search was performed */
@field('created_at') createdAt!: number;
/** team_id : The foreign key to the parent Team model */
@field('team_id') teamId!: string;
/** display_term : The term that we display to the user */
@field('display_term') displayTerm!: string;
/** term : The term that is sent to the server to perform the search */
@text('term') term!: string;
/** team : The related record to the parent team model */
@immutableRelation(TEAM, 'team_id') team!: Relation<TeamModel>;
}