Giter Club home page Giter Club logo

accounts's Introduction

User Savings Account REST API

REST endpoint that allows an existing user to open a savings account.

Run with

Run: accounts > mvn spring-boot:run

Tech Stack

Java 8
Spring Boot
Spring Data JPA
Hibernate
H2 in memory db
Maven

Database Tables

create table account (account_id integer generated by default as identity, balance decimal(19,2), primary key (account_id))
create table user (user_id integer generated by default as identity, name varchar(255), primary key (user_id))
create table user_account (account_id integer not null, user_id integer not null, primary key (account_id, user_id))

Database Tables Definitions

user = Stores user detail information (such as user name)
account = Stores account detail information (such as account balance)
user_account = Join table for user-savingAccount pairs

Requirements

  • Create a new user
  • Add a savings account to an existing user

Create a new user

Method : HTTP.POST
URL : http://localhost:8080/user/save

Request Input Test Data :

{
	"name" : "Kiril"
}

Response :

HTTP response code 200

{
    "userId": 2,
    "name": "Kiril"
}

Add a savings account to an existing user

Method : HTTP.POST
URL : http://localhost:8080/userSavingsAccount/save

Case 1 : Existing user id is provided in input JSON message 

Request Input Test Data :
{
    "userId": 1
}

Response : 

HTTP response code 200 
{ "userId": 1, "accountId": 1 } Case 2 : Non-Existing user id is provided in input JSON message Request Input Test Data : { "userId": 3 } Response : HTTP response code 451
{ "msgList": [ "User does not exist in the system. Save user before savings account creation." ] } Case 3 : User having savings account is provided in input JSON message again. Request Input Test Data : { "userId": 1 } Response : HTTP response code 451
{ "msgList": [ "User can have only one savings account. Duplicate savings account creation is not allowed." ] } Case 4 : Savings account opening time is violated. Request Input Test Data : { "userId": 1 } Response : HTTP response code 451
{ "msgList": [ "The account can only be opened between 8 AM and 5 PM." ] }

accounts's People

Contributors

tufangorel avatar

Watchers

 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.