Delete record from the database

Viewed 12

exports.deleteDiscount = async (deleteData, cb) => { if(!data.vendorId || !data.discounts || !data.couponCode || !data.discountLimit || !data.discountValue){ return cb({

        message: "Please check venderId",
        status: 401
    },null);
} else {
        message: "Record is Deleted"
        console.log("error");
    }
    
    discountMasterSchema.findOneAndDelete({vendorId: data.vendorId, couponCode: data.couponCode})
    .then((resp) => {
        if(resp) {
            return cb({
                message:"Coupon is deleted",
                status: 200
            },null);
        } 
    })
}
0 Answers
Related