A Spring Boot REST API for managing meeting room bookings and user authentication.
- User authentication and authorization with JWT
- Meeting room booking management
- User role management
- Search functionality for room availability
POST /api/auth/register
Request Body:
{
"name": "string",
"email": "string",
"username": "string",
"password": "string",
"confirmPassword": "string"
}
Response: Returns the created user ID
POST /api/auth/login
Request Body:
{
"username": "string",
"password": "string"
}
Response:
{
"token": "string",
"username": "string",
"email": "string",
"id": "number",
"roles": ["string"]
}
GET /api/user/get-all?page=0&size=10
Response: Paginated list of users with their details
GET /api/user/toggle-role/{userId}
Response: Updated user ID
GET /api/meetings/get-all?page=0&size=10
Response: Paginated list of meetings
POST /api/meetings/book
Request Body:
{
"meetingRoom": "enum",
"bookedBy": "string (email)",
"bookingDate": "YYYY-MM-DD",
"startTime": "HH:mm:ss",
"endTime": "HH:mm:ss"
}
Response: Created meeting ID
GET /api/meetings/cancel/{id}
Response: Cancelled meeting details
POST /api/meetings/search?page=0&size=10
Request Body:
{
"meetingRoom": "enum",
"bookingDate": "YYYY-MM-DD"
}
Response: Paginated list of meetings matching the search criteria
{
"id": "number",
"meetingRoom": "enum",
"bookedBy": "string (email)",
"bookingDate": "YYYY-MM-DD",
"startTime": "HH:mm:ss",
"endTime": "HH:mm:ss"
}
{
"name": "string",
"email": "string",
"username": "string",
"role": "enum"
}
The API includes comprehensive validation for all endpoints:
- Required field validation
- Email format validation
- Password matching validation for registration
- Date and time validation for meetings
- JWT-based authentication
- Role-based access control
- Secure password handling
- Protected endpoints requiring authentication
The API uses standardized error messages with unique error codes:
- ARB1001: Room is required
- ARB1002: Meeting organizer is required
- ARB1003: Invalid email address
- ARB1004: Date is required
- ARB1005: Starting time is required
- ARB1006: End time is required
- ARB1007: Name is required
- ARB1008: Email is required
- ARB1009: Username is required
- ARB1010: Password is required
- ARB1012: Confirmation password required
- Java 17 or higher
- Spring Boot 3.x
- Maven/Gradle for dependency management
- PostgreSQL/MySQL database (configure in application.properties)
- Clone the repository
- Configure your database connection in
application.properties
- Run the application using Maven:
./mvnw spring-boot:run
- The API will be available at
http://localhost:8080
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request