Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

253
Views
Please help me implement the logic code for depositing and withdrawing in node.js and mongodb

am creating the logic that allows user to deposit money and withdraw money in node.js with mongodb. But I try my little knowledge to make it works, and I can't seems to bring the logic correctly. below is my code that I'm trying to deposit please help me as mynknowledge seems insufficient curently.

Below is code:

  import User from "../models/user.js"

export const depositSlip = async (req, res) => {
    const { accountNo, name, amount } = req.body;
    
    try {
        
        const deposit = await User.findOne({ accountNo, name });

        if(!accountNo === name ) {
            return res.status(404).json({ message: "Account details does not match" }) 
        } else {
            deposit
        }
        
        if (!deposit) return res.status(404).json({ message: "Account Number does not exsit" }) 

        await deposit.save({ amount })
        
    } catch (err) {
        
    }
}

please I don't even know if I'm creating the logic right but please take it as if you are teaching some one a new and guide me through.

And as for the withdrawal code, I don't even implement it because I haven't finished the depositing cod first. please come to my rescue, I know am asking a a lot from you of your time, but this is really important for me to create this. So, please help Thank you.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!