sorted the notification by latest
This commit is contained in:
parent
2d1e461510
commit
5f131818d5
@ -134,6 +134,7 @@ export const getAllKycRejected = async (req, res) => {
|
|||||||
// console.log("req came here ");
|
// console.log("req came here ");
|
||||||
|
|
||||||
const kycs = await KYC.find({ status: "reject", addedBy: req.user._id })
|
const kycs = await KYC.find({ status: "reject", addedBy: req.user._id })
|
||||||
|
.sort({ createdAt: -1 })
|
||||||
.populate("principal_distributer", "name")
|
.populate("principal_distributer", "name")
|
||||||
.populate("addedBy");
|
.populate("addedBy");
|
||||||
// console.log(kycs);
|
// console.log(kycs);
|
||||||
@ -151,6 +152,7 @@ export const getAllKycApproved = async (req, res) => {
|
|||||||
// Fetch all KYC documents from the database
|
// Fetch all KYC documents from the database
|
||||||
// console.log("req came here ");
|
// console.log("req came here ");
|
||||||
const kycs = await KYC.find({ status: "approved" })
|
const kycs = await KYC.find({ status: "approved" })
|
||||||
|
.sort({ createdAt: -1 })
|
||||||
.populate("principal_distributer", "name")
|
.populate("principal_distributer", "name")
|
||||||
.populate("addedBy");
|
.populate("addedBy");
|
||||||
// console.log(kycs);
|
// console.log(kycs);
|
||||||
|
@ -8,7 +8,9 @@ export const getNotification = async (req, res) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fetch notifications for the user
|
// 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) {
|
if (notifications && notifications.length > 0) {
|
||||||
return res
|
return res
|
||||||
|
Loading…
Reference in New Issue
Block a user