-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement room reader method to get messages in a room (#770)
Co-authored-by: Douglas Gubert <[email protected]>
- Loading branch information
Showing
9 changed files
with
183 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import type { IBlock, Block } from '@rocket.chat/ui-kit'; | ||
|
||
import type { IRoom } from '../rooms'; | ||
import type { IUserLookup } from '../users'; | ||
import type { IMessageAttachment } from './IMessageAttachment'; | ||
import type { IMessageFile } from './IMessageFile'; | ||
import type { IMessageReactions } from './IMessageReaction'; | ||
|
||
/** | ||
* The raw version of a message, without resolved information for relationship fields, i.e. | ||
* `room`, `sender` and `editor` are not the complete entity like they are in `IMessage` | ||
* | ||
* This is used in methods that fetch multiple messages at the same time, as resolving the relationship | ||
* fields require additional queries to the database and would hit the system's performance significantly. | ||
*/ | ||
export interface IMessageRaw { | ||
id: string; | ||
roomId: IRoom['id']; | ||
sender: IUserLookup; | ||
createdAt: Date; | ||
threadId?: string; | ||
text?: string; | ||
updatedAt?: Date; | ||
editor?: IUserLookup; | ||
editedAt?: Date; | ||
emoji?: string; | ||
avatarUrl?: string; | ||
alias?: string; | ||
file?: IMessageFile; | ||
attachments?: Array<IMessageAttachment>; | ||
reactions?: IMessageReactions; | ||
groupable?: boolean; | ||
parseUrls?: boolean; | ||
customFields?: { [key: string]: any }; | ||
blocks?: Array<IBlock | Block>; | ||
starred?: Array<{ _id: string }>; | ||
pinned?: boolean; | ||
pinnedAt?: Date; | ||
pinnedBy?: IUserLookup; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export interface IUserLookup { | ||
_id: string; | ||
username: string; | ||
name?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters