@7365admin1/core 3.32.2-staging.34 → 3.32.2-staging.36
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/dist/index.d.ts +2 -1
- package/dist/index.js +37 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1590,7 +1590,7 @@ declare function useServiceProviderRepo(): {
|
|
|
1590
1590
|
siteId?: string | ObjectId | undefined;
|
|
1591
1591
|
orgId?: string | ObjectId | undefined;
|
|
1592
1592
|
serviceProviderOrgId?: string | ObjectId | undefined;
|
|
1593
|
-
}) => Promise<{}
|
|
1593
|
+
}) => Promise<{}>;
|
|
1594
1594
|
updateStatusById: (_id: string | ObjectId, status: string) => Promise<mongodb.UpdateResult<bson.Document>>;
|
|
1595
1595
|
};
|
|
1596
1596
|
|
|
@@ -1598,6 +1598,7 @@ declare function useServiceProviderController(): {
|
|
|
1598
1598
|
createServiceProvider: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1599
1599
|
getServiceProviders: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1600
1600
|
getByProviderOrg: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1601
|
+
getByEmail: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1601
1602
|
getServiceProviderNames: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1602
1603
|
getServiceProviderTypes: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
1603
1604
|
getServiceProviderById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -19430,7 +19430,7 @@ function useServiceProviderRepo() {
|
|
|
19430
19430
|
import_node_server_utils56.logger.info(`Cache hit for key: ${cacheKey}`);
|
|
19431
19431
|
return cachedData;
|
|
19432
19432
|
}
|
|
19433
|
-
const data = await collection.
|
|
19433
|
+
const data = await collection.find(query).toArray();
|
|
19434
19434
|
setCache(cacheKey, data, 15 * 60).then(() => {
|
|
19435
19435
|
import_node_server_utils56.logger.info(`Cache set for key: ${cacheKey}`);
|
|
19436
19436
|
}).catch((err) => {
|
|
@@ -20285,6 +20285,7 @@ function useServiceProviderController() {
|
|
|
20285
20285
|
getServiceProviderById: _getServiceProviderById,
|
|
20286
20286
|
getServiceProviders: _getServiceProviders,
|
|
20287
20287
|
getByServiceProviderOrgIdType: _getByServiceProviderOrgIdType,
|
|
20288
|
+
getByEmail: _getByEmail,
|
|
20288
20289
|
updateStatusById: _updateStatusById
|
|
20289
20290
|
} = useServiceProviderRepo();
|
|
20290
20291
|
const { createServiceProvider: _createServiceProvider } = useServiceProviderService();
|
|
@@ -20523,10 +20524,34 @@ function useServiceProviderController() {
|
|
|
20523
20524
|
return;
|
|
20524
20525
|
}
|
|
20525
20526
|
}
|
|
20527
|
+
async function getByEmail(req, res, next) {
|
|
20528
|
+
const validation = import_joi31.default.object({
|
|
20529
|
+
email: import_joi31.default.string().email().required(),
|
|
20530
|
+
orgId: import_joi31.default.string().hex().optional().allow("", null),
|
|
20531
|
+
siteId: import_joi31.default.string().hex().optional().allow("", null),
|
|
20532
|
+
serviceProviderOrgId: import_joi31.default.string().hex().optional().allow("", null)
|
|
20533
|
+
});
|
|
20534
|
+
const { error, value } = validation.validate(req.query);
|
|
20535
|
+
if (error) {
|
|
20536
|
+
import_node_server_utils62.logger.log({ level: "error", message: error.message });
|
|
20537
|
+
next(new import_node_server_utils62.BadRequestError(error.message));
|
|
20538
|
+
return;
|
|
20539
|
+
}
|
|
20540
|
+
try {
|
|
20541
|
+
const data = await _getByEmail(value);
|
|
20542
|
+
res.json(data);
|
|
20543
|
+
return;
|
|
20544
|
+
} catch (error2) {
|
|
20545
|
+
import_node_server_utils62.logger.log({ level: "error", message: error2.message });
|
|
20546
|
+
next(error2);
|
|
20547
|
+
return;
|
|
20548
|
+
}
|
|
20549
|
+
}
|
|
20526
20550
|
return {
|
|
20527
20551
|
createServiceProvider,
|
|
20528
20552
|
getServiceProviders,
|
|
20529
20553
|
getByProviderOrg,
|
|
20554
|
+
getByEmail,
|
|
20530
20555
|
getServiceProviderNames,
|
|
20531
20556
|
getServiceProviderTypes,
|
|
20532
20557
|
getServiceProviderById,
|
|
@@ -25328,9 +25353,9 @@ function usePersonRepo() {
|
|
|
25328
25353
|
{ email: { $regex: search, $options: "i" } },
|
|
25329
25354
|
{ nric: { $regex: search, $options: "i" } },
|
|
25330
25355
|
{ "plates.plateNumber": { $regex: search, $options: "i" } },
|
|
25331
|
-
{ contact: { $regex: makeContainsRegex(
|
|
25332
|
-
{ contacts: { $regex: makeContainsRegex(
|
|
25333
|
-
{ plateNumbers: { $regex: makeContainsRegex(
|
|
25356
|
+
{ contact: { $regex: makeContainsRegex(search) } },
|
|
25357
|
+
{ contacts: { $regex: makeContainsRegex(search) } },
|
|
25358
|
+
{ plateNumbers: { $regex: makeContainsRegex(search) } }
|
|
25334
25359
|
]
|
|
25335
25360
|
},
|
|
25336
25361
|
...import_mongodb45.ObjectId.isValid(org) && { org: new import_mongodb45.ObjectId(org) },
|
|
@@ -35702,7 +35727,7 @@ function useVisitorTransactionService() {
|
|
|
35702
35727
|
value.unitName = unit?.name;
|
|
35703
35728
|
}
|
|
35704
35729
|
const { nric = "", name = "", contact = "", plateNumber = "", email = "", site = "", type = "guest", company, createdBy } = value;
|
|
35705
|
-
if (/^(guest|walk-in|contractor|delivery)$/.test(type)) {
|
|
35730
|
+
if (/^(guest|walk-in|contractor|delivery)$/.test(type) && site) {
|
|
35706
35731
|
await addUpdateFromVisitor({
|
|
35707
35732
|
nric,
|
|
35708
35733
|
name,
|
|
@@ -35933,7 +35958,7 @@ function useVisitorTransactionService() {
|
|
|
35933
35958
|
value.checkIn = isNaN(parsed.getTime()) ? null : parsed;
|
|
35934
35959
|
}
|
|
35935
35960
|
const { nric = "", name = "", contact = "", plateNumber = "", email = "", site = "", type = "guest", company, createdBy } = value;
|
|
35936
|
-
if (/^(guest|walk-in|contractor|delivery)$/.test(type) &&
|
|
35961
|
+
if (/^(guest|walk-in|contractor|delivery)$/.test(type) && site) {
|
|
35937
35962
|
await addUpdateFromVisitor({
|
|
35938
35963
|
nric,
|
|
35939
35964
|
name,
|
|
@@ -36117,7 +36142,9 @@ function useVisitorTransactionService() {
|
|
|
36117
36142
|
value.site,
|
|
36118
36143
|
session,
|
|
36119
36144
|
void 0,
|
|
36120
|
-
id
|
|
36145
|
+
id,
|
|
36146
|
+
void 0,
|
|
36147
|
+
true
|
|
36121
36148
|
);
|
|
36122
36149
|
item.receivedDate = /* @__PURE__ */ new Date();
|
|
36123
36150
|
item.status = "Not Returned" /* NOT_RETURNED */;
|
|
@@ -36166,7 +36193,9 @@ function useVisitorTransactionService() {
|
|
|
36166
36193
|
value.site,
|
|
36167
36194
|
session,
|
|
36168
36195
|
void 0,
|
|
36169
|
-
id
|
|
36196
|
+
id,
|
|
36197
|
+
void 0,
|
|
36198
|
+
true
|
|
36170
36199
|
);
|
|
36171
36200
|
item.receivedDate = /* @__PURE__ */ new Date();
|
|
36172
36201
|
item.status = "Not Returned" /* NOT_RETURNED */;
|