Event Booking App:
A Spring Boot–based event booking and notification system that allows users to register, authenticate, create events, search and book tickets, and receive event notifications. The application is built with Java 17, Maven, Docker Compose, MariaDB, and ActiveMQ, includes unit and integration tests, preloaded sample data, and exposes RESTful JSON APIs for user, event, booking, and authentication workflows.
FUNTIONAL REQUIREMENTS:
- Create an account;
- User authentication to log into the system;
- Create events;
- Search and reserve tickets for events;
- Send notification to users before event starts.
- Event users should subscribe, listen and get notification messages.
NB: To test out the implemented functional requitements: Simply run the “functionalRequirementTest” integration test inside the `UserApiRestControllerTests.java` file to see all the implemented functional requirements running.
NON-FUNCTIONAL REQUIREMENTS:
- The project MUST be buildable and runnable;
- The project MUST have Unit tests;
- The project MUST have a README file with build/run/test instructions (use a DB that can be run locally, e.g. in-memory, via container);
- Any data required by the application to run (e.g. reference tables, dummy data) MUST be preloaded in the database;
- Input/output data MUST be in JSON format;
- Use a framework of your choice, but popular, up-to-date, and long-term support versions are recommended.
REQUIREMENT TO RUN THE APP:
1. JDK v17 (LTS). The sample is built with Spring Boot 3.xxx
2. Maven 3x
3. Docker desktop (WSL 2.0 for windows OS)
NB: Ensure Java, mvn and docker-compose are in your system path before trying to start the demo app.
TESTING THE APP:
1. CD into the <base folder>/bookings
2. Run: docker-compose -f .\compose.yaml up -d
This demo app uses the docker compose to load the dependent services:
1. Maria DB: To store the booking app database
2. Active MQ: For event notification
3. Run: mvn clean;mvn package
We need this step to run all test and generate sample data. Take note that the tests also contain the “functionalRequirementTest” which does run integrations test to confirm all the implemented functional requirements.
4. CD into <base folder>/bookings/target
5. Run: java -jar booking-0.0.1-SNAPSHOT.jar
ASSUMTIONS MADE IN THIS DEMO APP PROJECT:
1. This is a test project therefore:
- There is no requirement for an accurate event timing and notification.
- There is no requirement to test for a in ability to book an even due to capacity
ANY ISSUES:
Please, ensure that other app is not using port 8080.
API ENDPOINTS: See the added pictures for screenshot of local postman calls.
Base-path: https://localhost:8080/booking/api
| S/N | Endpoint | Description |
| 1 | POST /<base-path>/users | Create a user |
| 2 | GET /<base-path>/users/events | Get a user booked events |
| 3 | POST /<base-path>/events | Create an event |
| 4 | GET POST /<base-path>/events/{searchPhrase} | Search created events |
| 5 | GET /<base-path>/events/{eventId} | Get event by Id |
| 6 | GET POST /<base-path>/events/{eventId}/tickets | Book an event |
| 7 | DELETE /<base-path>/events/{eventid}/tickets/{ticketsId} | Cancel a booking |
| 8 | POST /<base-path>/auth | Login a user |
DEMO (SAMPLE) PRELOADED USER:
Username: sample@admin.com
Password: adminadmin
DATA AND TABLE DEFINITIONS:
Please see, init-scipts for the SQL migration files.
bookings
| Column | Type | Comment | PK | Nullable | Default |
| id | int(11) | Primary Key | YES | NO | |
| user_id | int(11) | User ID | NO | ||
| event_id | int(11) | Event ID | NO | ||
| created_at | timestamp | Created at | YES | current_timestamp() | |
| updated_at | timestamp | Updated at | YES | current_timestamp() |
events
| Column | Type | Comment | PK | Nullable | Default |
| id | int(11) | Primary Key | YES | NO | |
| name | varchar(255) | YES | NULL | ||
| description | varchar(255) | YES | NULL | ||
| capacity | int(11) | Capacity of the event | NO | ||
| start_date | date | Start date of the event | NO | ||
| category | tinyint(4) | YES | NULL | ||
| end_date | datetime(6) | YES | NULL | ||
| created_at | timestamp | Created at | YES | current_timestamp() | |
| updated_at | timestamp | Updated at | YES | current_timestamp() | |
| date | datetime(6) | YES | NULL | ||
| is_active | bit(1) | YES | NULL |
event_notifications
| Column | Type | Comment | PK | Nullable | Default |
| id | bigint(20) unsigned | YES | NO | ||
| event_id | int(11) | NO | |||
| user_id | int(11) | NO | |||
| created_at | timestamp | NO | current_timestamp() | ||
| updated_at | timestamp | NO | current_timestamp() |
users
| Column | Type | Comment | PK | Nullable | Default |
| id | int(11) | Primary Key | YES | NO | |
| name | varchar(255) | YES | NULL | ||
| varchar(255) | YES | NULL | |||
| password | varchar(255) | YES | NULL | ||
| role | varchar(255) | YES | NULL | ||
| created_at | timestamp | Created at | YES | current_timestamp() | |
| updated_at | timestamp | Updated at | YES | current_timestamp() | |
| is_active | tinyint(1) | Is the user active? | YES | 1 |