updated the KYC
This commit is contained in:
parent
c82b44ce33
commit
57d02d2c49
@ -111,7 +111,7 @@ export const getAllKyc = async (req, res) => {
|
|||||||
try {
|
try {
|
||||||
// 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()
|
const kycs = await KYC.find({ principal_distributer: req.user._id })
|
||||||
.populate("principal_distributer", "name")
|
.populate("principal_distributer", "name")
|
||||||
.populate("addedBy");
|
.populate("addedBy");
|
||||||
// console.log(kycs);
|
// console.log(kycs);
|
||||||
@ -193,6 +193,9 @@ export const updateKycStatus = async (req, res) => {
|
|||||||
if (!kyc) {
|
if (!kyc) {
|
||||||
return res.status(404).json({ message: "KYC record not found" });
|
return res.status(404).json({ message: "KYC record not found" });
|
||||||
}
|
}
|
||||||
|
if (kyc.principal_distributer.toString() !== req.user._id.toString()) {
|
||||||
|
return res.status(403).json({ message: "Access denied" });
|
||||||
|
}
|
||||||
|
|
||||||
// Update the status
|
// Update the status
|
||||||
if (status) {
|
if (status) {
|
||||||
|
Loading…
Reference in New Issue
Block a user