@7365admin1/core 3.50.1-staging.218 → 3.50.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 +0 -6
- package/dist/index.js +4 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/.changeset/site-camera-enum-validation.md +0 -5
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -4557,12 +4557,6 @@ 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
|
-
};
|
|
4566
4560
|
};
|
|
4567
4561
|
declare const schemaVisitorTransaction: Joi.ObjectSchema<any>;
|
|
4568
4562
|
/**
|
package/dist/index.js
CHANGED
|
@@ -19707,18 +19707,7 @@ 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()
|
|
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()
|
|
19710
|
+
updatedBy: import_joi21.default.string().hex().length(24).optional()
|
|
19722
19711
|
});
|
|
19723
19712
|
function MVisitorTransaction(value) {
|
|
19724
19713
|
const { error } = schemaVisitorTransaction.validate(value, {
|
|
@@ -54645,13 +54634,10 @@ function useVisitorTransactionController() {
|
|
|
54645
54634
|
return;
|
|
54646
54635
|
}
|
|
54647
54636
|
try {
|
|
54648
|
-
const
|
|
54649
|
-
const nextStatus = approval?.status ?? req.body.status;
|
|
54650
|
-
const remarks = approval?.remarks ?? req.body.remarks;
|
|
54637
|
+
const nextStatus = req.body.status;
|
|
54651
54638
|
const isApprovalTransition = nextStatus === "approved" /* APPROVED */ || nextStatus === "rejected" /* REJECTED */;
|
|
54652
54639
|
const current = isApprovalTransition ? await _getVisitorTransactionById(_id) : null;
|
|
54653
|
-
|
|
54654
|
-
await _updateVisitorTransactionById(_id, updateBody);
|
|
54640
|
+
await _updateVisitorTransactionById(_id, req.body);
|
|
54655
54641
|
if (isApprovalTransition && current && current.type === "guest" /* GUEST */ && current.email && current.status !== nextStatus) {
|
|
54656
54642
|
try {
|
|
54657
54643
|
if (nextStatus === "approved" /* APPROVED */) {
|
|
@@ -54686,7 +54672,7 @@ function useVisitorTransactionController() {
|
|
|
54686
54672
|
handlebar: "self-service-visitor-rejected",
|
|
54687
54673
|
context: {
|
|
54688
54674
|
name: current.name,
|
|
54689
|
-
remarks: remarks || ""
|
|
54675
|
+
remarks: req.body.remarks || ""
|
|
54690
54676
|
}
|
|
54691
54677
|
});
|
|
54692
54678
|
await sendEmail({
|