Coder Social home page Coder Social logo

stock-kotlin-service's Introduction

stock-kotlin-service

General Information

  • The Stock Kotlin Service is a JVM-based backend application built with Kotlin Spring Boot, Hibernate, Mysql, Springdoc-openApi, Docker Compose, JUnit 5, and YAML property configuration.
  • The Stock Service uses JUnit 5 and TestContainer to run test database and Springboot integration tests.
  • The Stock Service uses springdoc-openapi to generate OpenAPI documentation
  • The Stock Service exposes a RESTful API to manage stocks
  • The Stock Service can be run locally with docker-compose (no local PostgreSQL installation required)

Database Schema

  column      |    type   |    description
--------------|-----------|-----------------------------
id            | integer   | stock id, primary key
--------------|-----------|-----------------------------
name          | text      | stock company name, unique
--------------|-----------|-----------------------------
current_price | numeric   | stock price
--------------|-----------|-----------------------------
last_update   | timestamp | timestamp with timezone

Stock kotlin Service API

                   |       API endpoint        |    curl example
-------------------|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------
Get list of Stocks | GET '/api/stocks'         | curl -X GET 'localhost:8080/api/stocks?page=0&size=40&sort=name'
-------------------|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------
Get Stock by id    | GET '/api/stocks/{id}'    | curl -X GET 'localhost:8080/api/stocks/1'
-------------------|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------
Create new Stock   | POST '/api/stocks'        | curl -X POST 'localhost:8080/api/stocks' -H 'Content-Type: application/json' --data-raw '{"name": "BNB", "currentPrice": 100}'
-------------------|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------
Update Stock price | PATCH '/api/stocks/{id}'  | curl -X PATCH 'localhost:8080/api/stocks/11?price=34'
-------------------|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------
Delete Stock       | DELETE '/api/stocks/{id}' | curl -X DELETE 'localhost:8080/api/stocks/2'

Prerequisites

Getting Started

  1. clone Stock Kotlin Service repository:
    git clone https://github.com/skayvanfar/stock-kotlin-service.git
    cd stock-kotlin-service
    
  2. Build docker image Stock Kotlin Service application and run tests:
    chmod +x build_docker.sh
    ./build_docker.sh
    
  3. Start the Mysql database and run stock-kotlin-service application using Docker Compose:
    docker compose up
    
  4. Open Stock Kotlin Service OpenAPI documentation swagger ui
  5. Test Stock Kotlin Service application (see curl example in Stock Kotlin Service API)

stock-kotlin-service's People

Contributors

skayvanfar avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.