RD map with TM,PD,SC

This commit is contained in:
Sibunnayak 2024-09-12 17:57:09 +05:30
parent 11848e7b6b
commit d602fdc7be

View File

@ -430,10 +430,10 @@ export const getAllRetailDistributorApproved = async (req, res) => {
export const getRDId = async (req, res) => { export const getRDId = async (req, res) => {
try { try {
const { id } = req.params; const { id } = req.params;
console.log(id); // console.log(id);
// Fetch the KYC document from the database by ID // Fetch the KYC document from the database by ID
const RD = await RetailDistributor.findById(id) const RD = await RetailDistributor.findById(id)
.populate("principal_distributer", "name") .populate("principal_distributer", "name email phone")
.populate("addedBy") .populate("addedBy")
.populate("kyc") .populate("kyc")
.populate("mappedTM") .populate("mappedTM")
@ -443,7 +443,7 @@ export const getRDId = async (req, res) => {
if (!RD) { if (!RD) {
return res.status(404).json({ message: "No RetailDistributor found" }); return res.status(404).json({ message: "No RetailDistributor found" });
} }
// console.log(RD);
// Send the fetched KYC document as a response // Send the fetched KYC document as a response
res.status(200).json(RD); res.status(200).json(RD);
} catch (error) { } catch (error) {
@ -1150,7 +1150,7 @@ export const updateRDMapped = async (req, res) => {
try { try {
const { id } = req.params; const { id } = req.params;
const { principal_distributor, mappedTM, mappedSC } = req.body; const { principal_distributor, mappedTM, mappedSC } = req.body;
console.log(principal_distributor); // console.log(principal_distributor);
// Find the RetailDistributor document by ID // Find the RetailDistributor document by ID
const RD = await RetailDistributor.findById(id); const RD = await RetailDistributor.findById(id);