@7365admin1/core 3.50.1-staging.217 → 3.50.1-staging.218
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 +6 -0
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4557,6 +4557,12 @@ type TVisitorTransaction = {
|
|
|
4557
4557
|
createdBy?: string | ObjectId;
|
|
4558
4558
|
updatedBy?: string | ObjectId;
|
|
4559
4559
|
isMembersAdded?: boolean;
|
|
4560
|
+
approval?: {
|
|
4561
|
+
approvedBy?: string | ObjectId;
|
|
4562
|
+
status?: VisitorStatus;
|
|
4563
|
+
remarks?: string;
|
|
4564
|
+
approvedAt?: string | Date;
|
|
4565
|
+
};
|
|
4560
4566
|
};
|
|
4561
4567
|
declare const schemaVisitorTransaction: Joi.ObjectSchema<any>;
|
|
4562
4568
|
/**
|
package/dist/index.js
CHANGED
|
@@ -19707,7 +19707,18 @@ var schemaUpdateVisTrans = import_joi21.default.object({
|
|
|
19707
19707
|
contact: import_joi21.default.string().optional().allow(null, "")
|
|
19708
19708
|
})
|
|
19709
19709
|
).optional().allow(null),
|
|
19710
|
-
updatedBy: import_joi21.default.string().hex().length(24).optional()
|
|
19710
|
+
updatedBy: import_joi21.default.string().hex().length(24).optional(),
|
|
19711
|
+
// Audit trail for the Approve/Reject action on a self-service submission -
|
|
19712
|
+
// `status` here drives the transition (and is mirrored onto the top-level
|
|
19713
|
+
// `status` field by the controller, since that's what list/report queries
|
|
19714
|
+
// filter on); `approvedBy`/`approvedAt`/`remarks` are kept nested so the
|
|
19715
|
+
// "who/when/why" doesn't crowd the top-level document shape.
|
|
19716
|
+
approval: import_joi21.default.object({
|
|
19717
|
+
approvedBy: import_joi21.default.string().hex().length(24).optional().allow(null, ""),
|
|
19718
|
+
status: import_joi21.default.string().valid("approved" /* APPROVED */, "rejected" /* REJECTED */).optional(),
|
|
19719
|
+
remarks: import_joi21.default.string().optional().allow(null, ""),
|
|
19720
|
+
approvedAt: import_joi21.default.date().iso().optional()
|
|
19721
|
+
}).optional()
|
|
19711
19722
|
});
|
|
19712
19723
|
function MVisitorTransaction(value) {
|
|
19713
19724
|
const { error } = schemaVisitorTransaction.validate(value, {
|
|
@@ -54634,10 +54645,13 @@ function useVisitorTransactionController() {
|
|
|
54634
54645
|
return;
|
|
54635
54646
|
}
|
|
54636
54647
|
try {
|
|
54637
|
-
const
|
|
54648
|
+
const approval = req.body.approval;
|
|
54649
|
+
const nextStatus = approval?.status ?? req.body.status;
|
|
54650
|
+
const remarks = approval?.remarks ?? req.body.remarks;
|
|
54638
54651
|
const isApprovalTransition = nextStatus === "approved" /* APPROVED */ || nextStatus === "rejected" /* REJECTED */;
|
|
54639
54652
|
const current = isApprovalTransition ? await _getVisitorTransactionById(_id) : null;
|
|
54640
|
-
|
|
54653
|
+
const updateBody = approval ? { ...req.body, status: nextStatus } : req.body;
|
|
54654
|
+
await _updateVisitorTransactionById(_id, updateBody);
|
|
54641
54655
|
if (isApprovalTransition && current && current.type === "guest" /* GUEST */ && current.email && current.status !== nextStatus) {
|
|
54642
54656
|
try {
|
|
54643
54657
|
if (nextStatus === "approved" /* APPROVED */) {
|
|
@@ -54672,7 +54686,7 @@ function useVisitorTransactionController() {
|
|
|
54672
54686
|
handlebar: "self-service-visitor-rejected",
|
|
54673
54687
|
context: {
|
|
54674
54688
|
name: current.name,
|
|
54675
|
-
remarks:
|
|
54689
|
+
remarks: remarks || ""
|
|
54676
54690
|
}
|
|
54677
54691
|
});
|
|
54678
54692
|
await sendEmail({
|