GithubHelp home page GithubHelp logo

restaurant-service's Introduction

Best Match Restaurant

Coverage Branches

This is a Java REST application built with Spring Boot, Maven, and Java 17. The purpose of this application is to find the best match restaurant based on given search criteria.

Tech stack

  • Java 17
  • Springboot 3.2.5
  • OpenApi (API first generating controller from swagger.yml spec)
  • Jacoco (Code coverage report available on Github pipeline)
  • Github Actions (Continuous Integration)

Features

  • It provides a RESTful API endpoint to search for restaurants based on various criteria like name, cuisine, distance, rating, and price.
  • Retrieve detailed information about a specific restaurant.

Prerequisites

  • Java Development Kit (JDK) 17 or higher installed
  • Apache Maven installed or Maven Wrapper
  • IDE (e.g., IntelliJ IDEA, Eclipse) for development

Getting Started

From Git repo

  1. Clone the repository:

    git clone https://github.com/osnircunha/restaurant-service.git
  2. Navigate to the project directory:

    cd restaurant-service

    Then you can move to step 3

From zip file package

  1. Unzip the zip file you received:

    unzip restaurant-service-master.zip
  2. Navigate to the project directory:

    cd restaurant-service-master

    Then you can move to step 3

With repo cloned or zip extracted you can proceed as below:

  1. Build the project using Maven:

    mvn clean package -DskipTests

    or

     ./mvnw clean package -DskipTests
  2. Run unit tests using Maven:

    mvn clean verify

    or

     ./mvnw clean verify
  3. Run the application:

    java -jar target/restaurants-service-0.0.1-SNAPSHOT.jar

    or

    mvn spring-boot:run
  4. Access the API documentation and endpoints via a web browser.

    http://localhost:8080/swagger-ui/index.html

    It can also be used to test the api by expanding the "GET /restaurants" and select "Try it out" button. By doing this, it will unlock the parameters form that you can fill based on usage criteria and then click "Execute" to submit a request.

Usage

  1. Use the provided API endpoint to search for restaurants based on the five criteria below:
    • Restaurant Name (Contains the text provided ignoring case)
    • Customer Rating (1 star ~ 5 stars)
    • Distance (1 mile ~ 10 miles)
    • Price (how much one person will spend on average, $10 ~ $50)
    • Cuisine (Chinese, American, Thai, etc.)
  2. Make requests to the API using tools like cURL, Postman, or your preferred REST client.
  3. Explore and analyze the response to find the best match restaurant based on the given search criteria.

Assumptions

  • It was not clear the rule for text search, the example provided seemed to be a "starts with" rule. The rule applied is a verification of "contains ignoring case" for the parameters provided on restaurant name and cuisine. However it can be easily adjusted if needed by change the interface FilterDefinition.java as below:

Starts with ignoring case:

    default boolean contains(String current,String searchParam){
        return isNull(searchParam)||StringUtils.startsWithIgnoreCase(current,searchParam);
        }

Starts with considering case:

    default boolean contains(String current,String searchParam){
        return isNull(searchParam)||StringUtils.startsWith(current,searchParam);
        }

restaurant-service's People

Contributors

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