This is a train ticket booking API built with Spring Boot, using Hibernate, JPA, and MySQL for managing ticket reservations. The system allows users to book and cancel seats for train journeys, ensuring seat availability and managing bookings via PNR numbers.
- Book Tickets: Allows users to book available seats for a given journey. 🎟️
- Cancel Tickets: Users can cancel their booked tickets and free up seats. ❌
- Seat Availability Check: Provides available seats for booking or cancellation based on source and destination. 📊
- PNR Generation: A unique PNR number is generated for each booking. 📑
- Real-Time Updates: Updates the status of bookings and cancellations in the database. 🔄
- Telegram Bot Integration: A Telegram bot for seamless communication to check bookings, cancellations, and clear tickets directly. 🤖
- Backend: Spring Boot 🌱
- Programming Language: Java (Spring Framework) 🖥️
- Persistence: Hibernate, JPA 🛠️
- Database: MySQL 🗄️
- Web Framework: Spring MVC 🕸️
- Transaction Management:
@Transactionalannotations for database transactions 🔄
Endpoint:
POST /TCApp/book
Description:
Books the selected seats for a given journey.
Request Body:
{
"from": "A",
"to": "B",
"seatList": [1, 2, 3]
}Response
{ "message": "Ticket booked successfully with the pnrNumber 12345" }
Endpoint:
POST /TCApp/cancelSeat
Description:
Cancels the selected tickets using the PNR number.
Request Body:
{
"pnrNo": 12345,
"seatList": [1, 2]
}
Response
{
"message": "Ticket Cancelled"
}Endpoint:
GET /TCApp/getAllSeatsBooking
Description:
Fetches available seats between a source and destination.
Response:
[1, 2, 3, 4, 5]
Endpoint:
GET /TCApp/getAllSeatsCancelling
Description:
Fetches the booked seats for a given PNR number.
Response:
[1, 2]