@7365admin1/core 3.102.0 → 3.102.2
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.
- package/CHANGELOG.md +12 -0
- package/dist/index.js +30 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/test/e2e/dashboard-deleted-work-orders.e2e.test.mjs +54 -0
- package/test/e2e/org-and-promo-list-scope.e2e.test.mjs +44 -5
- package/test/org-search.test.mjs +41 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @iservice365/core
|
|
2
2
|
|
|
3
|
+
## 3.102.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4666dc3: `GET /api/organizations?search=` now matches part of a client's name or e-mail, case-insensitively (escaped, so regex characters are literal). It was a whole-word `$text` search, so typing part of a name found nothing and a full name returned unrelated clients - the Super Admin Client details picker looked broken. The non-staff scope is still ANDed in.
|
|
8
|
+
|
|
9
|
+
## 3.102.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 0cc4953: Dashboard: a deleted work order (`status: "deleted"` in `work-orders2`) no longer counts as open on the Open Work Order tile, its trend, the activity chart, or as pending in the Work Order Status bar. The filters listed only "Deleted"; both spellings are now excluded.
|
|
14
|
+
|
|
3
15
|
## 3.102.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -6531,6 +6531,17 @@ function MOrg(value) {
|
|
|
6531
6531
|
|
|
6532
6532
|
// src/repositories/organization.repo.ts
|
|
6533
6533
|
var import_mongodb20 = require("mongodb");
|
|
6534
|
+
|
|
6535
|
+
// src/utils/org-search.util.ts
|
|
6536
|
+
function orgSearchMatch(search) {
|
|
6537
|
+
const term = typeof search === "string" ? search.trim() : "";
|
|
6538
|
+
if (!term)
|
|
6539
|
+
return null;
|
|
6540
|
+
const pattern = { $regex: term.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), $options: "i" };
|
|
6541
|
+
return { $or: [{ name: pattern }, { email: pattern }] };
|
|
6542
|
+
}
|
|
6543
|
+
|
|
6544
|
+
// src/repositories/organization.repo.ts
|
|
6534
6545
|
var DUPLICATE_FIELD_LABEL = {
|
|
6535
6546
|
name: "name",
|
|
6536
6547
|
email: "email address"
|
|
@@ -6692,9 +6703,10 @@ function useOrgRepo() {
|
|
|
6692
6703
|
query2.$or = reach;
|
|
6693
6704
|
cacheOptions.scope = `${ids2.join(",")}|${email.toLowerCase()}`;
|
|
6694
6705
|
}
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6706
|
+
const searchMatch2 = orgSearchMatch(search);
|
|
6707
|
+
if (searchMatch2) {
|
|
6708
|
+
query2.$and = [searchMatch2];
|
|
6709
|
+
cacheOptions.substring = search.trim().toLowerCase();
|
|
6698
6710
|
}
|
|
6699
6711
|
if (nature) {
|
|
6700
6712
|
query2.nature = nature;
|
|
@@ -6956,22 +6968,9 @@ function useOrgRepo() {
|
|
|
6956
6968
|
const query2 = {
|
|
6957
6969
|
status
|
|
6958
6970
|
};
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
name: {
|
|
6963
|
-
$regex: search,
|
|
6964
|
-
$options: "i"
|
|
6965
|
-
}
|
|
6966
|
-
},
|
|
6967
|
-
{
|
|
6968
|
-
email: {
|
|
6969
|
-
$regex: search,
|
|
6970
|
-
$options: "i"
|
|
6971
|
-
}
|
|
6972
|
-
}
|
|
6973
|
-
];
|
|
6974
|
-
}
|
|
6971
|
+
const searchMatch2 = orgSearchMatch(search);
|
|
6972
|
+
if (searchMatch2)
|
|
6973
|
+
query2.$or = searchMatch2.$or;
|
|
6975
6974
|
const subscriptionMatch = {};
|
|
6976
6975
|
if (type) {
|
|
6977
6976
|
subscriptionMatch["subscription.type"] = type;
|
|
@@ -84317,6 +84316,8 @@ var Period = /* @__PURE__ */ ((Period2) => {
|
|
|
84317
84316
|
Period2["THIS_MONTH"] = "thisMonth";
|
|
84318
84317
|
return Period2;
|
|
84319
84318
|
})(Period || {});
|
|
84319
|
+
var WORK_ORDER_DELETED = ["Deleted", "deleted"];
|
|
84320
|
+
var WORK_ORDER_NOT_OPEN = ["Completed", ...WORK_ORDER_DELETED];
|
|
84320
84321
|
function useNewDashboardRepo() {
|
|
84321
84322
|
const db2 = import_node_server_utils252.useAtlas.getDb();
|
|
84322
84323
|
if (!db2) {
|
|
@@ -84418,7 +84419,7 @@ function useNewDashboardRepo() {
|
|
|
84418
84419
|
$match: {
|
|
84419
84420
|
site: { $in: [siteIdObj, siteId] },
|
|
84420
84421
|
service: "Security",
|
|
84421
|
-
status: { $nin:
|
|
84422
|
+
status: { $nin: WORK_ORDER_NOT_OPEN }
|
|
84422
84423
|
}
|
|
84423
84424
|
},
|
|
84424
84425
|
{
|
|
@@ -84450,7 +84451,7 @@ function useNewDashboardRepo() {
|
|
|
84450
84451
|
site: { $in: [siteIdObj, siteId] },
|
|
84451
84452
|
service: "Security",
|
|
84452
84453
|
createdAt: priorPeriodRange,
|
|
84453
|
-
status: { $nin:
|
|
84454
|
+
status: { $nin: WORK_ORDER_NOT_OPEN }
|
|
84454
84455
|
}
|
|
84455
84456
|
},
|
|
84456
84457
|
{ $count: "count" }
|
|
@@ -84461,7 +84462,7 @@ function useNewDashboardRepo() {
|
|
|
84461
84462
|
site: { $in: [siteIdObj, siteId] },
|
|
84462
84463
|
service: "Security",
|
|
84463
84464
|
createdAt: periodRange,
|
|
84464
|
-
status: { $nin:
|
|
84465
|
+
status: { $nin: WORK_ORDER_NOT_OPEN }
|
|
84465
84466
|
}
|
|
84466
84467
|
},
|
|
84467
84468
|
{ $count: "count" }
|
|
@@ -84821,7 +84822,7 @@ function useNewDashboardRepo() {
|
|
|
84821
84822
|
{
|
|
84822
84823
|
$match: {
|
|
84823
84824
|
site: { $in: [siteIdObj, siteId] },
|
|
84824
|
-
status: { $nin:
|
|
84825
|
+
status: { $nin: WORK_ORDER_NOT_OPEN }
|
|
84825
84826
|
}
|
|
84826
84827
|
},
|
|
84827
84828
|
{
|
|
@@ -84852,7 +84853,7 @@ function useNewDashboardRepo() {
|
|
|
84852
84853
|
$match: {
|
|
84853
84854
|
site: { $in: [siteIdObj, siteId] },
|
|
84854
84855
|
createdAt: priorPeriodRange,
|
|
84855
|
-
status: { $nin:
|
|
84856
|
+
status: { $nin: WORK_ORDER_NOT_OPEN }
|
|
84856
84857
|
}
|
|
84857
84858
|
},
|
|
84858
84859
|
{ $count: "count" }
|
|
@@ -84862,7 +84863,7 @@ function useNewDashboardRepo() {
|
|
|
84862
84863
|
$match: {
|
|
84863
84864
|
site: { $in: [siteIdObj, siteId] },
|
|
84864
84865
|
createdAt: periodRange,
|
|
84865
|
-
status: { $nin:
|
|
84866
|
+
status: { $nin: WORK_ORDER_NOT_OPEN }
|
|
84866
84867
|
}
|
|
84867
84868
|
},
|
|
84868
84869
|
{ $count: "count" }
|
|
@@ -85046,7 +85047,8 @@ function useNewDashboardRepo() {
|
|
|
85046
85047
|
{
|
|
85047
85048
|
$match: {
|
|
85048
85049
|
site: { $in: [siteIdObj, siteId] },
|
|
85049
|
-
createdAt: periodRange
|
|
85050
|
+
createdAt: periodRange,
|
|
85051
|
+
status: { $nin: WORK_ORDER_DELETED }
|
|
85050
85052
|
}
|
|
85051
85053
|
},
|
|
85052
85054
|
{
|
|
@@ -85208,7 +85210,7 @@ function useNewDashboardRepo() {
|
|
|
85208
85210
|
const workOrderService = workOrderServiceMap[serviceType] ?? serviceType;
|
|
85209
85211
|
const workOrderMatchQuery = {
|
|
85210
85212
|
site,
|
|
85211
|
-
status: { $nin:
|
|
85213
|
+
status: { $nin: WORK_ORDER_NOT_OPEN }
|
|
85212
85214
|
};
|
|
85213
85215
|
if (serviceType !== "property_management_agency") {
|
|
85214
85216
|
workOrderMatchQuery.service = workOrderService;
|
|
@@ -85384,7 +85386,7 @@ function useNewDashboardRepo() {
|
|
|
85384
85386
|
try {
|
|
85385
85387
|
const workOrderQuery = {
|
|
85386
85388
|
site,
|
|
85387
|
-
status: { $nin:
|
|
85389
|
+
status: { $nin: WORK_ORDER_DELETED },
|
|
85388
85390
|
$or: [
|
|
85389
85391
|
{ createdAt: { $gte: rangeStart, $lte: rangeEnd } },
|
|
85390
85392
|
{
|