@7365admin1/core 3.102.1 → 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 +6 -0
- package/dist/index.js +18 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/test/e2e/org-and-promo-list-scope.e2e.test.mjs +44 -5
- package/test/org-search.test.mjs +41 -0
package/dist/index.mjs
CHANGED
|
@@ -5593,6 +5593,17 @@ function MOrg(value) {
|
|
|
5593
5593
|
|
|
5594
5594
|
// src/repositories/organization.repo.ts
|
|
5595
5595
|
import { ObjectId as ObjectId20 } from "mongodb";
|
|
5596
|
+
|
|
5597
|
+
// src/utils/org-search.util.ts
|
|
5598
|
+
function orgSearchMatch(search) {
|
|
5599
|
+
const term = typeof search === "string" ? search.trim() : "";
|
|
5600
|
+
if (!term)
|
|
5601
|
+
return null;
|
|
5602
|
+
const pattern = { $regex: term.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), $options: "i" };
|
|
5603
|
+
return { $or: [{ name: pattern }, { email: pattern }] };
|
|
5604
|
+
}
|
|
5605
|
+
|
|
5606
|
+
// src/repositories/organization.repo.ts
|
|
5596
5607
|
var DUPLICATE_FIELD_LABEL = {
|
|
5597
5608
|
name: "name",
|
|
5598
5609
|
email: "email address"
|
|
@@ -5754,9 +5765,10 @@ function useOrgRepo() {
|
|
|
5754
5765
|
query2.$or = reach;
|
|
5755
5766
|
cacheOptions.scope = `${ids2.join(",")}|${email.toLowerCase()}`;
|
|
5756
5767
|
}
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5768
|
+
const searchMatch2 = orgSearchMatch(search);
|
|
5769
|
+
if (searchMatch2) {
|
|
5770
|
+
query2.$and = [searchMatch2];
|
|
5771
|
+
cacheOptions.substring = search.trim().toLowerCase();
|
|
5760
5772
|
}
|
|
5761
5773
|
if (nature) {
|
|
5762
5774
|
query2.nature = nature;
|
|
@@ -6018,22 +6030,9 @@ function useOrgRepo() {
|
|
|
6018
6030
|
const query2 = {
|
|
6019
6031
|
status
|
|
6020
6032
|
};
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
name: {
|
|
6025
|
-
$regex: search,
|
|
6026
|
-
$options: "i"
|
|
6027
|
-
}
|
|
6028
|
-
},
|
|
6029
|
-
{
|
|
6030
|
-
email: {
|
|
6031
|
-
$regex: search,
|
|
6032
|
-
$options: "i"
|
|
6033
|
-
}
|
|
6034
|
-
}
|
|
6035
|
-
];
|
|
6036
|
-
}
|
|
6033
|
+
const searchMatch2 = orgSearchMatch(search);
|
|
6034
|
+
if (searchMatch2)
|
|
6035
|
+
query2.$or = searchMatch2.$or;
|
|
6037
6036
|
const subscriptionMatch = {};
|
|
6038
6037
|
if (type) {
|
|
6039
6038
|
subscriptionMatch["subscription.type"] = type;
|