Giter Site home page Giter Site logo

bookstore's Introduction

Hi ๐Ÿ‘‹, I'm Yagiz Gazibaba

๐Ÿ”ด Important [19th Feb 2022 : 03:12] Now I realized that I should have used write concern as majority for preventing data inconsistency that can be caused by primarydb failures which primarydb cannot be able to replicate its data to replicas. (Tunable consistency in MongoDB @see https://youtu.be/x5UuQL9rA1c?t=555)


Self Criticism for My mistakes:

  • Get with body. :(
  • In some parts business logic layer and persistence layer mixed (Like order creation.). :(
  • Codes could have been cleaner. :(


Description:

ReadingIsGood service is service that serve to ReadingIsGood firm that sells books online. You can create book, customer, order, inventory as well as get statistics.


Getting Started

To use service, you need to only run 2 different steps; First create package then use docker compose command. Database and application will bring up and will be ready for usage:

mvn clean package -DskipTests
docker compose up


Usage:

I prepared swagger documentation. You can look this page for all controllers and usages.

ReadingIsGood Service Documentation

Swagger



Tech Stack

  • Java 11
  • MongoDB 4.4
  • Spring Boot 2.6.3
  • Docker, Docker Compose

docker java postgresql spring


Design Decisions

  • For preventing partial updates, lost updates(Specific form of write skew) and similiar concurrency issues I used;
    • Optimistic Locking with Versions.
    • MongoDB multi document transactions(since MongoDB 4)
    • MongoDB atomic updates.
  • For getting statistics info I used;
    • MongoDB Aggregations
  • For securing endpoints I used;
    • JWT token

Integration Test and Unit Test Coverage Result

docker



Credentials:

login: [email protected]
password: 123456

Note: Assumption made for TimeZone which is UTC. So when
apply date criteria regard timezone.

Note: While testing orders between dates use Postman.
Because swagger-ui does not support GET request with body.

See below example request(Also do not forget to add bearer token in headers)


docker

bookstore's People

Contributors

argmnt avatar

Watchers

 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.