issues
search
RocketChat
/
Rocket.Chat.Apps-engine
The Rocket.Chat Apps engine and definitions.
https://rocketchat.github.io/Rocket.Chat.Apps-engine/
MIT License
114
stars
119
forks
source link
feat: Apps-Engine method to read multiple messages from a room by roomId
#770
Open
Dnouv
opened
3 weeks ago
Dnouv
commented
3 weeks ago
What? :boat:
Restore:
https://github.com/RocketChat/Rocket.Chat.Apps-engine/commit/cfc0a0b0f530808bf417010e657957c063016c3f
and
https://github.com/RocketChat/Rocket.Chat.Apps-engine/commit/5284a5f866409548e276bdf2b69bee6dfc466183
; Implement room bridge getMessage
Add a map from Apps Engine's dev-friendly sort params to mongoDB sort params
Adds the
limit
check
Why? :thinking:
Links :earth_americas:
JIRA
PS :eyes:
Package to test the bridge:
test-rmsgbridge-app_0.0.1.zip
PostMessageSent sample code for testing the bridge
```ts async executePostMessageSent( message: IMessage, read: IRead, http: IHttp, persistence: IPersistence, modify: IModify ): Promise
{ this.getLogger().log("Message Sent", this.sampleData); // Helper function to test getMessages with different parameters const testGetMessages = async (params: any, description: string) => { try { const messages = await read .getRoomReader() .getMessages(message.room.id, params); console.log( `${description}:---------------\n`, messages, `--------------\nTotal Messages: ${messages.length}\n\n\n` ); } catch (error) { console.error( `Error fetching messages with ${description}:`, error ); } }; // Test cases await testGetMessages({}, "All Messages"); await testGetMessages({ limit: NaN }, "Messages with NaN Limit"); await testGetMessages( { limit: 2, skip: 1 }, "Messages with Limit and Skip" ); await testGetMessages( { skip: 1, sort: { createdAt: "asc" }, limit: 2 }, "Messages with Sort" ); return Promise.resolve(); } ```
What? :boat:
limit
checkWhy? :thinking:
Links :earth_americas:
JIRA
PS :eyes:
Package to test the bridge: test-rmsgbridge-app_0.0.1.zip
PostMessageSent sample code for testing the bridge
```ts async executePostMessageSent( message: IMessage, read: IRead, http: IHttp, persistence: IPersistence, modify: IModify ): Promise