Skip to content

fashkl/voucher-pool

Repository files navigation

Description

Voucher Pool

A voucher pool is a collection of voucher codes that can be used by customers to get discounts on website. Each code may only be used once, and we would like to know when it was used by the customer. Since there can be many customers in a voucher pool, we need a call that auto-generates voucher codes for each customer.


Covered Points

  • Design a database schema migrations
  • Write an application
  • API endpoint for verifying and redeeming vouchers
  • Implement API Rate Limiting: Protect the API from abuse by implementing rate limiting on the endpoints.
  • Use Database Transactions: Ensure data consistency by implementing use of transactions in your application.
  • Write unit tests
  • Using Typescript
  • A nice little Readme on how to run
  • PLUS POINT: Writing swagger for the API
  • PLUS POINT: Docker file to setup the whole application with all the dependencies (database, nodejs)

Requirements

  1. Docker and Docker-compose installed on your machine
  2. Ports 3001 and 5432 are free

Installation & Running

Docker Compose

The below command will make everything Database, Migrations, App up and running

$ docker-compose up --build

Hint: I kept the .env file in repo intentionally for easy setup

Documentation

Swagger API documentation

http://localhost:3001/api

Test

```bash
# unit tests
$ npm run test

About

Voucher Pool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published