forked from Ivasoft/mattermost-mobile
[Gekidou] Sidebar Categories (Database only) (#5909)
This commit is contained in:
57
types/database/models/servers/category.d.ts
vendored
Normal file
57
types/database/models/servers/category.d.ts
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {Query, Relation} from '@nozbe/watermelondb';
|
||||
import {lazy} from '@nozbe/watermelondb/decorators';
|
||||
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
||||
import {Observable} from 'rxjs';
|
||||
|
||||
/**
|
||||
* A Category groups together channels for a user in a team.
|
||||
*/
|
||||
export default class CategoryModel extends Model {
|
||||
/** table (name) : Category */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** display_name : The display name for the category */
|
||||
displayName: string;
|
||||
|
||||
/** type : The type of category */
|
||||
type: string;
|
||||
|
||||
/** sort_order : The sort order for this category */
|
||||
sortOrder: number;
|
||||
|
||||
/** sorting : One of manual, alphabetical, or recent. */
|
||||
sorting: CategorySorting;
|
||||
|
||||
/** muted : If the category is muted */
|
||||
muted: boolean;
|
||||
|
||||
/** collapsed : If the category is collapsed (visible channels) */
|
||||
collapsed: boolean;
|
||||
|
||||
/** team_id : The team in which this category resides */
|
||||
teamId: string;
|
||||
|
||||
/** team : The team in which this category resides */
|
||||
team: Relation<TeamModel>;
|
||||
|
||||
/** categoryChannels : The join table for channels */
|
||||
categoryChannels: Query<CategoryChannelModel>;
|
||||
|
||||
/** categoryChannelsBySortOrder : The sorted join table for channels */
|
||||
@lazy categoryChannelsBySortOrder: Query<CategoryChannelModel>;
|
||||
|
||||
/** channels : All the channels associated with this category */
|
||||
@lazy channels: Query<ChannelModel>;
|
||||
|
||||
/** myChannels : All the myChannels associated with this category */
|
||||
@lazy myChannels: Query<MyChannelModel>;
|
||||
|
||||
/** hasChannels : Whether the category has any channels */
|
||||
@lazy hasChannels: Observable<boolean>;
|
||||
}
|
||||
35
types/database/models/servers/category_channel.d.ts
vendored
Normal file
35
types/database/models/servers/category_channel.d.ts
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
// 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';
|
||||
|
||||
/**
|
||||
* The CategoryChannel model represents the 'association table' where many categories have channels and many channels are in
|
||||
* categories (relationship type N:N)
|
||||
*/
|
||||
export default class CategoryChannelModel extends Model {
|
||||
/** table (name) : CategoryChannel */
|
||||
static table: string;
|
||||
|
||||
/** associations : Describes every relationship to this table. */
|
||||
static associations: Associations;
|
||||
|
||||
/** category_id : The foreign key to the related Category record */
|
||||
categoryId: string;
|
||||
|
||||
/* channel_id : The foreign key to the related User record*/
|
||||
channelId: string;
|
||||
|
||||
/* sort_order : The order in which the channel displays in the category, if the order is manually set */
|
||||
sortOrder: number;
|
||||
|
||||
/** category : The related category */
|
||||
category: Relation<CategoryModel>;
|
||||
|
||||
/** channel : The related channel */
|
||||
channel: Relation<ChannelModel>;
|
||||
|
||||
/** myChannel : The related myChannel */
|
||||
myChannel: Relation<MyChannelModel>;
|
||||
}
|
||||
Reference in New Issue
Block a user