/Pakam-Interview-Test-Task

Automated Deposit Notification System: A system that sends mobile notifications and emails to users when an automated deposit is missed due to insufficient funds in their primary money source (wallet)

Primary LanguageTypeScript

Pakam-Interview-Test-Task

Automated Deposit Notification System: A system that sends mobile notifications and emails to users when an automated deposit is missed due to insufficient funds in their primary money source (wallet)

STACKS USED: Node JS, Express & MongoDB (Typescript).

CODE WALKTHROUGHS: -After cloning from github. Do npm i to get all packages installed while working on the project.
-The index file holds the server created, and every other thing is connected to it like the main App config, database connection etc..
-There is an env file where i have my mongodb connection string (live and local) and my port
-In the main app config, my routes, middlewares and error handling were configured here.
-The config folder holds my database connection(Mongodb for my database) and envVariables(where the info in my .env file can be easily accessed)
-Models contains the details and sets up the logic buid up for this system where we have 3 models of users, wallet and history connected together
-The middleware folder contains the error handler codes()

  • The utils contains the Asynchandler() and the main App error where we get to define some errors ourselves using the httpcodes etc..
  • The validation folder validates the user sign up and sign in using joi package, and moves further to authenticate the auth process with the email verification flow
  • The email auth has 2 functions in it; the first is for the account(email) verification when users signs up. The second is an email for the notification of insufficient balance when the users makes an automated deposit with the notification type of email.

NB: The Verification_URL there should come from the frontend, the url of the page from the frontend. Got my Google ID, secret and refresh token from google console cloud for the email.

  • In my controllers, you can get all users in the system, get a single user details, Authenticate and Authorize a user(sign up, verify and sign in).
  • You can make a deposit and if your wallet balance is insufficient, you get an email notification else your transaction goes through
  • Also you can fund your wallet balance.
  • My routes contains the endpoint: (Depending on the port you set up for yourself, mine is 3500)
  • Endpoints for Get all Users: "/api/users/all-users"
  • Endpoints for Get One User: "/api/users/user/:userID"

  • Endpoints for Users Registration: "/api/users/registerusers"

  • Endpoints for Users Verification: "/api/users/verifyusers"

  • Endpoints for Users Login: "/api/users/loginuser"

  • Endpoints for Making automated deposits: "/api/users/depositmoney/:userID/:walletID"

  • Endpoints for Funding wallet: "/api/users/fundwallet/:userID/:walletID"


TO RUN CODES: After Npm i, on the right directory/folder, run the "npm run dev" command
This will start up the server and every thing connected. The launch up postamn and text the endpoints there really