@eeplatform/core 1.0.1 → 1.0.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.d.ts +3 -3
- package/dist/index.js +25 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -42
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11703,10 +11703,12 @@ var MUser = class {
|
|
|
11703
11703
|
this.createdAt = value.createdAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
11704
11704
|
this.updatedAt = value.updatedAt ?? "";
|
|
11705
11705
|
this.deletedAt = value.deletedAt ?? "";
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
|
|
11706
|
+
if (value.defaultOrg) {
|
|
11707
|
+
try {
|
|
11708
|
+
value.defaultOrg = new ObjectId3(value.defaultOrg);
|
|
11709
|
+
} catch (error) {
|
|
11710
|
+
throw new Error("Invalid defaultOrg ID.");
|
|
11711
|
+
}
|
|
11710
11712
|
}
|
|
11711
11713
|
this.defaultOrg = value.defaultOrg;
|
|
11712
11714
|
}
|
|
@@ -12763,9 +12765,6 @@ function useVerificationService() {
|
|
|
12763
12765
|
if (!metadata.app) {
|
|
12764
12766
|
throw new BadRequestError6("App metadata is required.");
|
|
12765
12767
|
}
|
|
12766
|
-
if (!metadata.org || !metadata.orgName) {
|
|
12767
|
-
throw new BadRequestError6("Organization metadata is required.");
|
|
12768
|
-
}
|
|
12769
12768
|
try {
|
|
12770
12769
|
const user = await getUserByEmail(email);
|
|
12771
12770
|
const dir = __dirname;
|
|
@@ -12777,7 +12776,7 @@ function useVerificationService() {
|
|
|
12777
12776
|
context: {
|
|
12778
12777
|
validity: VERIFICATION_USER_INVITE_DURATION,
|
|
12779
12778
|
link: `${APP_MAIN}/verify/member-invite/${res2}`,
|
|
12780
|
-
organization_name: metadata.orgName
|
|
12779
|
+
organization_name: metadata.app === "admin" ? "Admin" : metadata.orgName
|
|
12781
12780
|
},
|
|
12782
12781
|
filePath: filePath2
|
|
12783
12782
|
});
|
|
@@ -12948,11 +12947,6 @@ function useVerificationService() {
|
|
|
12948
12947
|
"App metadata is required for member invite."
|
|
12949
12948
|
);
|
|
12950
12949
|
}
|
|
12951
|
-
if (!_id.metadata?.org || !_id.metadata?.orgName) {
|
|
12952
|
-
throw new BadRequestError6(
|
|
12953
|
-
"Organization metadata is required for member invite."
|
|
12954
|
-
);
|
|
12955
|
-
}
|
|
12956
12950
|
if (!_id.metadata?.role || !_id.metadata?.roleName) {
|
|
12957
12951
|
throw new BadRequestError6(
|
|
12958
12952
|
"Role metadata is required for member invite."
|
|
@@ -12962,8 +12956,8 @@ function useVerificationService() {
|
|
|
12962
12956
|
{
|
|
12963
12957
|
user: user._id?.toString() ?? "",
|
|
12964
12958
|
type: _id.metadata?.app,
|
|
12965
|
-
org: _id.metadata?.org,
|
|
12966
|
-
orgName: _id.metadata?.orgName,
|
|
12959
|
+
org: _id.metadata?.org ?? "",
|
|
12960
|
+
orgName: _id.metadata?.orgName ?? "",
|
|
12967
12961
|
role: _id.metadata?.role,
|
|
12968
12962
|
roleName: _id.metadata?.roleName,
|
|
12969
12963
|
name: `${user.firstName} ${user.lastName}`
|
|
@@ -13086,8 +13080,8 @@ function useVerificationController() {
|
|
|
13086
13080
|
app: Joi2.string().required(),
|
|
13087
13081
|
role: Joi2.string().hex().required(),
|
|
13088
13082
|
roleName: Joi2.string().required(),
|
|
13089
|
-
org: Joi2.string().
|
|
13090
|
-
orgName: Joi2.string().
|
|
13083
|
+
org: Joi2.string().hex().optional().optional().allow("", null),
|
|
13084
|
+
orgName: Joi2.string().optional().optional().allow("", null)
|
|
13091
13085
|
});
|
|
13092
13086
|
const { error } = validation.validate(req.body);
|
|
13093
13087
|
if (error) {
|
|
@@ -17931,9 +17925,6 @@ function useUserService() {
|
|
|
17931
17925
|
throw new BadRequestError11("Invitation expired.");
|
|
17932
17926
|
}
|
|
17933
17927
|
const email = invitation.email;
|
|
17934
|
-
if (!invitation.metadata.org) {
|
|
17935
|
-
throw new BadRequestError11("Invitation does not have an organization.");
|
|
17936
|
-
}
|
|
17937
17928
|
const _user = await getUserByEmail(invitation.email);
|
|
17938
17929
|
let userId = _user?._id ?? "";
|
|
17939
17930
|
if (!_user) {
|
|
@@ -17958,8 +17949,8 @@ function useUserService() {
|
|
|
17958
17949
|
role: invitation.metadata?.role,
|
|
17959
17950
|
roleName: invitation.metadata?.roleName,
|
|
17960
17951
|
type: invitation.metadata?.app,
|
|
17961
|
-
org: invitation.metadata?.org,
|
|
17962
|
-
orgName: invitation.metadata?.orgName
|
|
17952
|
+
org: invitation.metadata?.org ?? "",
|
|
17953
|
+
orgName: invitation.metadata?.orgName ?? ""
|
|
17963
17954
|
},
|
|
17964
17955
|
session
|
|
17965
17956
|
);
|
|
@@ -26608,8 +26599,8 @@ function useSchoolRepo() {
|
|
|
26608
26599
|
limit = 20,
|
|
26609
26600
|
sort = {},
|
|
26610
26601
|
status = "active",
|
|
26611
|
-
|
|
26612
|
-
|
|
26602
|
+
org = "",
|
|
26603
|
+
app = "admin",
|
|
26613
26604
|
search = ""
|
|
26614
26605
|
} = {}) {
|
|
26615
26606
|
page = Math.max(0, page - 1);
|
|
@@ -26627,20 +26618,12 @@ function useSchoolRepo() {
|
|
|
26627
26618
|
query.$text = { $search: search };
|
|
26628
26619
|
cacheKeyOptions.search = search;
|
|
26629
26620
|
}
|
|
26630
|
-
if (
|
|
26631
|
-
try {
|
|
26632
|
-
query.region = new ObjectId38(region);
|
|
26633
|
-
cacheKeyOptions.region = region;
|
|
26634
|
-
} catch (error) {
|
|
26635
|
-
throw new BadRequestError56("Invalid region.");
|
|
26636
|
-
}
|
|
26637
|
-
}
|
|
26638
|
-
if (division) {
|
|
26621
|
+
if (org) {
|
|
26639
26622
|
try {
|
|
26640
|
-
query
|
|
26641
|
-
cacheKeyOptions
|
|
26623
|
+
query[app] = new ObjectId38(org);
|
|
26624
|
+
cacheKeyOptions[app] = org;
|
|
26642
26625
|
} catch (error) {
|
|
26643
|
-
throw new BadRequestError56("Invalid
|
|
26626
|
+
throw new BadRequestError56("Invalid org.");
|
|
26644
26627
|
}
|
|
26645
26628
|
}
|
|
26646
26629
|
try {
|
|
@@ -26930,8 +26913,8 @@ function useSchoolController() {
|
|
|
26930
26913
|
sort: Joi32.string().optional().allow(null, ""),
|
|
26931
26914
|
sortOrder: Joi32.string().optional().allow(null, ""),
|
|
26932
26915
|
status: Joi32.string().optional().allow(null, ""),
|
|
26933
|
-
|
|
26934
|
-
|
|
26916
|
+
org: Joi32.string().hex().optional().allow(null, ""),
|
|
26917
|
+
app: Joi32.string().optional().allow(null, ""),
|
|
26935
26918
|
search: Joi32.string().optional().allow(null, "")
|
|
26936
26919
|
});
|
|
26937
26920
|
const { error } = validation.validate(req.query);
|
|
@@ -26951,8 +26934,8 @@ function useSchoolController() {
|
|
|
26951
26934
|
});
|
|
26952
26935
|
}
|
|
26953
26936
|
const status = req.query.status ?? "active";
|
|
26954
|
-
const
|
|
26955
|
-
const
|
|
26937
|
+
const org = req.query.org ?? "";
|
|
26938
|
+
const app = req.query.app ?? "admin";
|
|
26956
26939
|
const search = req.query.search ?? "";
|
|
26957
26940
|
try {
|
|
26958
26941
|
const schools = await _getAll({
|
|
@@ -26960,8 +26943,8 @@ function useSchoolController() {
|
|
|
26960
26943
|
limit,
|
|
26961
26944
|
sort: sortObj,
|
|
26962
26945
|
status,
|
|
26963
|
-
|
|
26964
|
-
|
|
26946
|
+
org,
|
|
26947
|
+
app,
|
|
26965
26948
|
search
|
|
26966
26949
|
});
|
|
26967
26950
|
res.status(200).json(schools);
|