diff --git a/resources/KYC/KycController.js b/resources/KYC/KycController.js index b0518d2..1b0e8ed 100644 --- a/resources/KYC/KycController.js +++ b/resources/KYC/KycController.js @@ -134,6 +134,7 @@ export const getAllKycRejected = async (req, res) => { // console.log("req came here "); const kycs = await KYC.find({ status: "reject", addedBy: req.user._id }) + .sort({ createdAt: -1 }) .populate("principal_distributer", "name") .populate("addedBy"); // console.log(kycs); @@ -151,6 +152,7 @@ export const getAllKycApproved = async (req, res) => { // Fetch all KYC documents from the database // console.log("req came here "); const kycs = await KYC.find({ status: "approved" }) + .sort({ createdAt: -1 }) .populate("principal_distributer", "name") .populate("addedBy"); // console.log(kycs); diff --git a/resources/Notification/notificationController.js b/resources/Notification/notificationController.js index d8945ed..957b239 100644 --- a/resources/Notification/notificationController.js +++ b/resources/Notification/notificationController.js @@ -8,7 +8,9 @@ export const getNotification = async (req, res) => { } // Fetch notifications for the user - const notifications = await Notification.find({ added_for: req.user._id }); + const notifications = await Notification.find({ + added_for: req.user._id, + }).sort({ createdAt: -1 }); if (notifications && notifications.length > 0) { return res