From 3fb13c23131fab4009efcafa0c5be9b1e14b78b6 Mon Sep 17 00:00:00 2001 From: lolimay Date: Mon, 3 Feb 2020 15:14:59 +0800 Subject: [PATCH 1/2] Check Omnichannel service status per Department --- src/definition/accessors/ILivechatRead.ts | 6 +++++- src/server/accessors/LivechatRead.ts | 4 ++-- src/server/bridges/ILivechatBridge.ts | 2 +- tests/test-data/bridges/livechatBridge.ts | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/definition/accessors/ILivechatRead.ts b/src/definition/accessors/ILivechatRead.ts index 4c9b20225..02304db1b 100644 --- a/src/definition/accessors/ILivechatRead.ts +++ b/src/definition/accessors/ILivechatRead.ts @@ -3,7 +3,11 @@ import { ILivechatRoom } from '../livechat/ILivechatRoom'; import { IVisitor } from '../livechat/IVisitor'; export interface ILivechatRead { - isOnline(): boolean; + /** + * Gets online status of the livechat. + * @param department (optional) the id of the livechat department + */ + isOnline(department?: string): boolean; getLivechatRooms(visitor: IVisitor, departmentId?: string): Promise>; /** * @deprecated This method does not adhere to the conversion practices applied diff --git a/src/server/accessors/LivechatRead.ts b/src/server/accessors/LivechatRead.ts index 3651d1c2e..32dd77bef 100644 --- a/src/server/accessors/LivechatRead.ts +++ b/src/server/accessors/LivechatRead.ts @@ -6,8 +6,8 @@ import { ILivechatBridge } from '../bridges/ILivechatBridge'; export class LivechatRead implements ILivechatRead { constructor(private readonly livechatBridge: ILivechatBridge, private readonly appId: string) { } - public isOnline(): boolean { - return this.livechatBridge.isOnline(); + public isOnline(department?: string): boolean { + return this.livechatBridge.isOnline(department); } public getLivechatRooms(visitor: IVisitor, departmentId?: string): Promise> { diff --git a/src/server/bridges/ILivechatBridge.ts b/src/server/bridges/ILivechatBridge.ts index 3ecc07a65..bdf71c805 100644 --- a/src/server/bridges/ILivechatBridge.ts +++ b/src/server/bridges/ILivechatBridge.ts @@ -2,7 +2,7 @@ import { IDepartment, ILivechatMessage, ILivechatRoom, ILivechatTransferData, IV import { IUser } from '../../definition/users'; export interface ILivechatBridge { - isOnline(): boolean; + isOnline(department?: string): boolean; createMessage(message: ILivechatMessage, appId: string): Promise; getMessageById(messageId: string, appId: string): Promise; updateMessage(message: ILivechatMessage, appId: string): Promise; diff --git a/tests/test-data/bridges/livechatBridge.ts b/tests/test-data/bridges/livechatBridge.ts index c940c51a6..ac7013e88 100644 --- a/tests/test-data/bridges/livechatBridge.ts +++ b/tests/test-data/bridges/livechatBridge.ts @@ -3,7 +3,7 @@ import { IUser } from '../../../src/definition/users'; import { ILivechatBridge } from '../../../src/server/bridges/ILivechatBridge'; export class TestLivechatBridge implements ILivechatBridge { - public isOnline(): boolean { + public isOnline(department?: string): boolean { throw new Error('Method not implemented'); } public createMessage(message: ILivechatMessage, appId: string): Promise { From a910c997b3c1bcddd364d5dc05b982d30fccbec2 Mon Sep 17 00:00:00 2001 From: lolimay Date: Mon, 3 Feb 2020 19:46:16 +0800 Subject: [PATCH 2/2] renaming department to departmentId --- src/definition/accessors/ILivechatRead.ts | 4 ++-- src/server/accessors/LivechatRead.ts | 4 ++-- src/server/bridges/ILivechatBridge.ts | 2 +- tests/test-data/bridges/livechatBridge.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/definition/accessors/ILivechatRead.ts b/src/definition/accessors/ILivechatRead.ts index 02304db1b..2b9d66f5e 100644 --- a/src/definition/accessors/ILivechatRead.ts +++ b/src/definition/accessors/ILivechatRead.ts @@ -5,9 +5,9 @@ import { IVisitor } from '../livechat/IVisitor'; export interface ILivechatRead { /** * Gets online status of the livechat. - * @param department (optional) the id of the livechat department + * @param departmentId (optional) the id of the livechat department */ - isOnline(department?: string): boolean; + isOnline(departmentId?: string): boolean; getLivechatRooms(visitor: IVisitor, departmentId?: string): Promise>; /** * @deprecated This method does not adhere to the conversion practices applied diff --git a/src/server/accessors/LivechatRead.ts b/src/server/accessors/LivechatRead.ts index 32dd77bef..366d34cd9 100644 --- a/src/server/accessors/LivechatRead.ts +++ b/src/server/accessors/LivechatRead.ts @@ -6,8 +6,8 @@ import { ILivechatBridge } from '../bridges/ILivechatBridge'; export class LivechatRead implements ILivechatRead { constructor(private readonly livechatBridge: ILivechatBridge, private readonly appId: string) { } - public isOnline(department?: string): boolean { - return this.livechatBridge.isOnline(department); + public isOnline(departmentId?: string): boolean { + return this.livechatBridge.isOnline(departmentId); } public getLivechatRooms(visitor: IVisitor, departmentId?: string): Promise> { diff --git a/src/server/bridges/ILivechatBridge.ts b/src/server/bridges/ILivechatBridge.ts index bdf71c805..6a257880d 100644 --- a/src/server/bridges/ILivechatBridge.ts +++ b/src/server/bridges/ILivechatBridge.ts @@ -2,7 +2,7 @@ import { IDepartment, ILivechatMessage, ILivechatRoom, ILivechatTransferData, IV import { IUser } from '../../definition/users'; export interface ILivechatBridge { - isOnline(department?: string): boolean; + isOnline(departmentId?: string): boolean; createMessage(message: ILivechatMessage, appId: string): Promise; getMessageById(messageId: string, appId: string): Promise; updateMessage(message: ILivechatMessage, appId: string): Promise; diff --git a/tests/test-data/bridges/livechatBridge.ts b/tests/test-data/bridges/livechatBridge.ts index ac7013e88..51b7c0328 100644 --- a/tests/test-data/bridges/livechatBridge.ts +++ b/tests/test-data/bridges/livechatBridge.ts @@ -3,7 +3,7 @@ import { IUser } from '../../../src/definition/users'; import { ILivechatBridge } from '../../../src/server/bridges/ILivechatBridge'; export class TestLivechatBridge implements ILivechatBridge { - public isOnline(department?: string): boolean { + public isOnline(departmentId?: string): boolean { throw new Error('Method not implemented'); } public createMessage(message: ILivechatMessage, appId: string): Promise {