{"id":26880793,"url":"https://github.com/rayeesac/railway-ticket-reservation-api","last_synced_at":"2025-10-18T20:20:01.544Z","repository":{"id":282683411,"uuid":"949341883","full_name":"Rayeesac/Railway-Ticket-Reservation-API","owner":"Rayeesac","description":"Railway Ticket Reservation API (Django + DRF + Postgresql)","archived":false,"fork":false,"pushed_at":"2025-03-16T09:11:13.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T09:28:22.744Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Rayeesac.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-16T08:28:23.000Z","updated_at":"2025-03-16T09:11:17.000Z","dependencies_parsed_at":"2025-03-16T09:38:29.501Z","dependency_job_id":null,"html_url":"https://github.com/Rayeesac/Railway-Ticket-Reservation-API","commit_stats":null,"previous_names":["rayeesac/railway-ticket-reservation-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rayeesac%2FRailway-Ticket-Reservation-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rayeesac%2FRailway-Ticket-Reservation-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rayeesac%2FRailway-Ticket-Reservation-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rayeesac%2FRailway-Ticket-Reservation-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rayeesac","download_url":"https://codeload.github.com/Rayeesac/Railway-Ticket-Reservation-API/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246483939,"owners_count":20784981,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-31T14:38:36.224Z","updated_at":"2025-10-18T20:19:56.502Z","avatar_url":"https://github.com/Rayeesac.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Railway Ticket Reservation API (Django + DRF + Postgresql)\n\nClone Git\n----------\ngit clone https://github.com/Rayeesac/Railway-Ticket-Reservation-API.git\n\nRun Docker \n----------\ncd Railway-Ticket-Reservation-API/ \u0026\u0026 docker-compose -f docker-compose.yml up -d --build\n\nRestore Database\n---------\ncat railway_reserve_db.sql | docker exec -i railway_postgres psql -U postgres\n\nDown and Up Docker\n--------\ndocker-compose -f docker-compose.yml down \u0026\u0026 docker-compose -f docker-compose.yml up -d\n\nPostman Collection  \n----------------------\n[![Download Postman Collection](https://run.pstmn.io/button.svg)](https://www.postman.com/grey-equinox-143107/railway-reservation-api/collection/589ljuf/railway-reservation-api)\n\n\n📌 API Endpoints Documentation\n------------------------------\n\n1.Book a Ticket\n--------------------\n\n📍 **Endpoint: POST /api/v1/tickets/book**\n\nBooks a railway ticket for a passenger. The system automatically assigns the appropriate berth type based on availability and priority rules.\n\n🔹 Request Body Example (JSON)\n\n```json\n\n{\n    \"passenger\": {\n        \"name\": \"Alice Johnson\",\n        \"age\": 65,\n        \"gender\": \"F\",\n        \"is_child\": false\n    }\n}\n```\n✅ Response Example (Success)\n\n```json\n{\n    \"id\": 12,\n    \"status\": \"CONFIRMED\",\n    \"berth_type\": \"LOWER\",\n    \"passenger\": {\n        \"id\": 30,\n        \"name\": \"Alice Johnson\",\n        \"age\": 65,\n        \"gender\": \"F\",\n        \"is_child\": false\n    }\n}\n```\n❌ Response Example (No Tickets Available)\n\n```json\n{\n    \"error\": \"No tickets available\"\n}\n```\n\n2.Cancel a Ticket\n-------------------\n\n📍 **Endpoint: POST /api/v1/tickets/cancel/{ticketId}**\n\nCancels a previously booked ticket. If a Confirmed ticket is canceled, the system will upgrade the next RAC ticket to Confirmed, and the next Waitlist ticket to RAC.\n\n🔹 Path Parameter:\n\nticketId → The unique ID of the ticket to be canceled\n✅ Response Example (Success)\n\n```json\n{\n    \"message\": \"Ticket canceled successfully\"\n}\n```\n❌ Response Example (Ticket Not Found)\n\n```json\n{\n    \"error\": \"Ticket not found\"\n}\n```\n\n3.Get All Booked Tickets\n------------------------\n\n📍 **Endpoint: GET /api/v1/tickets/booked**\n\nRetrieves a list of all booked tickets, including details of Confirmed, RAC, and Waitlist passengers.\n\n✅ Response Example\n\n```json\n[\n    {\n        \"id\": 10,\n        \"status\": \"CONFIRMED\",\n        \"berth_type\": \"LOWER\",\n        \"passenger\": {\n            \"id\": 21,\n            \"name\": \"John Doe\",\n            \"age\": 60,\n            \"gender\": \"M\",\n            \"is_child\": false\n        }\n    },\n    {\n        \"id\": 11,\n        \"status\": \"RAC\",\n        \"berth_type\": \"SIDE-LOWER\",\n        \"passenger\": {\n            \"id\": 22,\n            \"name\": \"Jane Doe\",\n            \"age\": 40,\n            \"gender\": \"F\",\n            \"is_child\": false\n        }\n    }\n]\n```\n\n4.Get Available Tickets Count\n-------------\n\n📍 **Endpoint: GET /api/v1/tickets/available**\n\nReturns the number of available Confirmed, RAC, and Waitlist slots.\n\n✅ Response Example\n\n```json\n{\n    \"confirmed\": 10,\n    \"RAC\": 5,\n    \"waiting\": 2\n}\n```\n\nSite Available URL: \n-------------------\nhttp://127.0.0.1:8000/api-auth/login/\n\nusername : railyway_admin\npassword : RaWa@Admin123#\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frayeesac%2Frailway-ticket-reservation-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frayeesac%2Frailway-ticket-reservation-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frayeesac%2Frailway-ticket-reservation-api/lists"}