@7365admin1/core 3.34.4-staging.22 → 3.35.1-staging.23
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 -0
- package/dist/index.js +44 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -2498,6 +2498,7 @@ declare function useSiteCameraRepo(): {
|
|
|
2498
2498
|
category?: string;
|
|
2499
2499
|
direction?: string;
|
|
2500
2500
|
}) => Promise<{}>;
|
|
2501
|
+
getCamerasBySiteId: (site: string | ObjectId) => Promise<Array<TSiteCamera>>;
|
|
2501
2502
|
delCachedData: () => void;
|
|
2502
2503
|
getBySiteGuardPost: (site: string | ObjectId, guardPost: number) => Promise<{} | null>;
|
|
2503
2504
|
updateById: (_id: string | ObjectId, value: Partial<Pick<TSiteCamera, "host" | "username" | "password" | "category" | "guardPost" | "updatedAt">>, session?: ClientSession) => Promise<string>;
|
|
@@ -3132,6 +3133,7 @@ declare function usePersonRepo(): {
|
|
|
3132
3133
|
getById: (_id: string | ObjectId) => Promise<TPerson | null>;
|
|
3133
3134
|
createTextIndex: () => Promise<void>;
|
|
3134
3135
|
getPersonByPlateNumber: (plateNumber: string) => Promise<TPerson | null>;
|
|
3136
|
+
getApprovedPersonByPlateNumber: (plateNumber: string, excludePersonId?: string | ObjectId) => Promise<TPerson | null>;
|
|
3135
3137
|
getByNRIC: (value: string) => Promise<TPerson | null>;
|
|
3136
3138
|
createIndexes: () => Promise<void>;
|
|
3137
3139
|
getPersonByPhoneNumber: (value: string) => Promise<TPerson | null>;
|
package/dist/index.js
CHANGED
|
@@ -24812,6 +24812,18 @@ function useSiteCameraRepo() {
|
|
|
24812
24812
|
throw new import_node_server_utils73.BadRequestError("Failed to retrieve site cameras.");
|
|
24813
24813
|
}
|
|
24814
24814
|
}
|
|
24815
|
+
async function getCamerasBySiteId(site) {
|
|
24816
|
+
const _site = (0, import_node_server_utils73.toObjectId)(site);
|
|
24817
|
+
try {
|
|
24818
|
+
const items = await collection.find({ site: _site, status: "active", type: "anpr" }).toArray();
|
|
24819
|
+
return items;
|
|
24820
|
+
} catch (error) {
|
|
24821
|
+
if (error instanceof import_node_server_utils73.BadRequestError) {
|
|
24822
|
+
throw error;
|
|
24823
|
+
}
|
|
24824
|
+
throw new import_node_server_utils73.BadRequestError("Failed to retrieve site cameras.");
|
|
24825
|
+
}
|
|
24826
|
+
}
|
|
24815
24827
|
async function getBySiteGuardPost(site, guardPost) {
|
|
24816
24828
|
try {
|
|
24817
24829
|
site = new import_mongodb44.ObjectId(site);
|
|
@@ -25168,6 +25180,7 @@ function useSiteCameraRepo() {
|
|
|
25168
25180
|
getBySite,
|
|
25169
25181
|
getVisitorsInBySite,
|
|
25170
25182
|
getBySites,
|
|
25183
|
+
getCamerasBySiteId,
|
|
25171
25184
|
delCachedData,
|
|
25172
25185
|
getBySiteGuardPost,
|
|
25173
25186
|
updateById,
|
|
@@ -25511,6 +25524,22 @@ function usePersonRepo() {
|
|
|
25511
25524
|
);
|
|
25512
25525
|
}
|
|
25513
25526
|
}
|
|
25527
|
+
async function getApprovedPersonByPlateNumber(plateNumber, excludePersonId) {
|
|
25528
|
+
try {
|
|
25529
|
+
const query = {
|
|
25530
|
+
plateNumber,
|
|
25531
|
+
status: "approved"
|
|
25532
|
+
};
|
|
25533
|
+
if (excludePersonId) {
|
|
25534
|
+
query._id = { $ne: (0, import_node_server_utils74.toObjectId)(excludePersonId) };
|
|
25535
|
+
}
|
|
25536
|
+
return await collection.findOne(query);
|
|
25537
|
+
} catch (error) {
|
|
25538
|
+
throw new import_node_server_utils74.InternalServerError(
|
|
25539
|
+
"Failed to fetch approved person by plate number."
|
|
25540
|
+
);
|
|
25541
|
+
}
|
|
25542
|
+
}
|
|
25514
25543
|
async function getByNRIC(value) {
|
|
25515
25544
|
try {
|
|
25516
25545
|
if (!value || value.trim() === "") {
|
|
@@ -25916,6 +25945,7 @@ function usePersonRepo() {
|
|
|
25916
25945
|
getById,
|
|
25917
25946
|
createTextIndex,
|
|
25918
25947
|
getPersonByPlateNumber,
|
|
25948
|
+
getApprovedPersonByPlateNumber,
|
|
25919
25949
|
getByNRIC,
|
|
25920
25950
|
createIndexes,
|
|
25921
25951
|
getPersonByPhoneNumber,
|
|
@@ -33887,6 +33917,7 @@ function usePersonService() {
|
|
|
33887
33917
|
updateById: _updateById,
|
|
33888
33918
|
getByUserId: _getByUserId,
|
|
33889
33919
|
reviewResidentPerson: _reviewResidentPerson,
|
|
33920
|
+
getApprovedPersonByPlateNumber,
|
|
33890
33921
|
addFromVisitor: _addFromVisitor,
|
|
33891
33922
|
findFirstTen
|
|
33892
33923
|
} = usePersonRepo();
|
|
@@ -33901,7 +33932,7 @@ function usePersonService() {
|
|
|
33901
33932
|
} = useUserRepo();
|
|
33902
33933
|
const { add: addMember } = useMemberRepo();
|
|
33903
33934
|
const { getById: _getUnitById, updateById: updateUnitById } = useBuildingUnitRepo();
|
|
33904
|
-
const { getAllCameraWithPassword: _getAllSiteCameras } = useSiteCameraRepo();
|
|
33935
|
+
const { getAllCameraWithPassword: _getAllSiteCameras, getCamerasBySiteId } = useSiteCameraRepo();
|
|
33905
33936
|
const { updateStatusById } = useFileRepo();
|
|
33906
33937
|
const { getById: getOrgById } = useOrgRepo();
|
|
33907
33938
|
const { getSiteById } = useSiteRepo();
|
|
@@ -33996,7 +34027,7 @@ function usePersonService() {
|
|
|
33996
34027
|
"./public/handlebars/registration-pending"
|
|
33997
34028
|
)
|
|
33998
34029
|
});
|
|
33999
|
-
mailer.sendMail({
|
|
34030
|
+
await mailer.sendMail({
|
|
34000
34031
|
to: value.email,
|
|
34001
34032
|
subject: "Registration Received \u2013 Pending Review",
|
|
34002
34033
|
html: emailContent,
|
|
@@ -34156,7 +34187,7 @@ function usePersonService() {
|
|
|
34156
34187
|
value.approvedBy.id = approvedBy._id;
|
|
34157
34188
|
}
|
|
34158
34189
|
const vehicle = {
|
|
34159
|
-
plateNumber: person.plateNumber
|
|
34190
|
+
plateNumber: person.plateNumber ?? "",
|
|
34160
34191
|
type: "whitelist",
|
|
34161
34192
|
category: person.type || "",
|
|
34162
34193
|
name: person.name,
|
|
@@ -34188,7 +34219,16 @@ function usePersonService() {
|
|
|
34188
34219
|
case "approved":
|
|
34189
34220
|
userStatus = "active";
|
|
34190
34221
|
if (person.plateNumber && person.plateNumber.trim() !== "") {
|
|
34191
|
-
await
|
|
34222
|
+
const anprCameraList = await getCamerasBySiteId(
|
|
34223
|
+
person.site.toString()
|
|
34224
|
+
);
|
|
34225
|
+
const existingPerson = await getApprovedPersonByPlateNumber(
|
|
34226
|
+
person.plateNumber,
|
|
34227
|
+
id
|
|
34228
|
+
);
|
|
34229
|
+
if (anprCameraList.length > 0 && !existingPerson) {
|
|
34230
|
+
await addVehicle(vehicle, session);
|
|
34231
|
+
}
|
|
34192
34232
|
}
|
|
34193
34233
|
title = "Your account has been approved";
|
|
34194
34234
|
hideLogin = false;
|