{"id":19300827,"url":"https://github.com/architsingh15/bus-ticket-booking","last_synced_at":"2025-04-22T10:32:12.052Z","repository":{"id":44304126,"uuid":"228603539","full_name":"architsingh15/bus-ticket-booking","owner":"architsingh15","description":"A bus ticket booking api server build on express.js with MongoDB as the backend. ","archived":false,"fork":false,"pushed_at":"2023-03-02T09:15:32.000Z","size":275,"stargazers_count":6,"open_issues_count":11,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-03-10T20:56:07.573Z","etag":null,"topics":["body-parser","dotenv","express","joi","mongoose","nodejs","nodemon"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/architsingh15.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}},"created_at":"2019-12-17T11:39:22.000Z","updated_at":"2023-03-05T00:55:21.000Z","dependencies_parsed_at":"2023-02-17T09:01:38.737Z","dependency_job_id":null,"html_url":"https://github.com/architsingh15/bus-ticket-booking","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/architsingh15%2Fbus-ticket-booking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/architsingh15%2Fbus-ticket-booking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/architsingh15%2Fbus-ticket-booking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/architsingh15%2Fbus-ticket-booking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/architsingh15","download_url":"https://codeload.github.com/architsingh15/bus-ticket-booking/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223892988,"owners_count":17220834,"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":["body-parser","dotenv","express","joi","mongoose","nodejs","nodemon"],"created_at":"2024-11-09T23:15:55.838Z","updated_at":"2024-11-09T23:15:55.913Z","avatar_url":"https://github.com/architsingh15.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bus-ticket-booking\nA bus ticket booking api server build on express.js with MongoDB as the backend. \n\nHosted on heroku on the url: https://mighty-retreat-96950.herokuapp.com\nExample API: https://mighty-retreat-96950.herokuapp.com/api/tickets/open\n\n**API docs:**\n\n**POST '/api/ticket'**\n* *Create a ticket in tickets collection and corresponding user in user collection with seat_number*\n* *All of the attributes are required*\n* payload: \n* {\n    \"seat_number\": 1, -\u003e possible values 1 to 40\n    \"passenger\": { -\u003e passenger details\n        \"name\": \"John Doe\",\n        \"sex\": \"M\",\n        \"age\": 65,\n        \"phone\": \"9123003689\", -\u003e has to be unique in the whole user collection, hence, primary key for users\n        \"email\": \"whereandhow@gmail.com\"\n    }\n}\n* returns:\n200: if success, returns object that was saved\n404: if fails returns error in this format {message:\"error in string\"}\n\n**PUT '/api/ticket/:ticket_id'**\n* *Edit the ticket details and/or the passenger details*\n* *All the attributes are optional*\n* payload: \n* {\n    \"is_booked\": true, -\u003e can be true or false\n    \"passenger\": {\n        \"name\": \"Doosra John Doe\",\n        \"sex\": \"M\",\n        \"age\": 135,\n        \"phone\": \"1223123123\",\n        \"email\": \"whyandwhen@gmail.com\"\n    }\n}\n* returns:\n200: if success, returns object that was saved\n404: if fails returns error in this format {message:\"error in string\"}\n\n**GET /api/ticket/:ticket_id**\n* *Get the status of the ticket based on the ticket_id passed in URL*\n* returns:\n200: if success, returns object that was saved\n404: if fails returns error in this format {message:\"error in string\"}\n\n**GET /api/tickets/open**\n* *Get a list of tickets which have is_booked: false, that is, are open*\n* returns:\n200: if success, returns object that was saved\n404: if fails returns error in this format {message:\"error in string\"}\n\n**GET /api/tickets/closed**\n* *Get a list of tickets which have is_booked: true, that is, are closed*\n* returns:\n200: if success, returns object that was saved\n404: if fails returns error in this format {message:\"error in string\"}\n\n**GET /api/ticket/details/:ticket_id**\n* *Get the user details of the ticket based on the ticket_id passed*\n* returns:\n200: if success, returns object that was saved\n404: if fails returns error in this format {message:\"error in string\"}\n\n**POST /api/tickets/reset**\n* *Open all the tickets that are in the DB*\n* *sets is_booked:false in all documents in tickets collection*\n* payload:\n* {\n\t\"username\": \"admin\",\n\t\"password\": \"password\"\n}\n\n* returns:\n200: if success, returns object that was saved\n404: if fails returns error in this format {message:\"error in string\"}\n\n**MongoDB schema**\n* *Ticket document*\n{\n  \"_id\": {\n    \"$oid\": \"5dfaa42e141c423ce7f54f99\"\n  },\n  \"is_booked\": false,\n  \"date\": {\n    \"$date\": {\n      \"$numberLong\": \"1576707116951\"\n    }\n  },\n  \"seat_number\": {\n    \"$numberInt\": \"3\"\n  },\n  \"passenger\": {\n    \"$oid\": \"5dfa70e1c171c3412314d48d\"\n  }\n}\n* *User document*\n{\n  \"_id\": {\n    \"$oid\": \"5dfa70e1c171c3412314d48d\"\n  },\n  \"name\": \"RK Singh\",\n  \"sex\": \"M\",\n  \"age\": {\n    \"$numberInt\": \"64\"\n  },\n  \"phone\": \"1223123123\",\n  \"email\": \"rksingh@gmail.com\"\n}\n* user can be accessed via the ticket.passenger._id\n\n**Packages used**:\n* \"bcrypt\": \"^3.0.7\" -\u003e used for hashing and storing comparing passwords\n* \"body-parser\": \"^1.19.0\" -\u003e middleware used for parsing the req.body as a json\n* \"dotenv\": \"^8.2.0\" -\u003e to set process environment variables\n* \"express\": \"^4.17.1\" -\u003e for API building blocks\n* \"joi\": \"^14.3.1\" -\u003e Input validation middleware\n* \"mongoose\": \"^5.8.1\" -\u003e MongoDB ORM\n* \"mongoose-unique-validator\": \"^2.0.3\" -\u003e used for maintaining unique phone number among user documents among the whole of the user collection\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchitsingh15%2Fbus-ticket-booking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farchitsingh15%2Fbus-ticket-booking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farchitsingh15%2Fbus-ticket-booking/lists"}