Skip to content

yusufoglu218/cleaner-booking-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cleaner Booking Rest Api

Cleaner Booking rest api that includes the following operations using spring boot and mySql DB.

  • Retrieving available cleaner list to book
  • Booking with one or more cleaners
  • Retrieving booking detail

Prerequisites

Build and Run application

Setup database tables

Build and Run application

  • GOTO > ~/absolute-path-to-directory/cleaner-booking-api
    and try below command in terminal

    mvn spring-boot:run it will run application as spring boot application

    or

    mvn clean install it will build application and create jar file under target directory

    Run jar file from below path with given command

    java -jar ~/path-to-cleaner-booking-api/target/cleaner-booking-api-0.0.1-SNAPSHOT.jar

Model class

Below are the model classes to perform database operations.

    public class Booking {
        private Long id;
        private Long customerId;
    }
    
    public class Cleaner {
        private Long id;
        private String name;
        private String surname;
    }
    
    public interface CleanerAvailableTime {
        Long getId();
        String getName();   
        String getSurName();   
        LocalDateTime getStartTime();  
        LocalDateTime getEndTime();
    }

    public class BookingCleaner {
        private Long id;
        private Long bookingId;  
        private Long cleanerId;  
    }
    
    public class BookingTimePeriod {
        private Long id;
        private Long bookingId;
        private Long timePeriodId;
        private Status status;
        private BookingType bookingType;
    }
    
    public class TimePeriod {
        private Long id;
        private LocalDateTime startTime;
        private LocalDateTime endTime;
        private String status;
    }

Endpoints

Swagger and root

HTTP Method URL Description
GET http://localhost:8080/ Root page
GET http://localhost:8080/swagger-ui/index.html Swagger UI page
GET http://localhost:8080/actuator Actuator page

Booking Service

HTTP Method URL Description
POST http://localhost:8080/api/v1/booking Create new Booking
PATCH http://localhost:8080/api/v1/booking/{id} Update Booking by ID
GET http://localhost:8080/api/v1/booking/{id} Get Booking by ID

Cleaner Service

HTTP Method URL Description
GET http://localhost:8080/api/v1/cleaner/available?date={date}&startTime={startTime}&duration={duration}&numberOfCleaner={numberOfCleaner} Get available cleaner list

Postman Collection

Postman collection file for all operations: Cleaner-Booking-Api.postman_collection.json

Database ER Diagram

The ER Diagram of Database that is designed by requirements