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
- Run sql scripts in the create_table.sql to create tables.
- To add sample data insert_data.sql can be used.
-
GOTO > ~/absolute-path-to-directory/cleaner-booking-api
and try below command in terminalmvn spring-boot:run
it will run application as spring boot applicationor
mvn clean install
it will build application and create jar file under target directoryRun jar file from below path with given command
java -jar ~/path-to-cleaner-booking-api/target/cleaner-booking-api-0.0.1-SNAPSHOT.jar
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;
}
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 |
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 |
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 file for all operations: Cleaner-Booking-Api.postman_collection.json
The ER Diagram of Database that is designed by requirements