Skip to content
This repository was archived by the owner on Nov 5, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/definition/accessors/ILivechatRead.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export interface ILivechatRead {
isOnlineAsync(departmentId?: string): Promise<boolean>;
getDepartmentsEnabledWithAgents(): Promise<Array<IDepartment>>;
getLivechatRooms(visitor: IVisitor, departmentId?: string): Promise<Array<ILivechatRoom>>;
getLivechatRoomsByAgentId(agentId: string): Promise<Array<ILivechatRoom>>;
getLivechatTotalRoomsByAgentId(agentId: string): Promise<number>;
/**
* @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.
Expand Down
8 changes: 8 additions & 0 deletions src/server/accessors/LivechatRead.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ export class LivechatRead implements ILivechatRead {
return this.livechatBridge.doFindRooms(visitor, departmentId, this.appId);
}

public getLivechatTotalRoomsByAgentId(agentId: string): Promise<number> {
return this.livechatBridge.doCountRoomsByAgentId(agentId, this.appId);
}

public getLivechatRoomsByAgentId(agentId: string): Promise<Array<ILivechatRoom>> {
return this.livechatBridge.doFindRoomsByAgentId(agentId, this.appId);
}

/**
* @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.
Expand Down
16 changes: 16 additions & 0 deletions src/server/bridges/LivechatBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ export abstract class LivechatBridge extends BaseBridge {
}
}

public async doCountRoomsByAgentId(agentId: string, appId: string): Promise<number> {
if (this.hasReadPermission(appId, 'livechat-room')) {
return this.countRoomsByAgentId(agentId, appId);
}
}

public async doFindRoomsByAgentId(agentId: string, appId: string): Promise<Array<ILivechatRoom>> {
if (this.hasReadPermission(appId, 'livechat-room')) {
return this.findRoomsByAgentId(agentId, appId);
}
}

public async doFindRooms(visitor: IVisitor, departmentId: string | null, appId: string): Promise<Array<ILivechatRoom>> {
if (this.hasReadPermission(appId, 'livechat-room')) {
return this.findRooms(visitor, departmentId, appId);
Expand Down Expand Up @@ -171,6 +183,10 @@ export abstract class LivechatBridge extends BaseBridge {

protected abstract closeRoom(room: ILivechatRoom, comment: string, closer: IUser | undefined, appId: string): Promise<boolean>;

protected abstract countRoomsByAgentId(agentId: string, appId: string): Promise<number>;

protected abstract findRoomsByAgentId(agentId: string, appId: string): Promise<Array<ILivechatRoom>>;

protected abstract findRooms(visitor: IVisitor, departmentId: string | null, appId: string): Promise<Array<ILivechatRoom>>;

protected abstract findDepartmentByIdOrName(value: string, appId: string): Promise<IDepartment | undefined>;
Expand Down
8 changes: 8 additions & 0 deletions tests/test-data/bridges/livechatBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ export class TestLivechatBridge extends LivechatBridge {
throw new Error('Method not implemented');
}

public findRoomsByAgentId(agentId: string, appId: string): Promise<ILivechatRoom[]> {
throw new Error('Method not implemented');
}

public countRoomsByAgentId(agentId: string, appId: string): Promise<number> {
throw new Error('Method not implemented');
}

public findDepartmentByIdOrName(value: string, appId: string): Promise<IDepartment | undefined> {
throw new Error('Method not implemented');
}
Expand Down