diff --git a/src/handlers/supplierHandler.js b/src/handlers/supplierHandler.js index b91a8670..6eb556fd 100644 --- a/src/handlers/supplierHandler.js +++ b/src/handlers/supplierHandler.js @@ -1019,7 +1019,7 @@ exports.getPendingSuppliers = async (req, reply) => { ); console.log(supplierIdsToInclude, "SUPLIERINCLUDE"); const timestamps = friendRequests.map(request => - moment(request.timestamp).format("DD-MM-YYYY hh:mm:ss") + moment(request.timestamp, "DD-MM-YYYYTHH:mm:ss.SSSZ").format("DD-MM-YYYY hh:mm:ss") ); console.log(timestamps, "timestamps"); await Supplier.find({ supplierId: { $in: supplierIdsToInclude } }) @@ -1079,48 +1079,7 @@ exports.getRejectSuppliers = async (req, reply) => { } }; -// exports.getPendingCustomers = async (req, reply) => { -// const limit = parseInt(req.query.limit) || 100; -// const page = parseInt(req.query.page) || 1; -// const startindex = (page - 1) * limit; -// const supplierId = req.params.supplierId; // Assuming you have already authenticated the user and stored their ID in the request object -// try { -// const friendRequests = await FriendRequest.find({ -// supplierId, -// status: ["pending"], -// }); -// console.log(friendRequests, supplierId, "su...."); -// const supplierIdsToInclude = friendRequests.map( -// (request) => request.customerId -// ); -// console.log(supplierIdsToInclude, "supplierIdsToInclude.."); -// const timestamps = friendRequests.map((request) => request.timestamp); -// console.log(timestamps, "timestamps"); -// await User.find({ customerId: { $in: supplierIdsToInclude } }) -// .limit(limit) -// .skip(startindex) -// .exec() -// .then((docs) => { -// // const customerDataWithTimestamp = docs.map((doc, index) => ({ -// // data: doc, -// // //timestamp: timestamps[index], -// // })); -// reply.send({ status_code: 200, data: docs, count: docs.length }); -// // reply.send({ -// // status_code: 200, -// // data: customerDataWithTimestamp, -// // count: docs.length, -// // }); -// }) -// .catch((err) => { -// console.log(err); -// reply.send({ error: err }); -// }); -// } catch (err) { -// throw boom.boomify(err); -// } -// }; exports.getPendingCustomers = async (req, reply) => { const limit = parseInt(req.query.limit) || 100; @@ -1137,7 +1096,7 @@ exports.getPendingCustomers = async (req, reply) => { (request) => request.customerId ); const timestamps = friendRequests.map(request => - moment(request.timestamp).format("DD-MM-YYYY hh:mm:ss") + moment(request.timestamp, "DD-MM-YYYYTHH:mm:ss.SSSZ").format("DD-MM-YYYY hh:mm:ss") ); await User.find({ customerId: { $in: supplierIdsToInclude } }) .limit(limit)