Skip to content

Files

Latest commit

127c74d · Dec 15, 2022

History

History
284 lines (203 loc) · 12.5 KB

README.md

File metadata and controls

284 lines (203 loc) · 12.5 KB

CLEVERTEC

🚀 Test task - Receipt API

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. GitHub HitCount GitHub

Table of Contents
  1. Task Description
  2. Getting Started
  3. API Usage
  4. Demo

📄 Task Description

📝 Main Technologies

Database Postgresql
Backend Java Spring
Build Tool Gradle
PaaS Docker Heroku

⚙️ Getting Started

⏩ The Easiest Way ⏩

API already deployed on PaaS Heroku:

🚀 Heroku link

https://clevertec-test-task.herokuapp.com

🐋 Start with Docker

  • Clone the repository
git clone https://github.com/IvanHayel/clevertec-test-task.git
  • Use docker-compose
docker-compose up

🦖 Local Startup with Gradle

Java version 17+ is required.

  • Clone the repository
git clone https://github.com/IvanHayel/clevertec-test-task.git
  • Create Postgres Database

Example:

CREATE DATABASE "clevertec-api"
    WITH
    OWNER = postgres
    ENCODING = 'UTF8'
    LC_COLLATE = 'English_World.1252'
    LC_CTYPE = 'English_World.1252'
    TABLESPACE = pg_default
    CONNECTION LIMIT = -1;
  • Set up environment variables

DB_URL - JDBC url for Postgres database.

DB_USERNAME - database username

DB_PASSWORD - database password

  • Run Gradle
gradle clean build bootRun

You can also use the gradle wrapper: ./gradlew


🔥 API Usage

💠 Endpoints

📦 PRODUCTS

HTTP METHOD URL QUERY PARAMETERS TEMPLATE DESCRIPTION
GET /api/v1/products none none Getting all Products.
GET /api/v1/products/{id} none none Getting Product by id.
GET /api/v1/products/search term: {any} - required none Full text search for all Products.
POST /api/v1/products none post-template Creating a new Product.
PUT /api/v1/products none put-template Updating existing Product.
DELETE /api/v1/products/{id} none none Deleting Product by id.

💳 DISCOUNT CARDS

HTTP METHOD URL QUERY PARAMETERS TEMPLATE DESCRIPTION
GET /api/v1/cards none none Getting all Discount Cards.
GET /api/v1/cards/{id} none none Getting Discount Card by id.
POST /api/v1/cards none post-template Creating a new Discount Card.
PUT /api/v1/cards none put-template Updating existing Discount Card.
DELETE /api/v1/cards/{id} none none Deleting Discount Card by id.

🧾 RECEIPTS

HTTP METHOD URL QUERY PARAMETERS TEMPLATE DESCRIPTION
GET /api/v1/receipts none none Getting all Receipts.
GET /api/v1/receipts/{id} none none Getting Receipt by id.
GET /api/v1/receipts/search term: {any} - required none Full text search for all Receipts.
GET /api/v1/receipts/download/{id} none none Download existing Receipt in PDF format.
POST /api/v1/receipts none post-template Creating a new Receipt.
PUT /api/v1/receipts none put-template Updating existing Receipt.
DELETE /api/v1/receipts/{id} none none Deleting Receipt by id.

🪄 Demo

Insomnia used for demonstration.

📦 PRODUCTS DEMO

Get all products

products-all

Get product by id

products-by-id

Products full text search

products-search

Add new product

products-add

Update existing product

products-update

Delete product

products-delete

💳 DISCOUNT CARDS DEMO

Get all cards

cards-all

Get card by id

cards-by-id

Add new card

cards-add

Update existing card

cards-update

Delete card

cards-delete

🧾 RECEIPTS DEMO

Get all receipts

receipts-all

Get receipt by id

receipts-by-id

Receipts full text search

receipts-search

Download receipt in PDF

receipts-download-pdf

Add new receipt

receipts-add

Update existing receipt

receipts-update

Delete receipt

receipts-delete