Skip to content

RentalTooService ‐ Get All Available tools

Dennis Chacko edited this page Jul 18, 2024 · 7 revisions

Get All Available Tools

Table of Contents

Overview

The Get All Available tools operation fetches all tools available for rent in the system. Currently:

  • The valid tools available for rent is loaded in the database during service startup
  • Later revisions would have a CRUD API to add/remove tools at runtime

Sample Request/Response

Request to fetch all tools available for rent

The below curl command can be used to fetch all available tools

curl --location 'http://localhost:3000/api/v1/tool' \ --header 'Accept: application/json'

Fetch All Available tools Response

The service should respond back with the below json:

[
    {
        "code": "CHNS",
        "type": "Chainsaw",
        "brand": "Stihl"
    },
    {
        "code": "LADW",
        "type": "Ladder",
        "brand": "Werner"
    },
    {
        "code": "JAKD",
        "type": "Jackhammer",
        "brand": "DeWalt"
    },
    {
        "code": "JAKR",
        "type": "Jackhammer",
        "brand": "Ridgid"
    }
]

Sequence diagram

sequenceDiagram
    AbstractController->>+RentalAgreementService: Fetch all available tools
    RentalAgreementService->>+ToolRepository: Fetch all available tools
    ToolRepository-->>-RentalAgreementService: List of all available tools
    RentalAgreementService-->>-AbstractController: List of all available tools
Loading
Clone this wiki locally