@7365admin1/core 3.53.0 → 3.53.1
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.d.ts +2 -1
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/e2e/role-site-scope.e2e.test.mjs +204 -0
package/dist/index.mjs
CHANGED
|
@@ -16002,7 +16002,8 @@ function useRoleRepo() {
|
|
|
16002
16002
|
limit = 10,
|
|
16003
16003
|
sort = {},
|
|
16004
16004
|
type = "",
|
|
16005
|
-
org = ""
|
|
16005
|
+
org = "",
|
|
16006
|
+
site = ""
|
|
16006
16007
|
}) {
|
|
16007
16008
|
page = page > 0 ? page - 1 : 0;
|
|
16008
16009
|
if (org && typeof org === "string" && org.length === 24) {
|
|
@@ -16012,8 +16013,19 @@ function useRoleRepo() {
|
|
|
16012
16013
|
throw new BadRequestError31("Invalid organization ID format.");
|
|
16013
16014
|
}
|
|
16014
16015
|
}
|
|
16016
|
+
if (site && typeof site === "string" && site.length === 24) {
|
|
16017
|
+
try {
|
|
16018
|
+
site = new ObjectId33(site);
|
|
16019
|
+
} catch (error) {
|
|
16020
|
+
throw new BadRequestError31("Invalid site ID format.");
|
|
16021
|
+
}
|
|
16022
|
+
}
|
|
16015
16023
|
const query2 = { status: "active", org };
|
|
16016
16024
|
const cacheOptions = { status: "active", org };
|
|
16025
|
+
if (site) {
|
|
16026
|
+
query2.$or = [{ site }, { site: "" }, { site: null }];
|
|
16027
|
+
cacheOptions.site = site.toString();
|
|
16028
|
+
}
|
|
16017
16029
|
sort = Object.keys(sort).length > 0 ? sort : { _id: -1 };
|
|
16018
16030
|
cacheOptions.sort = JSON.stringify(sort);
|
|
16019
16031
|
if (search) {
|
|
@@ -18588,7 +18600,8 @@ function useRoleController() {
|
|
|
18588
18600
|
page: Joi19.number().integer().min(1).allow("", null).default(1),
|
|
18589
18601
|
limit: Joi19.number().integer().min(1).max(100).allow("", null).default(10),
|
|
18590
18602
|
type: Joi19.string().optional().allow("", null),
|
|
18591
|
-
org: Joi19.string().hex().optional().allow("", null)
|
|
18603
|
+
org: Joi19.string().hex().optional().allow("", null),
|
|
18604
|
+
site: Joi19.string().hex().optional().allow("", null)
|
|
18592
18605
|
});
|
|
18593
18606
|
const query2 = { ...req.query };
|
|
18594
18607
|
const { error } = validation.validate(query2);
|
|
@@ -18602,11 +18615,12 @@ function useRoleController() {
|
|
|
18602
18615
|
const limit = parseInt(req.query.limit ?? "10");
|
|
18603
18616
|
const type = req.query.type ?? "";
|
|
18604
18617
|
const org = req.query.org ?? "";
|
|
18618
|
+
const site = req.query.site ?? "";
|
|
18605
18619
|
try {
|
|
18606
18620
|
if (org) {
|
|
18607
18621
|
await requireOrgReach(req, org);
|
|
18608
18622
|
}
|
|
18609
|
-
const data = await _getRoles({ search, page, limit, type, org });
|
|
18623
|
+
const data = await _getRoles({ search, page, limit, type, org, site });
|
|
18610
18624
|
res.json(data);
|
|
18611
18625
|
return;
|
|
18612
18626
|
} catch (error2) {
|