diff --git a/src/graphql/schema.graphql b/src/graphql/schema.graphql index b4c2162..eb91a75 100644 --- a/src/graphql/schema.graphql +++ b/src/graphql/schema.graphql @@ -341,7 +341,7 @@ type ChatRoom { members(first: Int=10, offset: Int=0): [User!] "return a specfic range of messages posted in the chat" - messages(first: Int = 10, offset: Int, containing: String): [ChatMessage]! + messages(first: Int = 10, offset: Int): [ChatMessage]! "id of the chat" id: ID! diff --git a/src/lib/models/ChatRoom.ts b/src/lib/models/ChatRoom.ts index 5187843..f521387 100644 --- a/src/lib/models/ChatRoom.ts +++ b/src/lib/models/ChatRoom.ts @@ -37,8 +37,10 @@ export class ChatRoom extends Model { /** * Returns the messages that have been sent in the chatroom */ - public async messages(): Promise { - return await this.$get("rMessages") as ChatMessage[]; + public async messages({first, offset}: {first: number, offset: number}): Promise { + const limit = first ?? 10; + offset = offset ?? 0; + return await this.$get("rMessages", {limit, offset}) as ChatMessage[]; } /**