From b4f5e3bedeba3392a712a2acf2c8bf10b53e6d24 Mon Sep 17 00:00:00 2001 From: Luis Mauro Date: Mon, 11 Mar 2024 15:53:16 -0600 Subject: [PATCH] add Open prefix to find/count by agent methods --- src/definition/accessors/ILivechatRead.ts | 4 ++-- src/server/accessors/LivechatRead.ts | 8 ++++---- src/server/bridges/LivechatBridge.ts | 12 ++++++------ tests/test-data/bridges/livechatBridge.ts | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/definition/accessors/ILivechatRead.ts b/src/definition/accessors/ILivechatRead.ts index 91bdd487e..a756d162c 100644 --- a/src/definition/accessors/ILivechatRead.ts +++ b/src/definition/accessors/ILivechatRead.ts @@ -17,8 +17,8 @@ export interface ILivechatRead { isOnlineAsync(departmentId?: string): Promise; getDepartmentsEnabledWithAgents(): Promise>; getLivechatRooms(visitor: IVisitor, departmentId?: string): Promise>; - getLivechatRoomsByAgentId(agentId: string): Promise>; - getLivechatTotalRoomsByAgentId(agentId: string): Promise; + getLivechatOpenRoomsByAgentId(agentId: string): Promise>; + getLivechatTotalOpenRoomsByAgentId(agentId: string): Promise; /** * @deprecated This method does not adhere to the conversion practices applied * elsewhere in the Apps-Engine and will be removed in the next major version. diff --git a/src/server/accessors/LivechatRead.ts b/src/server/accessors/LivechatRead.ts index ef7503976..3d9421ff9 100644 --- a/src/server/accessors/LivechatRead.ts +++ b/src/server/accessors/LivechatRead.ts @@ -30,12 +30,12 @@ export class LivechatRead implements ILivechatRead { return this.livechatBridge.doFindRooms(visitor, departmentId, this.appId); } - public getLivechatTotalRoomsByAgentId(agentId: string): Promise { - return this.livechatBridge.doCountRoomsByAgentId(agentId, this.appId); + public getLivechatTotalOpenRoomsByAgentId(agentId: string): Promise { + return this.livechatBridge.doCountOpenRoomsByAgentId(agentId, this.appId); } - public getLivechatRoomsByAgentId(agentId: string): Promise> { - return this.livechatBridge.doFindRoomsByAgentId(agentId, this.appId); + public getLivechatOpenRoomsByAgentId(agentId: string): Promise> { + return this.livechatBridge.doFindOpenRoomsByAgentId(agentId, this.appId); } /** diff --git a/src/server/bridges/LivechatBridge.ts b/src/server/bridges/LivechatBridge.ts index 8ca7b542f..ea9e50f1b 100644 --- a/src/server/bridges/LivechatBridge.ts +++ b/src/server/bridges/LivechatBridge.ts @@ -104,15 +104,15 @@ export abstract class LivechatBridge extends BaseBridge { } } - public async doCountRoomsByAgentId(agentId: string, appId: string): Promise { + public async doCountOpenRoomsByAgentId(agentId: string, appId: string): Promise { if (this.hasReadPermission(appId, 'livechat-room')) { - return this.countRoomsByAgentId(agentId, appId); + return this.countOpenRoomsByAgentId(agentId, appId); } } - public async doFindRoomsByAgentId(agentId: string, appId: string): Promise> { + public async doFindOpenRoomsByAgentId(agentId: string, appId: string): Promise> { if (this.hasReadPermission(appId, 'livechat-room')) { - return this.findRoomsByAgentId(agentId, appId); + return this.findOpenRoomsByAgentId(agentId, appId); } } @@ -183,9 +183,9 @@ export abstract class LivechatBridge extends BaseBridge { protected abstract closeRoom(room: ILivechatRoom, comment: string, closer: IUser | undefined, appId: string): Promise; - protected abstract countRoomsByAgentId(agentId: string, appId: string): Promise; + protected abstract countOpenRoomsByAgentId(agentId: string, appId: string): Promise; - protected abstract findRoomsByAgentId(agentId: string, appId: string): Promise>; + protected abstract findOpenRoomsByAgentId(agentId: string, appId: string): Promise>; protected abstract findRooms(visitor: IVisitor, departmentId: string | null, appId: string): Promise>; diff --git a/tests/test-data/bridges/livechatBridge.ts b/tests/test-data/bridges/livechatBridge.ts index 9898be1ae..83eb45e13 100644 --- a/tests/test-data/bridges/livechatBridge.ts +++ b/tests/test-data/bridges/livechatBridge.ts @@ -70,11 +70,11 @@ export class TestLivechatBridge extends LivechatBridge { throw new Error('Method not implemented'); } - public findRoomsByAgentId(agentId: string, appId: string): Promise { + public findOpenRoomsByAgentId(agentId: string, appId: string): Promise { throw new Error('Method not implemented'); } - public countRoomsByAgentId(agentId: string, appId: string): Promise { + public countOpenRoomsByAgentId(agentId: string, appId: string): Promise { throw new Error('Method not implemented'); }