{"id":25185877,"url":"https://github.com/mazensayed91/fleet-management-system","last_synced_at":"2025-10-16T13:16:19.491Z","repository":{"id":111422107,"uuid":"468633025","full_name":"Mazensayed91/fleet-management-system","owner":"Mazensayed91","description":null,"archived":false,"fork":false,"pushed_at":"2022-03-12T14:28:07.000Z","size":137,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T19:43:17.622Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/Mazensayed91.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":"2022-03-11T06:19:20.000Z","updated_at":"2022-03-11T20:20:23.000Z","dependencies_parsed_at":"2023-03-27T22:18:58.182Z","dependency_job_id":null,"html_url":"https://github.com/Mazensayed91/fleet-management-system","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mazensayed91%2Ffleet-management-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mazensayed91%2Ffleet-management-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mazensayed91%2Ffleet-management-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mazensayed91%2Ffleet-management-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mazensayed91","download_url":"https://codeload.github.com/Mazensayed91/fleet-management-system/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149459,"owners_count":20891949,"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-02-09T19:40:42.944Z","updated_at":"2025-10-16T13:16:14.457Z","avatar_url":"https://github.com/Mazensayed91.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rakabny \u003cimg src=\"https://user-images.githubusercontent.com/54520113/158013941-aeb34c8f-b3f1-47d7-b789-5be3a8ae00ca.png\" width=\"50\" height=\"30\"\u003e\n\nRakabny is a fleet management system that aims to make it easy for each person to book his trip seat!\n\n## Technology Stack\n- Language: PHP 8.1.2\n- Frameworks: Laravel 9\n- DB: SQLite\n- Authentication: Sanctum\n- Unit-Testing: PHPUnit\n\n## Prerequisites\n\n- PHP 8\n- Composer\n\n## Getting Started\n\n- Clone the repo ```https://github.com/Mazensayed91/fleet-management-system.git```\n- ```cd fleet-management-system```\n- Install composer packages ```composer install```\n- Install NPM packages ```npm install```\n- Create database.sqlite file inside the database folder\n- ```php artisan migrate```  \n- ```php artisan db:seed --class=DatabaseSeeder```\n- ```php artisan serve```\n\n\n\n## API Reference\n\n### Getting Started\n\n* Base URL:This application is hosted locally at `http://localhost:8000/`. A public URL will be added here once the application is deployed.\n\n### Error Handling\n\nErrors are returned as JSON and are formatted in the following manner:\u003cbr\u003e\n```\n    {\n        \"error\": \"404\",\n        \"message\": \"No available seats\"\n    }\n``` \n```\n    {\n        \"error\": \"404\",\n        \"message\": \"Station not found\"\n    }\n```\n\n```\n    {\n        \"error\": \"404\",\n        \"message\": \"No trips found with this id, fetch trips to find a suitable trip id\"\n    }\n```\n```\n    {\n        \"error\": \"401\"\n        \"message\": \"Unauthenticated.\"\n    }\n```\nExample errors the user may incounter using Rakabny:\n\n* 400 – bad request\n* 404 – resource not found\n* 401 – Unauthenticated\n\n### Endpoints\n\n#### GET /api/trips\n\n* General: Returns a list trips that fall in a given range.\n* Sample: `curl http://localhost:8000/trips`\u003cbr\u003e\n* Message body:\n```\n         {\n\t        \"start_station\": \"Cairo\",\n\t        \"end_station\": \"Asyut\"\n        } \n```\n* Message Header:\n  ```\n         {\n\t        \"Authorization\": your bearer token,\n            \"Content-Type\": \"application/json\",\n            \"Accept\": \"application/json\"\n         }\n  ```\n* Return:\n```\n        [\n            {\n                \"trip_id\": 1,\n                \"bus_id\": 6,\n                \"start_station\": \"Cairo\",\n                \"end_station\": \"El-Auxor\",\n                \"available_seats\": 7,\n                \"start_trip_order\": 1,\n                \"end_trip_order\": 6\n            },\n            {\n                \"trip_id\": 4,\n                \"bus_id\": 5,\n                \"start_station\": \"Cairo\",\n                \"end_station\": \"El-Giza\",\n                \"available_seats\": 12,\n                \"start_trip_order\": 1,\n                \"end_trip_order\": 5\n            },\n            {\n                \"trip_id\": 6,\n                \"bus_id\": 2,\n                \"start_station\": \"Cairo\",\n                \"end_station\": \"Asyut\",\n                \"available_seats\": 12,\n                \"start_trip_order\": 1,\n                \"end_trip_order\": 5\n            }\n        ]\n```\n\n#### POST /api/book\n\n* General:\n* Sample: `curl http://localhost:8000/book`\u003cbr\u003e\n* Message body:\n  ```\n         {\n\t        \"start_station\": \"Cairo\",\n\t        \"end_station\": \"Asyut\",\n            \"trip_id\": 4\n        }\n  ```\n* Message Header:\n  ```\n         {\n\t        \"Authorization\": your bearer token,\n            \"Content-Type\": \"application/json\",\n            \"Accept\": \"application/json\"\n         }\n  ```\n* Return:\n  ```\n    {\n\t    \"success\": \"Trip booked successfully\"\n    }\n   ```\n\n#### POST /api/register\n\n* General:\n* Sample: `curl http://localhost:8000/register`\u003cbr\u003e\n* Message body:\n  ```\n         {\n            \"name\": \"Mazen\",\n            \"email\": \"mazen99@gmail.com\",\n            \"password\": \"mazen@gmail.com\",\n            \"password_confirmation\": \"mazen@gmail.com\"\n         }\n  ```\n* Return:\n  ```\n        {\n            \"success\": \"Trip booked successfully\"\n        }\n   ```\n * If user already exists:\n   ```\n       {\n            \"message\": \"Email already exists\"\n       }\n   ```\n   \n#### POST /api/login\n\n* General:\n* Sample: `curl http://localhost:8000/loign`\u003cbr\u003e\n* Message body:\n  ```\n        {\n            \"email\": \"mazen@gmail.com\",\n            \"password\": \"mazen@gmail.com\"\n        }\n  ```\n* Return:\n  ```\n    {\n        \"user\": {\n            \"id\": 1,\n            \"name\": \"Mazen\",\n            \"email\": \"mazen@gmail.com\",\n            \"email_verified_at\": null,\n            \"created_at\": \"2022-03-11T22:29:14.000000Z\",\n            \"updated_at\": \"2022-03-11T22:29:14.000000Z\"\n\t    },\n\t    \"token\": a bearer token\n    }\n   ```\n   \n#### POST /api/logout\n\n* General:\n* Sample: `curl http://localhost:8000/book`\u003cbr\u003e\n* Message Header:\n  ```\n         {\n\t        \"Authorization\": your bearer token\n         }\n  ```\n* Return:\n  ```\n    {\n        \"message\": \"Logged out\",\n        \"status\": 200\n    }\n   ```\n## Unit Testing\nI believe that unit tests are a one of the best ways to document the project. To learn what functionality is provided by one module or another, developers can refer to unit tests to get a basic picture of the logic of the module and the system as a whole. \n\nUnit testing in this project is seprated into 3 main test specs to test (Authentication - Fetching Trips - Booking)\n\nTo run all unit tests: ```php artisan test```\n\n\n#### Authentication Unit Testing\n| UnitTest                        |                  Description                 | Expected Return |\n| ------------------------------- | ---------------------------------------------|-----------------|\n|test_register_happy_scenario     | Tests creating account with valid data       |     201         |\n|test_register_existing_email     | Tests creating account with duplicate data   |     404         |\n\n#### Booking Unit Testing\n| UnitTest                           |                  Description                 | Expected Return |\n| ---------------------------------- | ---------------------------------------------|-----------------|\n|test_booking_without_authentication | Tests booking without authentication         |     401         |\n|test_booking_happy_scenario         | Tests fetching trips using Bearer token      |     200         |\n|test_booking_no_available_seet      | Tests fetching trips without available seets |     404         |\n|test_booking_non_existing_trip      | Tests booking with a non existing stations   |     404         |\n|test_booking_non_existing_trip_id   | Tests booking with a non existing trip id    |     404         |\n\n\n#### Trip Fetching Unit Testing\n\n| UnitTest                                  |                  Description                     | Expected Return |\n| ------------------------------------------| -------------------------------------------------|-----------------|\n|test_fetching_trips_without_authentication | Tests fetching trips without authentication      |     401         |\n|test_fetching_trips_happy_scenario         | Tests fetching trips using Bearer token          |     200         |\n|test_fetching_trips_non_existing_stations  | Tests fetching trips with a non exsiting stations|     404         |\n\n\n\n## Database\n![Untitled Workspace (1)](https://user-images.githubusercontent.com/54520113/157956845-f10a1bf3-cc61-4803-b578-fdd85e4adf08.png)\n\n## What Next?\n\n- Add dates to trips\n- Add details to the busses like driver name and estimated time using this bus\n- Deploy the application\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmazensayed91%2Ffleet-management-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmazensayed91%2Ffleet-management-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmazensayed91%2Ffleet-management-system/lists"}