Siral is the backend server for a meal reservation and management application. This project is part of my university internship, where I am gaining practical experience in backend development. The application allows users to manage dining halls, make reservations, and handle user roles efficiently.
-
Clone the repository:
git clone https://github.com/serize02/siral.git cd siral
-
Set up environment variables: Create a file named
.env
in the root of your project and add the following variables:DB_USER=your_db_user DB_PASSWORD=your_db_password DB_HOST="jdbc:postgresql://localhost:5432/DB_NAME" ADMIN_EMAIL=your_admin_email ADMIN_PASSWORD=your_admin_password JWT_SECRET=your_jwt_secret
-
Build the project using Gradle:
./gradlew build
-
Run the application:
./gradlew run
-
The server will start on
http://localhost:8080
.
-
Insert Dining Hall:
POST /siral/dinninghalls/{dinninghallNAME}
- Description: Inserts a new dining hall.
- Parameters:
dinninghallNAME
(path parameter) - Response:
201 Created
if successful400 Bad Request
if the dining hall already exists or the name is missing
-
Delete Dining Hall:
DELETE /siral/dinninghalls/{dinninghallID}
- Description: Deletes an existing dining hall.
- Parameters:
dinninghallID
(path parameter) - Response:
200 OK
if successful400 Bad Request
if the dining hall ID is missing or not found
-
Insert New Role:
POST /siral/insert-new-role
- Description: Inserts a new role for a user.
- Request Body:
NewRoleCredentials
(JSON) - Response:
200 OK
if successful400 Bad Request
if required fields are missing or the role is invalid
-
Delete Role:
DELETE /siral/delete-role/{email}
- Description: Deletes an existing role for a user.
- Parameters:
email
(path parameter) - Response:
200 OK
if successful400 Bad Request
if the email is missing or the user is not found
-
Student Login:
POST /siral/student-login
- Description: Authenticates a student and returns a JWT token.
- Request Body:
AuthCredentials
(JSON) - Response:
200 OK
withStudentLoginData
if successful401 Unauthorized
if credentials are invalid
-
Admin Login:
POST /siral/admin-login
- Description: Authenticates an admin and returns a JWT token.
- Request Body:
AuthCredentials
(JSON) - Response:
200 OK
with JWT token if successful401 Unauthorized
if credentials are invalid
-
Site Manager/Scheduler Login:
POST /siral/site-manager-scheduler-login
- Description: Authenticates a site manager or scheduler and returns a JWT token.
- Request Body:
AuthCredentials
(JSON) - Response:
200 OK
with JWT token if successful401 Unauthorized
if credentials are invalid
-
Make Reservation:
POST /siral/reservations/{studentID}/{scheduleItemID}
- Description: Makes a reservation for a student.
- Parameters:
studentID
andscheduleItemID
(path parameters) - Response:
200 OK
if successful400 Bad Request
if the reservation already exists or required fields are missing
-
Delete Reservation:
DELETE /siral/reservations/{studentID}/{reservationID}
- Description: Deletes an existing reservation.
- Parameters:
studentID
andreservationID
(path parameters) - Response:
200 OK
if successful400 Bad Request
if the reservation ID is missing or not found
-
Get Student Reservations:
GET /siral/reservations/{studentID}
- Description: Retrieves all reservations for a student.
- Parameters:
studentID
(path parameter) - Response:
200 OK
with list of reservations if successful400 Bad Request
if required fields are missing
-
Get Schedule:
GET /siral/schedule/{dinninghallID}
- Description: Retrieves the schedule for a dining hall.
- Parameters:
dinninghallID
(path parameter) - Response:
200 OK
with schedule items if successful400 Bad Request
if required fields are missing404 Not Found
if the dining hall is not found
-
Insert Schedule Item:
POST /siral/schedule/{schedulerID}
- Description: Inserts a new schedule item.
- Parameters:
schedulerID
(path parameter) - Request Body:
ScheduleItemRequest
(JSON) - Response:
200 OK
if successful400 Bad Request
if required fields are missing or the date is invalid
-
Delete Schedule Item:
DELETE /siral/schedule/{schedulerID}
- Description: Deletes an existing schedule item.
- Parameters:
schedulerID
(path parameter) - Request Body:
ScheduleItemRequest
(JSON) - Response:
200 OK
if successful400 Bad Request
if required fields are missing or the item is not found
-
Update Schedule Availability:
PUT /siral/schedule/availability/{schedulerID}/{days}
- Description: Updates the number of days before a schedule item becomes available.
- Parameters:
schedulerID
anddays
(path parameters) - Response:
200 OK
if successful400 Bad Request
if required fields are missing or the days are invalid
- Ktor: A framework for building asynchronous servers and clients in connected systems. It is used to create the web server.
- Gradle: A build automation tool used for dependency management and project build tasks.
- PostgreSQL: An advanced open-source relational database. It is used to store and manage the application's data.
- Exposed: A lightweight SQL library on top of JDBC. It is used for database operations.
- JWT Authentication: A method for securely transmitting information between parties as a JSON object. It is used for securing the application endpoints.