orbitx-core-models 11.145.0 → 11.146.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ticketRouting.d.ts","sourceRoot":"","sources":["../../src/routing/ticketRouting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAMjC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAoBjF,eAAO,MAAM,oBAAoB,0EAKvB,CAAC;AAEX,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,eAAe,CAAC;IAC3B,OAAO,EAAE,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC5B,WAAW,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;CAC/B;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,SAAS,CAAC,CA2BzG;AAED,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"ticketRouting.d.ts","sourceRoot":"","sources":["../../src/routing/ticketRouting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAMjC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAoBjF,eAAO,MAAM,oBAAoB,0EAKvB,CAAC;AAEX,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,eAAe,CAAC;IAC3B,OAAO,EAAE,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC5B,WAAW,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;CAC/B;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,SAAS,CAAC,CA2BzG;AAED,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAmCnG"}
|
|
@@ -62,14 +62,23 @@ async function pickFromGroup(groupId) {
|
|
|
62
62
|
return (_a = eligible[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
63
63
|
}
|
|
64
64
|
async function resolveTicketRouting(ticket) {
|
|
65
|
+
var _a, _b;
|
|
65
66
|
const followerIds = [];
|
|
66
67
|
let assigneeId;
|
|
67
68
|
// `any` here deliberately -- Company and Partner are two distinct Mongoose models with
|
|
68
69
|
// differently-typed findById overloads that TS can't unify through a variable holding either.
|
|
69
70
|
const Owner = ticket.ownerType === "Partner" ? partner_model_1.Partner : company_model_1.Company;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
// Real bug, found and fixed here: this selected a top-level `accountManager` field that
|
|
72
|
+
// exists on neither model (Company's is nested at basicInfo.accountManager, Partner's at
|
|
73
|
+
// accountInfo.accountManager) -- the Account Manager has never actually been auto-added as a
|
|
74
|
+
// ticket follower, on any ticket, since this was built, despite the model's own comment saying
|
|
75
|
+
// they always are.
|
|
76
|
+
const owner = await Owner.findById(ticket.ownerId)
|
|
77
|
+
.select("groupId basicInfo.accountManager accountInfo.accountManager")
|
|
78
|
+
.lean();
|
|
79
|
+
const accountManagerId = ticket.ownerType === "Partner" ? (_a = owner === null || owner === void 0 ? void 0 : owner.accountInfo) === null || _a === void 0 ? void 0 : _a.accountManager : (_b = owner === null || owner === void 0 ? void 0 : owner.basicInfo) === null || _b === void 0 ? void 0 : _b.accountManager;
|
|
80
|
+
if (accountManagerId)
|
|
81
|
+
followerIds.push(accountManagerId);
|
|
73
82
|
// Rule 1: the owner's own group (Company only today -- Partner has no groupId field yet).
|
|
74
83
|
if (ticket.ownerType === "Company" && (owner === null || owner === void 0 ? void 0 : owner.groupId)) {
|
|
75
84
|
const group = await group_model_1.Group.findOne({ _id: owner.groupId, isActive: true }).select("_id").lean();
|