updated KYC controller and modal
This commit is contained in:
parent
02f7e34fc6
commit
a7f75018ff
@ -17,7 +17,7 @@ export const createKyc = async (req, res) => {
|
||||
pan_number,
|
||||
aadhar_number,
|
||||
gst_number,
|
||||
addedBy,
|
||||
|
||||
notes,
|
||||
} = req.body;
|
||||
|
||||
@ -35,7 +35,7 @@ export const createKyc = async (req, res) => {
|
||||
}
|
||||
|
||||
if (!req?.user) return res.status(400).json({ message: "Please login!" });
|
||||
|
||||
const userType = req.userType;
|
||||
try {
|
||||
if (!mongoose.Types.ObjectId.isValid(req.user._id)) {
|
||||
return res.status(400).json({ message: "Please login again" });
|
||||
@ -90,6 +90,7 @@ export const createKyc = async (req, res) => {
|
||||
fertilizer_license_img: fertilizerLicenseImg || {},
|
||||
selfie_entrance_img: selfieEntranceImg,
|
||||
addedBy: req.user._id,
|
||||
userType: userType,
|
||||
notes,
|
||||
});
|
||||
|
||||
|
@ -84,11 +84,17 @@ const KycSchema = new Schema(
|
||||
rejection_reason: {
|
||||
type: String,
|
||||
},
|
||||
|
||||
addedBy: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: "SalesCoOrdinator",
|
||||
type: mongoose.Schema.Types.ObjectId,
|
||||
refPath: "userType",
|
||||
required: true,
|
||||
},
|
||||
userType: {
|
||||
type: String,
|
||||
required: true,
|
||||
enum: ["SalesCoOrdinator", "TerritoryManager"],
|
||||
},
|
||||
notes: [
|
||||
{
|
||||
message: {
|
||||
|
Loading…
Reference in New Issue
Block a user