|
|
|
|
@ -80,19 +80,19 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
super(db, trash); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
countPrioritizedRooms(): Promise<number> { |
|
|
|
|
override countPrioritizedRooms(): Promise<number> { |
|
|
|
|
return this.countDocuments({ priorityId: { $exists: true } }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
countRoomsWithSla(): Promise<number> { |
|
|
|
|
override countRoomsWithSla(): Promise<number> { |
|
|
|
|
return this.countDocuments({ slaId: { $exists: true } }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
countRoomsWithTranscriptSent(): Promise<number> { |
|
|
|
|
override countRoomsWithTranscriptSent(): Promise<number> { |
|
|
|
|
return this.countDocuments({ pdfTranscriptFileId: { $exists: true } }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async unsetAllPredictedVisitorAbandonment(): Promise<void> { |
|
|
|
|
override async unsetAllPredictedVisitorAbandonment(): Promise<void> { |
|
|
|
|
return this.updateMany( |
|
|
|
|
{ |
|
|
|
|
'open': true, |
|
|
|
|
@ -105,15 +105,15 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
).then(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
setOnHoldByRoomId(roomId: string): Promise<UpdateResult> { |
|
|
|
|
override setOnHoldByRoomId(roomId: string): Promise<UpdateResult> { |
|
|
|
|
return this.updateOne({ _id: roomId }, { $set: { onHold: true } }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
unsetOnHoldByRoomId(roomId: string): Promise<UpdateResult> { |
|
|
|
|
override unsetOnHoldByRoomId(roomId: string): Promise<UpdateResult> { |
|
|
|
|
return this.updateOne({ _id: roomId }, { $unset: { onHold: 1 } }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
unsetOnHoldAndPredictedVisitorAbandonmentByRoomId(roomId: string): Promise<UpdateResult> { |
|
|
|
|
override unsetOnHoldAndPredictedVisitorAbandonmentByRoomId(roomId: string): Promise<UpdateResult> { |
|
|
|
|
return this.updateOne( |
|
|
|
|
{ |
|
|
|
|
_id: roomId, |
|
|
|
|
@ -127,7 +127,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
setSlaForRoomById( |
|
|
|
|
override setSlaForRoomById( |
|
|
|
|
roomId: string, |
|
|
|
|
sla: Pick<IOmnichannelServiceLevelAgreements, '_id' | 'dueTimeInMinutes'>, |
|
|
|
|
): Promise<UpdateResult | Document> { |
|
|
|
|
@ -146,7 +146,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
removeSlaFromRoomById(roomId: string): Promise<UpdateResult | Document> { |
|
|
|
|
override removeSlaFromRoomById(roomId: string): Promise<UpdateResult | Document> { |
|
|
|
|
return this.updateOne( |
|
|
|
|
{ |
|
|
|
|
_id: roomId, |
|
|
|
|
@ -162,7 +162,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bulkRemoveSlaFromRoomsById(slaId: string): Promise<UpdateResult | Document> { |
|
|
|
|
override bulkRemoveSlaFromRoomsById(slaId: string): Promise<UpdateResult | Document> { |
|
|
|
|
return this.updateMany( |
|
|
|
|
{ |
|
|
|
|
open: true, |
|
|
|
|
@ -178,7 +178,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
findOpenBySlaId( |
|
|
|
|
override findOpenBySlaId( |
|
|
|
|
slaId: string, |
|
|
|
|
options: FindOptions<IOmnichannelRoom>, |
|
|
|
|
extraQuery?: Filter<IOmnichannelRoom>, |
|
|
|
|
@ -193,13 +193,13 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
return this.find(query, options); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async setPriorityByRoomId(roomId: string, priority: Pick<ILivechatPriority, '_id' | 'sortItem'>): Promise<UpdateResult> { |
|
|
|
|
override async setPriorityByRoomId(roomId: string, priority: Pick<ILivechatPriority, '_id' | 'sortItem'>): Promise<UpdateResult> { |
|
|
|
|
const { _id: priorityId, sortItem: priorityWeight } = priority; |
|
|
|
|
|
|
|
|
|
return this.updateOne({ _id: roomId }, { $set: { priorityId, priorityWeight } }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async unsetPriorityByRoomId(roomId: string): Promise<UpdateResult> { |
|
|
|
|
override async unsetPriorityByRoomId(roomId: string): Promise<UpdateResult> { |
|
|
|
|
return this.updateOne( |
|
|
|
|
{ _id: roomId }, |
|
|
|
|
{ |
|
|
|
|
@ -213,14 +213,14 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getPredictedVisitorAbandonmentByRoomIdUpdateQuery( |
|
|
|
|
override getPredictedVisitorAbandonmentByRoomIdUpdateQuery( |
|
|
|
|
date: Date, |
|
|
|
|
roomUpdater: Updater<IOmnichannelRoom> = this.getUpdater(), |
|
|
|
|
): Updater<IOmnichannelRoom> { |
|
|
|
|
return roomUpdater.set('omnichannel.predictedVisitorAbandonmentAt', date); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
setPredictedVisitorAbandonmentByRoomId(rid: string, willBeAbandonedAt: Date): Promise<UpdateResult> { |
|
|
|
|
override setPredictedVisitorAbandonmentByRoomId(rid: string, willBeAbandonedAt: Date): Promise<UpdateResult> { |
|
|
|
|
const query = { |
|
|
|
|
_id: rid, |
|
|
|
|
}; |
|
|
|
|
@ -233,7 +233,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
return this.updateOne(query, update); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
findAbandonedOpenRooms(date: Date, extraQuery?: Filter<IOmnichannelRoom>): FindCursor<IOmnichannelRoom> { |
|
|
|
|
override findAbandonedOpenRooms(date: Date, extraQuery?: Filter<IOmnichannelRoom>): FindCursor<IOmnichannelRoom> { |
|
|
|
|
return this.find({ |
|
|
|
|
'omnichannel.predictedVisitorAbandonmentAt': { $lte: date }, |
|
|
|
|
'waitingResponse': { $exists: false }, |
|
|
|
|
@ -243,7 +243,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async unsetPredictedVisitorAbandonmentByRoomId(roomId: string): Promise<UpdateResult> { |
|
|
|
|
override async unsetPredictedVisitorAbandonmentByRoomId(roomId: string): Promise<UpdateResult> { |
|
|
|
|
return this.updateOne( |
|
|
|
|
{ |
|
|
|
|
_id: roomId, |
|
|
|
|
@ -254,7 +254,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async associateRoomsWithDepartmentToUnit(departments: string[], unitId: string): Promise<void> { |
|
|
|
|
override async associateRoomsWithDepartmentToUnit(departments: string[], unitId: string): Promise<void> { |
|
|
|
|
const query = { |
|
|
|
|
$and: [ |
|
|
|
|
{ |
|
|
|
|
@ -290,7 +290,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
await this.updateMany(queryToDisassociateOldRoomsConnectedToUnit, updateToDisassociateRooms); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async removeUnitAssociationFromRooms(unitId: string): Promise<void> { |
|
|
|
|
override async removeUnitAssociationFromRooms(unitId: string): Promise<void> { |
|
|
|
|
const query = { |
|
|
|
|
departmentAncestors: unitId, |
|
|
|
|
}; |
|
|
|
|
@ -298,7 +298,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
await this.updateMany(query, update); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async updateDepartmentAncestorsById(rid: string, departmentAncestors?: string[]) { |
|
|
|
|
override async updateDepartmentAncestorsById(rid: string, departmentAncestors?: string[]) { |
|
|
|
|
const query = { |
|
|
|
|
_id: rid, |
|
|
|
|
}; |
|
|
|
|
@ -306,7 +306,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
return this.updateOne(query, update); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getConversationsBySource(start: Date, end: Date, extraQuery: Filter<IOmnichannelRoom>): AggregationCursor<ReportResult> { |
|
|
|
|
override getConversationsBySource(start: Date, end: Date, extraQuery: Filter<IOmnichannelRoom>): AggregationCursor<ReportResult> { |
|
|
|
|
return this.col.aggregate( |
|
|
|
|
[ |
|
|
|
|
{ |
|
|
|
|
@ -358,7 +358,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getConversationsByStatus(start: Date, end: Date, extraQuery: Filter<IOmnichannelRoom>): AggregationCursor<ReportResult> { |
|
|
|
|
override getConversationsByStatus(start: Date, end: Date, extraQuery: Filter<IOmnichannelRoom>): AggregationCursor<ReportResult> { |
|
|
|
|
return this.col.aggregate( |
|
|
|
|
[ |
|
|
|
|
{ |
|
|
|
|
@ -465,7 +465,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getConversationsByDepartment( |
|
|
|
|
override getConversationsByDepartment( |
|
|
|
|
start: Date, |
|
|
|
|
end: Date, |
|
|
|
|
sort: Record<string, 1 | -1>, |
|
|
|
|
@ -542,7 +542,11 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getTotalConversationsWithoutDepartmentBetweenDates(start: Date, end: Date, extraQuery: Filter<IOmnichannelRoom>): Promise<number> { |
|
|
|
|
override getTotalConversationsWithoutDepartmentBetweenDates( |
|
|
|
|
start: Date, |
|
|
|
|
end: Date, |
|
|
|
|
extraQuery: Filter<IOmnichannelRoom>, |
|
|
|
|
): Promise<number> { |
|
|
|
|
return this.countDocuments({ |
|
|
|
|
t: 'l', |
|
|
|
|
departmentId: { |
|
|
|
|
@ -556,7 +560,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getConversationsByTags( |
|
|
|
|
override getConversationsByTags( |
|
|
|
|
start: Date, |
|
|
|
|
end: Date, |
|
|
|
|
sort: Record<string, 1 | -1>, |
|
|
|
|
@ -620,7 +624,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getConversationsWithoutTagsBetweenDate(start: Date, end: Date, extraQuery: Filter<IOmnichannelRoom>): Promise<number> { |
|
|
|
|
override getConversationsWithoutTagsBetweenDate(start: Date, end: Date, extraQuery: Filter<IOmnichannelRoom>): Promise<number> { |
|
|
|
|
return this.countDocuments({ |
|
|
|
|
t: 'l', |
|
|
|
|
ts: { |
|
|
|
|
@ -643,7 +647,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getConversationsByAgents( |
|
|
|
|
override getConversationsByAgents( |
|
|
|
|
start: Date, |
|
|
|
|
end: Date, |
|
|
|
|
sort: Record<string, 1 | -1>, |
|
|
|
|
@ -715,7 +719,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getTotalConversationsWithoutAgentsBetweenDate(start: Date, end: Date, extraQuery: Filter<IOmnichannelRoom>): Promise<number> { |
|
|
|
|
override getTotalConversationsWithoutAgentsBetweenDate(start: Date, end: Date, extraQuery: Filter<IOmnichannelRoom>): Promise<number> { |
|
|
|
|
return this.countDocuments({ |
|
|
|
|
t: 'l', |
|
|
|
|
ts: { |
|
|
|
|
@ -729,7 +733,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
updateMergedContactIds( |
|
|
|
|
override updateMergedContactIds( |
|
|
|
|
contactIdsThatWereMerged: ILivechatContact['_id'][], |
|
|
|
|
newContactId: ILivechatContact['_id'], |
|
|
|
|
options?: UpdateOptions, |
|
|
|
|
@ -737,7 +741,7 @@ export class LivechatRoomsRawEE extends LivechatRoomsRaw implements ILivechatRoo |
|
|
|
|
return this.updateMany({ contactId: { $in: contactIdsThatWereMerged } }, { $set: { contactId: newContactId } }, options); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
findClosedRoomsByContactAndSourcePaginated({ |
|
|
|
|
override findClosedRoomsByContactAndSourcePaginated({ |
|
|
|
|
contactId, |
|
|
|
|
source, |
|
|
|
|
options = {}, |
|
|
|
|
|