|
|
|
@ -2066,3 +2066,27 @@ exports.acceptQuotation = async (req, reply) => {
|
|
|
|
|
return reply.status(500).send({ error: "Internal server error" });
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.getOrdersByStoreId = async (req, reply) => {
|
|
|
|
|
try {
|
|
|
|
|
const { storeId } = req.params;
|
|
|
|
|
|
|
|
|
|
if (!storeId) {
|
|
|
|
|
return reply.status(400).send({ error: "storeId is required" });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Fetch orders with the matching storeId
|
|
|
|
|
const orders = await Order.find({ storeId });
|
|
|
|
|
|
|
|
|
|
return reply.send({
|
|
|
|
|
status_code: 200,
|
|
|
|
|
message: "Orders fetched successfully",
|
|
|
|
|
data: orders,
|
|
|
|
|
});
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error("Error fetching orders:", err);
|
|
|
|
|
return reply.status(500).send({ error: "Internal server error" });
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|