Git Product home page Git Product logo

inventory_qut's Introduction

inventory_qut

Spring Boot REST application for QUT

Sample Spring Boot RESTfull application based on question posed by QUT. The application is an implementation of the following API

swagger: '2.0'
info:
  title: Simple Inventory API
  description: |
    This test is designed to demonstrate real world problem solving skills.
    The task is to build a simple Spring Boot application and submit it for review via a git repository.

    It should include:
    - Spring MVC REST controller with mock mvc test
    - JPA mapping using H2 embedded database
    - maven build
    - unit tests

    Optional
    - Implement in Groovy
    - Secured via Spring Security HTTP Basic
    - JSR-303 Bean Validation
  version: 1.0.0
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html

paths:
  /inventory:
    get:
      description: List available inventory in the system.
      produces:
        - application/json
      parameters:
        - in: query
          name: skip
          description: number of records to skip for pagination
          type: integer
          format: int32
          minimum: 0
          required: false
        - in: query
          name: limit
          description: maximum number of records to return
          type: integer
          format: int32
          minimum: 0
          maximum: 50
          required: false
      responses:
        200:
          description: list of inventory
          schema:
            type: array
            items:
              $ref: '#/definitions/InventoryItem'
        400:
          description: bad input parameter
    post:
      description: Adds an item to the system
      consumes:
        - application/json
      produces:
        - application/json
      parameters:
        - in: body
          name: inventoryItem
          description: Inventory item to add
          schema:
            $ref: '#/definitions/InventoryItem'
      responses:
        201:
          description: item created
        400:
          description: invalid input, object invalid
        409:
          description: an existing item already exists
  /inventory/{id}:
    get:
      description: Returns an inventory item by id.
      produces:
        - application/json
      parameters:
        - in: path
          name: id
          type: string
          format: uuid
          required: true
      responses:
        200:
          description: an inventory item
          schema:
            $ref: '#/definitions/InventoryItem'
        404:
          description: not found
definitions:
  InventoryItem:
    type: object
    required:
      - id
      - name
      - manufacturer
      - releaseDate
    properties:
      id:
        type: string
        format: uuid
        example: "d290f1ee-6c54-4b01-90e6-d701748f0851"
      name:
        type: string
        example: Widget Adapter
      releaseDate:
        type: string
        format: date-time
        example: "2016-08-29T09:12:33.001Z"
      manufacturer:
        $ref: '#/definitions/Manufacturer'
  Manufacturer:
    required:
      - name
    properties:
      name:
        type: string
        example: ACME Corporation
      homePage:
        type: string
        format: url
        example:  https://www.acme-corp.com
      phone:
        type: string
        example: "(07) 5556 4321"

Sample 200 Response

[
    {
        "id": 1,
        "name": "apple",
        "manufacturer": {
            "man_name": "Big Fat Corp",
            "url": "666-666",
            "phone": "http://www.bigfatcorp.com"
        },
        "releaseDate": "10/10/20"
    },
    {
        "id": 2,
        "name": "pair",
        "manufacturer": {
            "man_name": "Big Fat Corp",
            "url": "666-666",
            "phone": "http://www.bigfatcorp.com"
        },
        "releaseDate": "11/10/20"
    }
]

Sample ERROR Response

{
    "timestamp": "01-07-2020 07:49:24",
    "status": "400",
    "error": "BAD_REQUEST",
    "message": "Max value for limit is 50",
    "path": "/inventory"
}

Deliverables

  • Spring MVC REST controller with mock mvc test
    • JPA mapping using H2 embedded database
    • maven build
    • unit tests

Note : Due to time, unable to include all unit tests

inventory_qut's People

Contributors

tomlins 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.