diff --git a/app/database/server/models/channel_membership.ts b/app/database/server/models/channel_membership.ts index d4c46f983..2bb43779e 100644 --- a/app/database/server/models/channel_membership.ts +++ b/app/database/server/models/channel_membership.ts @@ -36,10 +36,10 @@ export default class ChannelMembership extends Model { @field('user_id') userId!: string; /** memberChannel : The related channel this member belongs to */ - @immutableRelation(CHANNEL, 'channel_id') channel!: Relation; + @immutableRelation(CHANNEL, 'channel_id') memberChannel!: Relation; /** memberUser : The related member belonging to the channel */ - @immutableRelation(USER, 'user_id') user!: Relation; + @immutableRelation(USER, 'user_id') memberUser!: Relation; /** * getAllChannelsForUser - Retrieves all the channels that the user is part of diff --git a/app/database/server/models/group.ts b/app/database/server/models/group.ts new file mode 100644 index 000000000..5a2720587 --- /dev/null +++ b/app/database/server/models/group.ts @@ -0,0 +1,50 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import Model, {Associations} from '@nozbe/watermelondb/Model'; +import {children, field} from '@nozbe/watermelondb/decorators'; + +import {MM_TABLES} from '@constants/database'; +import GroupMembership from '@typings/database/group_membership'; +import GroupsInChannel from '@typings/database/groups_in_channel'; +import GroupsInTeam from '@typings/database/groups_in_team'; + +const {GROUP, GROUPS_IN_CHANNEL, GROUPS_IN_TEAM, GROUP_MEMBERSHIP} = MM_TABLES.SERVER; + +/** + * The Group model unifies/assembles users, teams and channels based on a common ground. For example, a group can be + * all users who are in the mobile team. If one needs to send that group a message, then s/he can mention the group's + * name in the message. (e.g @mobile_team) + */ +export default class Group extends Model { + /** table (entity name) : Group */ + static table = GROUP; + + /** associations : Describes every relationship to this entity. */ + static associations: Associations = { + + /** A GROUP has a 1:N relationship with GROUPS_IN_CHANNEL */ + [GROUPS_IN_CHANNEL]: {type: 'has_many', foreignKey: 'group_id'}, + + /** A GROUP has a 1:N relationship with GROUPS_IN_TEAM */ + [GROUPS_IN_TEAM]: {type: 'has_many', foreignKey: 'group_id'}, + + /** A GROUP has a 1:N relationship with GROUP_MEMBERSHIP */ + [GROUP_MEMBERSHIP]: {type: 'has_many', foreignKey: 'group_id'}, + }; + + /** display_name : The display name for the group */ + @field('display_name') displayName!: string; + + /** name : The name of the group */ + @field('name') name!: string; + + /** groupsInChannel : All the related children records from GroupsInChannel */ + @children(GROUPS_IN_CHANNEL) groupsInChannel!: GroupsInChannel[]; + + /** groupsInTeam : All the related children records from GroupsInTeam */ + @children(GROUPS_IN_TEAM) groupsInTeam!: GroupsInTeam[]; + + /** groupMemberships : All the related children records from GroupMembership */ + @children(GROUP_MEMBERSHIP) groupMemberships!: GroupMembership[]; +} diff --git a/app/database/server/models/group_membership.ts b/app/database/server/models/group_membership.ts new file mode 100644 index 000000000..2f93020ad --- /dev/null +++ b/app/database/server/models/group_membership.ts @@ -0,0 +1,53 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {Q, Query, Relation} from '@nozbe/watermelondb'; +import Model, {Associations} from '@nozbe/watermelondb/Model'; +import {field, immutableRelation, lazy} from '@nozbe/watermelondb/decorators'; + +import {MM_TABLES} from '@constants/database'; +import Group from '@typings/database/group'; +import User from '@typings/database/user'; + +const {GROUP, GROUP_MEMBERSHIP, USER} = MM_TABLES.SERVER; + +/** + * The GroupMembership model represents the 'association table' where many groups have users and many users are in + * groups (relationship type N:N) + */ +export default class GroupMembership extends Model { + /** table (entity name) : GroupMembership */ + static table = GROUP_MEMBERSHIP; + + /** associations : Describes every relationship to this entity */ + static associations: Associations = { + + /** A GROUP can have multiple users in it */ + [GROUP]: {type: 'belongs_to', key: 'group_id'}, + + /** A USER can be part of multiple groups */ + [USER]: {type: 'belongs_to', key: 'user_id'}, + }; + + /* group_id: The foreign key to the related Group record*/ + @field('group_id') groupId!: string; + + /* user_id: The foreign key to the related User record*/ + @field('user_id') userId!: string; + + /** memberGroup : The related group this user belongs to */ + @immutableRelation(GROUP, 'group_id') memberGroup!: Relation; + + /** memberUser : The related user in the group */ + @immutableRelation(USER, 'user_id') memberUser!: Relation; + + /** + * getAllGroupsForUser : Retrieves all the groups that the user is part of + */ + @lazy getAllGroupsForUser = this.collections.get(GROUP).query(Q.on(USER, 'id', this.userId)) as Query + + /** + * getAllUsersInGroup : Retrieves all the users who are part of this group + */ + @lazy getAllUsersInGroup = this.collections.get(USER).query(Q.on(GROUP, 'id', this.groupId)) as Query +} diff --git a/app/database/server/models/groups_in_channel.ts b/app/database/server/models/groups_in_channel.ts new file mode 100644 index 000000000..1843a5563 --- /dev/null +++ b/app/database/server/models/groups_in_channel.ts @@ -0,0 +1,48 @@ +// 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 Channel from '@typings/database/channel'; +import Group from '@typings/database/group'; + +const {GROUP, GROUPS_IN_CHANNEL, CHANNEL} = MM_TABLES.SERVER; + +/** + * The GroupsInChannel links the Channel model with the Group model + */ +export default class GroupsInChannel extends Model { + /** table (entity name) : GroupsInChannel */ + static table = GROUPS_IN_CHANNEL; + + /** associations : Describes every relationship to this entity. */ + static associations: Associations = { + + /** A GROUP can be associated with multiple GROUPS_IN_CHANNEL (relationship is 1:N) */ + [GROUP]: {type: 'belongs_to', key: 'group_id'}, + + /** A CHANNEL can be associated with multiple GROUPS_IN_CHANNEL (relationship is 1:N) */ + [CHANNEL]: {type: 'belongs_to', key: 'channel_id'}, + }; + + /** channel_id : The foreign key of the related CHANNEL model */ + @field('channel_id') channelId!: string; + + /** group_id : The foreign key of the related GROUP model */ + @field('group_id') groupId!: string; + + /** member_count : The number of members in that group */ + @field('member_count') memberCount!: number; + + /** timezone_count : The number of timezones in that group */ + @field('timezone_count') timezoneCount!: number; + + /** channel : The related record to the parent Channel model */ + @immutableRelation(CHANNEL, 'channel_id') channel!: Relation; + + /** group : The related record to the parent Group model */ + @immutableRelation(GROUP, 'group_id') group!: Relation; +} diff --git a/app/database/server/models/groups_in_team.ts b/app/database/server/models/groups_in_team.ts new file mode 100644 index 000000000..4813b5e55 --- /dev/null +++ b/app/database/server/models/groups_in_team.ts @@ -0,0 +1,48 @@ +// 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 Group from '@typings/database/group'; +import Team from '@typings/database/team'; + +const {GROUP, GROUPS_IN_TEAM, TEAM} = MM_TABLES.SERVER; + +/** + * The GroupsInTeam links the Team model with the Group model + */ +export default class GroupsInTeam extends Model { + /** table (entity name) : GroupsInTeam */ + static table = GROUPS_IN_TEAM; + + /** associations : Describes every relationship to this entity. */ + static associations: Associations = { + + /** GroupsInTeam can belong to only one Group */ + [GROUP]: {type: 'belongs_to', key: 'group_id'}, + + /** GroupsInTeam can belong to only one Team */ + [TEAM]: {type: 'belongs_to', key: 'team_id'}, + }; + + /** group_id : The foreign key to the related Group record */ + @field('group_id') groupId!: string; + + /** member_count : The number of users in that group */ + @field('member_count') memberCount!: number; + + /** team_id : The foreign key to the related Team record */ + @field('team_id') teamId!: string; + + /** timezone_count : The number of timezones */ + @field('timezone_count') timezoneCount!: number; + + /** team : The related record to the parent Team model */ + @immutableRelation(TEAM, 'team_id') team!: Relation; + + /** group : The related record to the parent Team model */ + @immutableRelation(GROUP, 'group_id') group!: Relation; +} diff --git a/app/database/server/models/index.ts b/app/database/server/models/index.ts index 81b16b093..1e6267b70 100644 --- a/app/database/server/models/index.ts +++ b/app/database/server/models/index.ts @@ -3,6 +3,10 @@ export {default as ChannelMembership} from './channel_membership'; export {default as CustomEmoji} from './custom_emoji'; +export {default as GroupMembership} from './group_membership'; +export {default as GroupsInChannel} from './groups_in_channel'; +export {default as GroupsInTeam} from './groups_in_team'; +export {default as Group} from './group'; export {default as MyTeam} from './my_team'; export {default as Preference} from './preference'; export {default as Reaction} from './reaction'; diff --git a/app/database/server/models/my_team.ts b/app/database/server/models/my_team.ts index 74e889c61..1cd13ddd0 100644 --- a/app/database/server/models/my_team.ts +++ b/app/database/server/models/my_team.ts @@ -36,6 +36,6 @@ export default class MyTeam extends Model { /** team_id : The foreign key of the 'parent' Team entity */ @field('team_id') teamId!: string; - /** teams : The relation to the entity TEAM, that this user belongs to */ + /** team : The relation to the entity TEAM, that this user belongs to */ @relation(MY_TEAM, 'team_id') team!: Relation } diff --git a/app/database/server/models/reaction.ts b/app/database/server/models/reaction.ts index 463631618..2ac9dcc6d 100644 --- a/app/database/server/models/reaction.ts +++ b/app/database/server/models/reaction.ts @@ -40,9 +40,9 @@ export default class Reaction extends Model { /** user_id : The related User's foreign key by which this reaction was expressed */ @field('user_id') userId!: string; - /** reactionUser : The related record to the User model */ + /** user : The related record to the User model */ @immutableRelation(USER, 'user_id') user!: Relation; - /** reactionPost : The related record to the Post model */ + /** post : The related record to the Post model */ @immutableRelation(POST, 'post_id') post!: Relation; } diff --git a/app/database/server/models/team_search_history.ts b/app/database/server/models/team_search_history.ts index 3ad29bf1f..b05053605 100644 --- a/app/database/server/models/team_search_history.ts +++ b/app/database/server/models/team_search_history.ts @@ -25,13 +25,13 @@ export default class TeamSearchHistory extends Model { [TEAM]: {type: 'belongs_to', key: 'team_id'}, }; - /** createdAt : The timestamp at which this search was performed */ + /** created_at : The timestamp at which this search was performed */ @field('created_at') createdAt!: number; - /** teamId : The foreign key to the parent Team model */ + /** team_id : The foreign key to the parent Team model */ @field('team_id') teamId!: string; - /** displayTerm : The term that we display to the user */ + /** 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 */ diff --git a/app/database/server/schema/index.ts b/app/database/server/schema/index.ts index 5bd59ca88..9abf36bf1 100644 --- a/app/database/server/schema/index.ts +++ b/app/database/server/schema/index.ts @@ -6,6 +6,10 @@ import {AppSchema, appSchema} from '@nozbe/watermelondb'; import { ChannelMembershipSchema, CustomEmojiSchema, + GroupMembershipSchema, + GroupSchema, + GroupsInChannelSchema, + GroupsInTeamSchema, MyTeamSchema, PreferenceSchema, ReactionSchema, @@ -25,6 +29,10 @@ export const serverSchema: AppSchema = appSchema({ tables: [ ChannelMembershipSchema, CustomEmojiSchema, + GroupMembershipSchema, + GroupSchema, + GroupsInChannelSchema, + GroupsInTeamSchema, MyTeamSchema, PreferenceSchema, ReactionSchema, diff --git a/app/database/server/schema/table_schemas/group.ts b/app/database/server/schema/table_schemas/group.ts new file mode 100644 index 000000000..371e6993c --- /dev/null +++ b/app/database/server/schema/table_schemas/group.ts @@ -0,0 +1,16 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {tableSchema} from '@nozbe/watermelondb'; + +import {MM_TABLES} from '@constants/database'; + +const {GROUP} = MM_TABLES.SERVER; + +export default tableSchema({ + name: GROUP, + columns: [ + {name: 'display_name', type: 'string'}, + {name: 'name', type: 'string'}, + ], +}); diff --git a/app/database/server/schema/table_schemas/group_membership.ts b/app/database/server/schema/table_schemas/group_membership.ts new file mode 100644 index 000000000..389d3ebbf --- /dev/null +++ b/app/database/server/schema/table_schemas/group_membership.ts @@ -0,0 +1,16 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {tableSchema} from '@nozbe/watermelondb'; + +import {MM_TABLES} from '@constants/database'; + +const {GROUP_MEMBERSHIP} = MM_TABLES.SERVER; + +export default tableSchema({ + name: GROUP_MEMBERSHIP, + columns: [ + {name: 'group_id', type: 'string', isIndexed: true}, + {name: 'user_id', type: 'string', isIndexed: true}, + ], +}); diff --git a/app/database/server/schema/table_schemas/groups_in_channel.ts b/app/database/server/schema/table_schemas/groups_in_channel.ts new file mode 100644 index 000000000..76bce5fcd --- /dev/null +++ b/app/database/server/schema/table_schemas/groups_in_channel.ts @@ -0,0 +1,18 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {tableSchema} from '@nozbe/watermelondb'; + +import {MM_TABLES} from '@constants/database'; + +const {GROUPS_IN_CHANNEL} = MM_TABLES.SERVER; + +export default tableSchema({ + name: GROUPS_IN_CHANNEL, + columns: [ + {name: 'channel_id', type: 'string', isIndexed: true}, + {name: 'group_id', type: 'string', isIndexed: true}, + {name: 'member_count', type: 'number'}, + {name: 'timezone_count', type: 'number'}, + ], +}); diff --git a/app/database/server/schema/table_schemas/groups_in_team.ts b/app/database/server/schema/table_schemas/groups_in_team.ts new file mode 100644 index 000000000..b25f57676 --- /dev/null +++ b/app/database/server/schema/table_schemas/groups_in_team.ts @@ -0,0 +1,18 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {tableSchema} from '@nozbe/watermelondb'; + +import {MM_TABLES} from '@constants/database'; + +const {GROUPS_IN_TEAM} = MM_TABLES.SERVER; + +export default tableSchema({ + name: GROUPS_IN_TEAM, + columns: [ + {name: 'group_id', type: 'string', isIndexed: true}, + {name: 'member_count', type: 'number'}, + {name: 'team_id', type: 'string', isIndexed: true}, + {name: 'timezone_count', type: 'number'}, + ], +}); diff --git a/app/database/server/schema/table_schemas/index.ts b/app/database/server/schema/table_schemas/index.ts index d0ea87395..3d5a61404 100644 --- a/app/database/server/schema/table_schemas/index.ts +++ b/app/database/server/schema/table_schemas/index.ts @@ -3,6 +3,10 @@ export {default as ChannelMembershipSchema} from './channel_membership'; export {default as CustomEmojiSchema} from './custom_emoji'; +export {default as GroupMembershipSchema} from './group_membership'; +export {default as GroupSchema} from './group'; +export {default as GroupsInChannelSchema} from './groups_in_channel'; +export {default as GroupsInTeamSchema} from './groups_in_team'; export {default as MyTeamSchema} from './my_team'; export {default as PreferenceSchema} from './preference'; export {default as ReactionSchema} from './reaction'; diff --git a/app/database/server/schema/test.ts b/app/database/server/schema/test.ts index c695c0571..746bd8635 100644 --- a/app/database/server/schema/test.ts +++ b/app/database/server/schema/test.ts @@ -8,6 +8,10 @@ import {serverSchema} from './index'; const { CHANNEL_MEMBERSHIP, CUSTOM_EMOJI, + GROUP, + GROUPS_IN_CHANNEL, + GROUPS_IN_TEAM, + GROUP_MEMBERSHIP, MY_TEAM, PREFERENCE, REACTION, @@ -47,6 +51,58 @@ describe('*** Test schema for SERVER database ***', () => { {name: 'name', type: 'string'}, ], }, + [GROUP]: { + name: GROUP, + columns: { + display_name: {name: 'display_name', type: 'string'}, + name: {name: 'name', type: 'string'}, + }, + columnArray: [ + {name: 'display_name', type: 'string'}, + {name: 'name', type: 'string'}, + ], + }, + [GROUPS_IN_CHANNEL]: { + name: GROUPS_IN_CHANNEL, + columns: { + channel_id: {name: 'channel_id', type: 'string', isIndexed: true}, + group_id: {name: 'group_id', type: 'string', isIndexed: true}, + member_count: {name: 'member_count', type: 'number'}, + timezone_count: {name: 'timezone_count', type: 'number'}, + }, + columnArray: [ + {name: 'channel_id', type: 'string', isIndexed: true}, + {name: 'group_id', type: 'string', isIndexed: true}, + {name: 'member_count', type: 'number'}, + {name: 'timezone_count', type: 'number'}, + ], + }, + [GROUPS_IN_TEAM]: { + name: GROUPS_IN_TEAM, + columns: { + group_id: {name: 'group_id', type: 'string', isIndexed: true}, + member_count: {name: 'member_count', type: 'number'}, + team_id: {name: 'team_id', type: 'string', isIndexed: true}, + timezone_count: {name: 'timezone_count', type: 'number'}, + }, + columnArray: [ + {name: 'group_id', type: 'string', isIndexed: true}, + {name: 'member_count', type: 'number'}, + {name: 'team_id', type: 'string', isIndexed: true}, + {name: 'timezone_count', type: 'number'}, + ], + }, + [GROUP_MEMBERSHIP]: { + name: GROUP_MEMBERSHIP, + columns: { + group_id: {name: 'group_id', type: 'string', isIndexed: true}, + user_id: {name: 'user_id', type: 'string', isIndexed: true}, + }, + columnArray: [ + {name: 'group_id', type: 'string', isIndexed: true}, + {name: 'user_id', type: 'string', isIndexed: true}, + ], + }, [PREFERENCE]: { name: PREFERENCE, columns: { diff --git a/types/database/channel_membership.d.ts b/types/database/channel_membership.d.ts index 1b553c715..b4314f0e9 100644 --- a/types/database/channel_membership.d.ts +++ b/types/database/channel_membership.d.ts @@ -20,15 +20,13 @@ export default class ChannelMembership extends Model { /** channel_id : The foreign key to the related Channel record */ channelId: string; - - /* user_id: The foreign key to the related User record*/ userId: string; /** memberChannel : The related channel this member belongs to */ - channel: Relation; + memberChannel: Relation; /** memberUser : The related member belonging to the channel */ - user: Relation; + memberUser: Relation; /** * getAllChannelsForUser - Retrieves all the channels that the user is part of diff --git a/types/database/group.d.ts b/types/database/group.d.ts new file mode 100644 index 000000000..a4213c501 --- /dev/null +++ b/types/database/group.d.ts @@ -0,0 +1,36 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import Model, {Associations} from '@nozbe/watermelondb/Model'; + +import GroupMembership from '@typings/database/group_membership'; +import GroupsInChannel from '@typings/database/groups_in_channel'; +import GroupsInTeam from '@typings/database/groups_in_team'; + +/** + * The Group model unifies/assembles users, teams and channels based on a common ground. For example, a group can be + * all users who are in the mobile team. If one needs to send that group a message, then s/he can mention the group's + * name in the message. (e.g @mobile_team) + */ +export default class Group extends Model { + /** table (entity name) : Group */ + static table: string; + + /** associations : Describes every relationship to this entity. */ + static associations: Associations; + + /** display_name : The display name for the group */ + displayName: string; + + /** name : The name of the group */ + name: string; + + /** groupsInChannel : All the related children records from GroupsInChannel */ + groupsInChannel: GroupsInChannel[]; + + /** groupsInTeam : All the related children records from GroupsInTeam */ + groupsInTeam: GroupsInTeam[]; + + /** groupMemberships : All the related children records from GroupMembership */ + groupMemberships: GroupMembership[]; +} diff --git a/types/database/group_membership.d.ts b/types/database/group_membership.d.ts index e783e0bdd..70d88d777 100644 --- a/types/database/group_membership.d.ts +++ b/types/database/group_membership.d.ts @@ -1,11 +1,38 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import Model from '@nozbe/watermelondb/Model'; +import {Query, Relation} from '@nozbe/watermelondb'; +import Model, {Associations} from '@nozbe/watermelondb/Model'; + +import Group from '@typings/database/group'; +import User from '@typings/database/user'; /** * The GroupMembership model represents the 'association table' where many groups have users and many users are in * groups (relationship type N:N) */ export default class GroupMembership extends Model { + /** table (entity name) : GroupMembership */ + static table: string; + + /** associations : Describes every relationship to this entity */ + static associations: Associations; + groupId: string; + userId: string; + + /** memberGroup : The related group this user belongs to */ + memberGroup: Relation; + + /** memberUser : The related user in the group */ + memberUser: Relation; + + /** + * getAllGroupsForUser : Retrieves all the groups that the user is part of + */ + getAllGroupsForUser: Query; + + /** + * getAllUsersInGroup : Retrieves all the users who are part of this group + */ + getAllUsersInGroup: Query; } diff --git a/types/database/groups_in_channel.d.ts b/types/database/groups_in_channel.d.ts new file mode 100644 index 000000000..c109a1e20 --- /dev/null +++ b/types/database/groups_in_channel.d.ts @@ -0,0 +1,37 @@ +// 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 Channel from '@typings/database/channel'; +import Group from '@typings/database/group'; + +/** + * The GroupsInChannel links the Channel model with the Group model + */ +export default class GroupsInChannel extends Model { + /** table (entity name) : GroupsInChannel */ + static table: string; + + /** associations : Describes every relationship to this entity. */ + static associations: Associations; + + /** channel_id : The foreign key of the related CHANNEL model */ + channelId: string; + + /** group_id : The foreign key of the related GROUP model */ + groupId: string; + + /** member_count : The number of members in that group */ + memberCount: number; + + /** timezone_count : The number of timezones in that group */ + timezoneCount: number; + + /** channel : The related record to the parent Channel model */ + channel: Relation; + + /** group : The related record to the parent Group model */ + group: Relation; +} diff --git a/types/database/my_team.d.ts b/types/database/my_team.d.ts index a84e60808..eb7758333 100644 --- a/types/database/my_team.d.ts +++ b/types/database/my_team.d.ts @@ -28,6 +28,6 @@ export default class MyTeam extends Model { /** team_id : The foreign key of the 'parent' Team entity */ teamId: string; - /** teams : The relation to the entity TEAM, that this user belongs to */ + /** team : The relation to the entity TEAM, that this user belongs to */ team: Relation; } diff --git a/types/database/posts_in_channel.d.ts b/types/database/posts_in_channel.d.ts new file mode 100644 index 000000000..121cc16a4 --- /dev/null +++ b/types/database/posts_in_channel.d.ts @@ -0,0 +1,12 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import Model from '@nozbe/watermelondb/Model'; + +/** + * PostsInChannel model helps us to combine adjacent posts together without leaving + * gaps in between for an efficient user reading experience of posts. + */ +export default class PostsInChannel extends Model { + +} diff --git a/types/database/reaction.d.ts b/types/database/reaction.d.ts index d313a31ad..9e04dc585 100644 --- a/types/database/reaction.d.ts +++ b/types/database/reaction.d.ts @@ -29,9 +29,9 @@ export default class Reaction extends Model { /** user_id : The related User's foreign key by which this reaction was expressed */ userId: string; - /** reactionUser : The related record to the User model */ + /** user : The related record to the User model */ user: Relation; - /** reactionPost : The related record to the Post model */ + /** post : The related record to the Post model */ post: Relation; } diff --git a/types/database/team_search_history.d.ts b/types/database/team_search_history.d.ts index 7d254e931..6faef6208 100644 --- a/types/database/team_search_history.d.ts +++ b/types/database/team_search_history.d.ts @@ -17,13 +17,13 @@ export default class TeamSearchHistory extends Model { /** associations : Describes every relationship to this entity. */ static associations: Associations; - /** createdAt : The timestamp at which this search was performed */ + /** created_at : The timestamp at which this search was performed */ createdAt: number; - /** teamId : The foreign key to the parent Team model */ + /** team_id : The foreign key to the parent Team model */ teamId: string; - /** displayTerm : The term that we display to the user */ + /** display_term : The term that we display to the user */ displayTerm: string; /** term : The term that is sent to the server to perform the search */