diff --git a/package.json b/package.json index 779e142b..d8631555 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.8.0", + "version": "0.8.1", "license": "MIT", "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/src/modules/messages/index.ts b/src/modules/messages/index.ts index d625072e..980905b7 100644 --- a/src/modules/messages/index.ts +++ b/src/modules/messages/index.ts @@ -133,13 +133,23 @@ export class Messages { } public async getMessagesGroupByDate( - where: WhereCondition, - hasAppModuleMessageWhere: HasAppModuleMessageWhereConditions, - orderBy: Array, - search: string, - first: number, - page: number + options: { + where?: WhereCondition, + hasAppModuleMessageWhere?: HasAppModuleMessageWhereConditions, + orderBy?: Array, + search?: string, + first?: number, + page?: number + } = {} ): Promise { + const { + where, + hasAppModuleMessageWhere, + orderBy, + search, + first, + page, + } = options const response = await this.client.query({ query: GET_MESSAGES_GROUP_BY_DATE_QUERY, variables: { diff --git a/test/message.test.ts b/test/message.test.ts index 6a9d6dce..0eda15ea 100644 --- a/test/message.test.ts +++ b/test/message.test.ts @@ -1,4 +1,4 @@ -import { HasAppModuleMessageWhereConditions, WhereCondition } from '../src'; +import { WhereCondition } from '../src'; import { initializeClient, getClient } from './setupClient'; beforeAll(async () => { @@ -132,8 +132,8 @@ describe('Test the Social Messages', () => { expect(newMessage.id).toBeDefined(); expect(newMessage.message).toBe(messageContent); - const recentMessages = await messages.getMessages({ - search: 'Kanvas' + const recentMessages = await messages.getMessages({ + search: 'Kanvas' }); expect(recentMessages).toBeDefined(); }); @@ -234,14 +234,11 @@ describe('Test the Social Messages', () => { it('get messages group by date', async () => { const client = getClient(); const messages = client.messages; - const recentMessages = await messages.getMessagesGroupByDate( - {} as WhereCondition, - {} as HasAppModuleMessageWhereConditions, - [{ column: 'CREATED_AT', order: 'DESC' }], - '', - 25, - 1 - ); + const recentMessages = await messages.getMessagesGroupByDate({ + orderBy: [{ column: 'CREATED_AT', order: 'DESC' }], + first: 25, + page: 1 + }); expect(recentMessages).toBeDefined(); });