{"id":22276137,"url":"https://github.com/noud/bumbal","last_synced_at":"2025-03-25T17:26:58.821Z","repository":{"id":232644313,"uuid":"784829855","full_name":"noud/bumbal","owner":"noud","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-06T18:33:55.000Z","size":395,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T15:27:50.101Z","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/noud.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":"2024-04-10T16:31:26.000Z","updated_at":"2025-01-23T22:12:51.000Z","dependencies_parsed_at":"2024-04-14T12:41:29.759Z","dependency_job_id":"afce8358-a56c-4fb6-9e4d-846ce8b6a906","html_url":"https://github.com/noud/bumbal","commit_stats":null,"previous_names":["noud/bumbal"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noud%2Fbumbal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noud%2Fbumbal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noud%2Fbumbal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noud%2Fbumbal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noud","download_url":"https://codeload.github.com/noud/bumbal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245509629,"owners_count":20627018,"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":"2024-12-03T14:13:35.968Z","updated_at":"2025-03-25T17:26:58.789Z","avatar_url":"https://github.com/noud.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"### API Server\n\nI was asked to develop a API server with these \n\u003ca href=\"https://github.com/noud/bumbal/blob/main/doc/Test%20assignment%20for%20back-end%20developer.pdf\"\u003eSpecifications\u003c/a\u003e.\n\nTo get me a Laravel Docker project environment i executed \n```\ncurl -s \"https://laravel.build/bumbal?with=mariadb,redis\" | bash\n```\n### Git clone\n\nAfter you have git cloned this repository you have to set the .env file and install the php packages.\nFor this you have to have php \u003e= 8.2.\n```\ncd bumbal \u0026\u0026 cp .env.example .env\ncd bumbal \u0026\u0026 composer install\n```\n\n### Start containers\n\nBe sure to have no local Apache running:\n```\nsudo /etc/init.d/apache2 stop\nsudo systemctl stop apache2.service\n```\n\nTo start the dockered application type\n```\ncd bumbal \u0026\u0026 ./vendor/bin/sail up\n```\n\nIf you are on Windows WSL2 Ubuntu follow the steps in \u003ca href=\"https://stackoverflow.com/questions/66412753/unsupported-operating-system-with-docker-on-windows-10-with-wsl2\"\u003eUnsupported operating system with Docker on windows 10 with wsl2\u003c/a\u003e or \u003ca href=\"https://stackoverflow.com/questions/69876743/unsupported-operating-system-laravel-8-with-sail-on-windows-10-wsl2\"\u003eUnsupported operating system Laravel 8 with Sail on Windows 10 (WSL2)\u003c/a\u003e.\n\nIf it's the first time you did build the containers you have to add the JWT secret to your .env file and run the database migrations.\n```\ncd bumbal \u0026\u0026 ./vendor/bin/sail artisan jwt:secret\ncd bumbal \u0026\u0026 ./vendor/bin/sail artisan migrate\n```\n\nFinally, you can access the application in your web browser at: \u003ca href=\"http://localhost\"\u003ehttp://localhost\u003c/a\u003e.\n\nI get an error,\nsee this browser screenshot:\n\u003cimg src=\"doc/Screenshot from localhost error 2024-04-10 16-58-13.png\"\u003eError\u003c/img\u003e\n\nafter a while i did open another browser tab to  \u003ca href=\"http://localhost\"\u003ehttp://localhost\u003c/a\u003e.\n\nI get\n\u003cimg src=\"doc/Screenshot from localhost 2024-04-10 17-03-53.png\"\u003eLaravel up and running in a docker container with a mariadb container and redis container .\u003c/img\u003e\n\n### Stop containers\n\n```\ncd bumbal \u0026\u0026 ./vendor/bin/sail stop\n```\nto stop the docker container services.\n\n### Database\n\nThere are 2 database migrations for the Employees and the Devices tables.\n- \u003ca href=\"https://github.com/noud/bumbal/blob/main/database/migrations/2024_04_11_142451_create_employees_table.php\"\u003ecreate_employees_table\u003c/a\u003e.\n- \u003ca href=\"https://github.com/noud/bumbal/blob/main/database/migrations/2024_04_11_142556_create_devices_table.php\"\u003ecreate_devices_table\u003c/a\u003e.\n\nDatabase migrations can ben run by:\n```\ncd bumbal \u0026\u0026 .vendor/bin/sail artisan migrate\n```\n\n### Models\n\nThere is the given User model and 2 models for our Employee and Device.\n- \u003ca href=\"https://github.com/noud/bumbal/blob/main/app/Models/Employee.php\"\u003eEmployee\u003c/a\u003e.\n- \u003ca href=\"https://github.com/noud/bumbal/blob/main/app/Models/Device.php\"\u003eDevice\u003c/a\u003e.\n- \u003ca href=\"https://github.com/noud/bumbal/blob/main/app/Models/User.php\"\u003eUser\u003c/a\u003e.\n\n### JWT authentication\n\nFor JWT authentication i add package ```php-open-source-saver/jwt-auth```.\n```\ncd bumbal \u0026\u0026 .vendor/bin/sail composer require php-open-source-saver/jwt-auth\n```\nI added \u003ca href=\"https://github.com/noud/bumbal/blob/main/app/Http/Controllers/api/AuthController.php\"\u003eAuthController.php\u003c/a\u003e\nand made a middelware class \u003ca href=\"https://github.com/noud/bumbal/blob/main/app/Http/Middleware/JwtMiddleware.php\"\u003eJwtMiddleware.php\u003c/a\u003e.\n### API\n\nThere are controllers for the API endpoints.\n\n-\u003ca href=\"https://github.com/noud/bumbal/blob/main/app/Http/Controllers/api/DeviceController.php\"\u003eDeviceController.php\u003c/a\u003e\n\n-\u003ca href=\"https://github.com/noud/bumbal/blob/main/app/Http/Controllers/api/EmployeeController.php\"\u003eEmployeeController.php\u003c/a\u003e\n\nso i have the following API endpoints:\n```\n$ ./vendor/bin/sail  artisan route:list --path=api\n\n  POST      api/v1/device generated::rfbPTr21n5k9VdbM › api\\DeviceController@…\n  GET|HEAD  api/v1/device/{id} generated::xrgLU0DiQJGA912j › api\\DeviceContro…\n  PUT       api/v1/device/{id} generated::3jyx9E0WN0Ft5TRO › api\\DeviceContro…\n  DELETE    api/v1/device/{id} generated::Y66VGT20it2lEz0p › api\\DeviceContro…\n  GET|HEAD  api/v1/devices generated::2SKAf0q5pFkzDl7Z › api\\DeviceController…\n  POST      api/v1/employee generated::Oyto2t82NRC4Hkn5 › api\\EmployeeControl…\n  GET|HEAD  api/v1/employee/{id} generated::kg7mdAHwcOC2RAtI › api\\EmployeeCo…\n  PUT       api/v1/employee/{id} generated::VeGPSn1YQC3vXzei › api\\EmployeeCo…\n  DELETE    api/v1/employee/{id} generated::DftlC7SYvoDkyU3g › api\\EmployeeCo…\n  GET|HEAD  api/v1/employees generated::Mjh2kBh4LxgQgr7a › api\\EmployeeContro…\n  POST      api/v1/login .................... login › api\\AuthController@login\n  POST      api/v1/logout generated::saN84nweRG7Jj3tN › api\\AuthController@lo…\n  POST      api/v1/refresh generated::ZICMVOtuPDzeAIQs › api\\AuthController@r…\n  POST      api/v1/register generated::2eiXG4nVh19v18qL › api\\AuthController@…\n\n                                                           Showing [14] routes\n\n```\n### Routes\n\nThe API routes are defined in \u003ca href=\"https://github.com/noud/bumbal/blob/main/routes/api.php\"\u003eapi.php\u003c/a\u003e.\n\n### PHPUnit tests\n\nThe project has PHPUnit test code, this can be ran like\n```\ncd bumbal \u0026\u0026 ./vendor/bin/sail test\n```\n\nFor the tests i have 3 classes:\n\n-\u003ca href=\"https://github.com/noud/bumbal/blob/main/tests/Feature/AuthControllerTest.php\"\u003eAuthControllerTest.php\u003c/a\u003e\n\n-\u003ca href=\"https://github.com/noud/bumbal/blob/main/tests/Feature/EmployeeControllerTest.php\"\u003eEmployeeControllerTest.php\u003c/a\u003e\n\n-\u003ca href=\"https://github.com/noud/bumbal/blob/main/tests/Feature/DeviceControllerTest.php\"\u003eDeviceControllerTest.php\u003c/a\u003e\n\n### reference\n\nI did read the following articles as refference:\n\n-\u003ca href=\"https://www.avyatech.com/rest-api-with-laravel-8-using-jwt-token/\"\u003eREST API with Laravel 8 using JWT Token\u003c/a\u003e\n\n-\u003ca href=\"https://blog.logrocket.com/implementing-jwt-authentication-laravel-10/\"\u003eImplementing JWT authentication in Laravel 10\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoud%2Fbumbal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoud%2Fbumbal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoud%2Fbumbal/lists"}