Create a web calendar to store and manage all upcoming events.
Use the Spring Boot framework and create a REST API.
Work with a database using Spring Data JPA and create resources using Spring MVC.
- How to use H2 database for development
- How to use Jakarta Persistence API(JPA)
- How to create tables using JPA
- How to work with JPA repositories
- Understanding of EntityContext and EntityManager
- Validation with Jakarta Validation API
- That controllers can be mapped instead of writing the same URL prefix for each endpoint
- Improved understanding of LocalDate objects
Language: Java 17
Frameworks: SpringBoot, Spring Data JPA
Tools: Postman, H2
-
Create Event
- URL:
/event - Method:
POST - Description: Create a new event.
- Request Body:
{ "event": "Event Title", "date": "2023-12-31" } - Response:
201 Created - Edge Cases:
- Invalid Date Format: If the date is not in the correct format, the request will fail with a 400 Bad Request.
- Missing Fields: If required fields (title, date) are missing, the request will fail with a 400 Bad Request.
- URL:
-
Get Events in time period
- URL:
/event?start_time={start_date}&end_time={end_date} - Method:
GET - Description: Retrieve all events in between start and end date (inclusive). If no events are found retrieve all existing events.
- Response:
200 OK[ { "id": 1, "event": "Event Title", "date": "2023-12-31" } ] - Edge Cases:
- Invalid Date Format: If the start or end date is not in the correct format, the request will fail with a 400 Bad Request.
- No Events Found: If no events exist, the response will be 204 No Content.
- URL:
-
Get Event by ID
- URL:
/event/{id} - Method:
GET - Description: Retrieve an event by its ID.
- Response:
200 OK{ "id": 1, "event": "Event Title", "date": "2023-12-31" } - Edge Cases:
- Invalid ID: If the ID is not a positive number, the request will fail with a 400 Bad Request.
- Event Not Found: If no event is found with the given ID, the response will be 404 Not Found.
- URL:
-
Update Event
- URL:
/event/{id} - Method:
PUT - Description: Update an event by its ID.
- Request Body:
{ "event": "Event Title", (optional) "date": "2023-12-31" (optional) } - Response:
201 Created - Edge Cases:
- Invalid Date Format: If the date is not in the correct format, the request will fail with a 400 Bad Request.
- Missing Fields: If required fields (title, date) are missing, event's corresponding field will not be changed.
- URL:
-
Delete Event by ID
- URL:
/event/{id} - Method:
DELETE - Description: Delete an event by its ID.
- Response:
200 OK{ "id": 1, "event": "Event Title", "date": "2023-12-31" } - Edge Cases:
- Invalid ID: If the ID is not a positive number, the request will fail with a 400 Bad Request.
- Event Not Found: If no event is found with the given ID, the response will be 404 Not Found.
- URL:
Some of the possible features that would be great to implement in a project of this type
- User management - allowing different users to have different events;
- Collaborative event - allow multiple users to refer to the same event;
- Add additional information for events: description, place, time, etc.