Gekidou teamsidebar (#5718)

This commit is contained in:
Daniel Espino García
2021-10-15 09:55:02 +02:00
committed by GitHub
parent 46470e0b5d
commit e6f9b0e258
34 changed files with 2214 additions and 62 deletions

View File

@@ -57,8 +57,8 @@ export default class ChannelModel extends Model {
/** A CHANNEL can contain multiple POST (relationship is 1:N) */
[POST]: {type: 'has_many', foreignKey: 'channel_id'},
/** A CHANNEL can contain multiple POST (relationship is 1:N) */
[MY_CHANNEL]: {type: 'has_many', foreignKey: 'channel_id'},
/** A CHANNEL can be associated to one MY_CHANNEL (relationship is 1:1) */
[MY_CHANNEL]: {type: 'has_many', foreignKey: 'id'},
/** A TEAM can be associated to CHANNEL (relationship is 1:N) */
[TEAM]: {type: 'belongs_to', key: 'team_id'},

View File

@@ -3,7 +3,7 @@
import {Relation} from '@nozbe/watermelondb';
import {field, relation} from '@nozbe/watermelondb/decorators';
import Model from '@nozbe/watermelondb/Model';
import Model, {Associations} from '@nozbe/watermelondb/Model';
import {MM_TABLES} from '@constants/database';
@@ -18,6 +18,10 @@ export default class MyTeamModel extends Model {
/** table (name) : MyTeam */
static table = MY_TEAM;
static associations: Associations = {
[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;

View File

@@ -42,6 +42,9 @@ export default class TeamModel extends Model {
/** A TEAM has a 1:N relationship with GROUPS_TEAM. A TEAM can possess multiple groups */
[GROUPS_TEAM]: {type: 'has_many', foreignKey: 'team_id'},
/** 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'},