connection-request issue

master
Bhaskara Kishore 3 years ago
parent 94af513b6e
commit 97994a556f

@ -11,7 +11,10 @@ const fastify = require("fastify")({
// Handle friend request creation // Handle friend request creation
exports.friendRequest = async (request, reply) => { exports.friendRequest = async (request, reply) => {
try { try {
const { senderId, receiverId } = request.body; // const { senderId, receiverId } = request.body;
const customerId = request.body.customerId;
const supplierId = request.body.supplierId;
// Check if the sender and receiver exist in the database // Check if the sender and receiver exist in the database
// const sender = await User.findById(senderId); // const sender = await User.findById(senderId);
@ -19,8 +22,8 @@ exports.friendRequest = async (request, reply) => {
// console.log("sender" , sender) // console.log("sender" , sender)
// console.log("receiver" , receiver) // console.log("receiver" , receiver)
const sender = await User.findOne(senderId); const sender = await User.findOne({ customerId : customerId});
const receiver = await Supplier.findOne(receiverId); const receiver = await Supplier.findOne({ supplierId : supplierId});
console.log("sender" , sender.customerId) console.log("sender" , sender.customerId)
console.log("receiver" , receiver.supplierId) console.log("receiver" , receiver.supplierId)

@ -46,7 +46,7 @@ const userSchema = new mongoose.Schema(
username: { type: String }, username: { type: String },
phone: { type: String, unique: true, trim: true }, phone: { type: String, unique: true, trim: true },
address: String, address: String,
customerId: String, customerId: { type: String },
buildingName: String, buildingName: String,
inchargeName: String, inchargeName: String,
phoneVerified: { type: Boolean, default: false }, phoneVerified: { type: Boolean, default: false },

Loading…
Cancel
Save