Skip to content

ndujesco/Lendsqr-be-test

Repository files navigation

DEMO CREDIT APP

DESCRIPTION

  • Demo Credit is a mobile lending app that requires wallet functionality. This is needed as borrowers need a wallet to receive the loans they have been granted and also send the money for repayments.

  • We use NodeJS with TypeScript as its backend software development stack which allows us to rapidly ideate and release features and functionality.

FEATURES

  • A user can create an account.
  • A user can fund their account.
  • A user can transfer funds to another user’s account.
  • A user can withdraw funds from their account.
  • A user with records in the Lendsqr Adjutor Karma blacklist cannot be onboarded.
  • A user can view their transactions history.
  • A user can view other user's profile.

TECH STACK

  • NodeJS
  • KnexJS ORM
  • MySQL database
  • TypeScript

LINKS

DATABASE

  • User
  • Wallet
  • Transaction

DATABASE_DESIGN

PROJECT SETUP

CLONE THE REPO
git clone https://github.com/ndujesco/lendsqr-be-test.git
INSTALL DEPENDENCIES
yarn install
CREATE A DATABASE
CREATE DATABASE lendsqr;
CREATE A .env.development file
  • Create in the root directory
  • Check .env.example for the variables
  • .env will not work appropriately
  • .env.production should be used for production
RUN MIGRATIONS
yarn migrate:latest:dev
START SERVER
yarn start:dev

TESTS

AuthController
AUTH TEST
TransactionController
TRANSACTION TEST
UserContoller
USER TEST
JWT
JWT TEST
ALL
ALL TESTS

ENDPOINTS

AUTHORIZATION REQUESTS

POST /auth/signup (creates a user and a wallet)

key value required parameter type
email string true body
password string true body
phone string true body
first_name string true body
last_name string true body
POST /auth/verification/email (verifies a user's email)

key value required parameter type
email string true query
otp string true query
POST /auth/signin (signs in user if email is verified)

key value required parameter type
email string true body
password string true body
POST /auth/update/email (updates a user's email)

key value required parameter type
email string true body
user_id string true body
POST /auth/password (verifies user's password.)

Authentication Required

key value required parameter type
password string true body

TRANSACTION REQUESTS

POST /transaction/transfer (funds another user's account and is debited accordingly)

Authentication Required

key value required parameter type
receiver_id integer true body
amount integer true body
remark text true body
POST /transaction/withdraw (initiates the withdrawal transaction)

Authentication Required

key value required parameter type
amount integer true body
POST /transaction/topup (initiates topup transaction)

Authentication Required

key value required parameter type
amount integer true body
POST /transaction/verify (verifies the withdrawal or topup transaction and completes it)

Authentication Required

key value required parameter type

| payment_id | integer | true | body |


GET REQUESTS

GET /user/my/profile (gets the logged in user's profile)

Authentication Required

GET /user/wallet (returns the user's wallet info)

Authentication Required

GET /user/transaction/type (returns the user's transactions according to the specified type)

Authentication Required

key value required parameter type
transaction_type enum('topup withdrawal transfer') false query
GET /user/transaction/all (returns the user's transaction by pagination)

Authentication Required

key value required parameter type
page_number integer true query
GET /user/transaction/common (returns transactions logged in user has in common with specified user)

Authentication Required

key value required parameter type
user_id integer true query
GET /user/profile/wallet (returns a user's profile from their wallet number)

Authentication Required

key value required parameter type
wallet_number integer true query
GET /user/profile/id (returns a user's profile from ID)

Authentication Required

key value required parameter type
user_id integer true query
GET /user/profile/by (returns users profile that match the key-value)

Authentication Required

key value required parameter type
key string true query
value string true query

Releases

No releases published

Packages

No packages published