forked from Ivasoft/mattermost-mobile
* started with the diagrams
* removed redundant tables
next step:
1. reconstruct id ( local id vs server id )
2. annotate fields with examples
3. recreate relationship
* work in progress
* work in progress
* fix association
* update postsInChannel
* removed SlashCommands from the Server database schema
* added missing associations in the models and updated docs/database
* exported server database
* update test
* code corrections following review
* update relationship
* update docs
* removed cyclic relationship
* Revert "removed cyclic relationship"
This reverts commit 4d784efb81.
* removed isOptional from Draft
* linked myChannelSettings to myChannel instead of Channel
* update diagrams
* store null instead of empty string
* update thread association
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {Relation} from '@nozbe/watermelondb';
|
|
import {field, relation} from '@nozbe/watermelondb/decorators';
|
|
import Model, {Associations} from '@nozbe/watermelondb/Model';
|
|
|
|
import {MM_TABLES} from '@constants/database';
|
|
|
|
import type MyTeamModelInterface from '@typings/database/models/servers/my_team';
|
|
import type TeamModel from '@typings/database/models/servers/team';
|
|
|
|
const {TEAM, MY_TEAM} = MM_TABLES.SERVER;
|
|
|
|
/**
|
|
* MyTeam represents only the teams that the current user belongs to
|
|
*/
|
|
export default class MyTeamModel extends Model implements MyTeamModelInterface {
|
|
/** table (name) : MyTeam */
|
|
static table = MY_TEAM;
|
|
|
|
static associations: Associations = {
|
|
|
|
/** A TEAM is associated to one MY_TEAM (relationship is 1:1) */
|
|
[TEAM]: {type: 'belongs_to', key: 'id'},
|
|
};
|
|
|
|
/** roles : The different permissions that this user has in the team, concatenated together with comma to form a single string. */
|
|
@field('roles') roles!: string;
|
|
|
|
/** team : The relation to the TEAM, that this user belongs to */
|
|
@relation(TEAM, 'id') team!: Relation<TeamModel>;
|
|
}
|