Skip to content

matthew-nguyen-20032023/salary-hero-backend

Repository files navigation

Nest Logo

Salary Hero Backend

Description

Salary payment project support partner register, config and manage their worker account, their worker salary and formula. From that, worker salary will be calculated automatically every day, every month and worker can manage their money.

Design

Basic High Level Design Overview

alt text

Low Level Design With AWS Cloud

alt text

Required

Node version v16.20.1
Yarn version 1.22.19
Docker version 20.10.21, build 20.10.21-0ubuntu1~22.04.3
docker-compose version 1.29.2, build unknown
PM2 version 5.3.0 => Only for Quick Start

Quick Start Or Manual Setup Guide Below

# Make sure you have full required above
# Important: make sure that list port here available on your machine
# List port: 9092, 6379, 5432, 2181, 3000, 3001
# Or you can change value from .env.example for another port
$ sudo chmod -R 777 ./quick_start.sh 
$ ./quick_start.sh 

Manual Setup

Setup components

# Preparing
$ yarn                          # install lib dependencies
$ cp .env.example .env          # init .env file (change information if you want to) 
$ docker-compose up -d          # init services component (depend on .env file, noted new docker version run docker compose up -d)
$ yarn build                    # build migration file to migrate
$ npm run typeorm:run           # migrate database schema
$ npm run typeorm:test          # migrate testing database schema
$ yarn console:dev seeding-data # seeding data for develop

Run Backend

# For development run
$ yarn start:dev 
#-----------------------------#
# Or for production run
$ yarn build
$ yarn start:prod

Background Job Handle worker salary calculation

# For development run
$ yarn console:dev calculate-worker-salary
#-----------------------------#
# For production run
$ node dist/src/console.js calculate-worker-salary

Note

After full setup and seeding data, we have some account seeded
AdminAccount: admin@gmail.com
PartnerAccount: partner@gmail.com
WorkerAccount: worker@gmail.com
Password for all: admin@123
API Swagger: http://localhost:3000/api/docs/

Testing

$ yarn test

Some Feature Can Implement In The Future

  • OTP to withdraw or transfer money for worker

Repository Activity

Alt

License

Nest is MIT licensed.