{"id":16750003,"url":"https://github.com/hakobyansen/sites-app","last_synced_at":"2025-03-16T04:20:09.555Z","repository":{"id":232035029,"uuid":"771555162","full_name":"hakobyansen/sites-app","owner":"hakobyansen","description":"Example REST API implementation","archived":false,"fork":false,"pushed_at":"2024-03-19T06:31:13.000Z","size":130,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T16:48:21.333Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/hakobyansen.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}},"created_at":"2024-03-13T14:11:42.000Z","updated_at":"2024-04-07T13:24:27.000Z","dependencies_parsed_at":"2024-04-07T15:41:00.847Z","dependency_job_id":null,"html_url":"https://github.com/hakobyansen/sites-app","commit_stats":null,"previous_names":["hakobyansen/sites-app"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakobyansen%2Fsites-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakobyansen%2Fsites-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakobyansen%2Fsites-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hakobyansen%2Fsites-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hakobyansen","download_url":"https://codeload.github.com/hakobyansen/sites-app/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243823208,"owners_count":20353630,"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-10-13T02:26:43.700Z","updated_at":"2025-03-16T04:20:09.521Z","avatar_url":"https://github.com/hakobyansen.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sites sample app\n\n## Up and running\n\nHere I describe how to get the project up and running via `docker compose`.\n\n1. Make sure you have Docker Desktop application running\n2. Open the terminal and navigate to the project root directory\n3. Copy and run the following command to install required composer dependencies\n```shell\ndocker run --rm \\\n    -u \"$(id -u):$(id -g)\" \\\n    -v \"$(pwd):/var/www/html\" \\\n    -w /var/www/html \\\n    laravelsail/php83-composer:latest \\\n    composer install --ignore-platform-reqs\n```\n4. Run the following command to get the project up and running:\n\n```shell\nvendor/bin/sail up \n```\n\n5. Once the app is up and running, open new terminal, navigate to project root \nand run command `vendor/bin/sail artisan migrate --seed`. \nIt will create the DB table and add Root User (root@sites.app) . We need at least one user to be able to generate API key, user is tokenable by default.\n\n\nNext you can start testing the app.\n\n## Curl queries\n\n### Create site\n\nThe following command creates new site:\n\n```shell\ncurl -X POST --location \"http://localhost/api/v1/site\" \\\n    -H \"Content-Type: application/json\" \\\n    -H \"Accept: application/json\" \\\n    -d \"{\n          \\\"name\\\": \\\"Test store\\\",\n          \\\"type\\\": \\\"shpp\\\",\n          \\\"address\\\": {\n            \\\"street\\\": \\\"Fake street\\\",\n            \\\"city\\\": \\\"New York\\\",\n            \\\"state\\\": \\\"NY\\\",\n            \\\"zip\\\": \\\"00000\\\",\n            \\\"country\\\": \\\"USA\\\"\n          }\n        }\"\n```\n\n### Update site\n\nThe following command updates the site by ID (change the ID in the path):\n\n```shell\ncurl -X PUT --location \"http://localhost/api/v1/site/37\" \\\n    -H \"Content-Type: application/json\" \\\n    -H \"Accept: application/json\" \\\n    -d \"{\n          \\\"name\\\": \\\"Test store edited\\\",\n          \\\"type\\\": \\\"shop (edited))\\\",\n          \\\"address\\\": {\n            \\\"street\\\": \\\"Fake street\\\",\n            \\\"city\\\": \\\"New York\\\",\n            \\\"state\\\": \\\"NY\\\",\n            \\\"zip\\\": \\\"22222\\\",\n            \\\"country\\\": \\\"USA\\\"\n          }\n        }\"\n```\n\n### Get site\n\nThe following command retrieves site by ID:\n\n```shell\ncurl -X GET --location \"http://localhost/api/v1/site/37\" \\\n    -H \"Content-Type: application/json\" \\\n    -H \"Accept: application/json\"\n```\n\n### Find site by type\n\nThe following command searches site by type (change `type` parameter in query string):\n\n```shell\ncurl -X GET --location \"http://localhost/api/v1/site/find-by-type?type=market\" \\\n    -H \"Content-Type: application/json\" \\\n    -H \"Accept: application/json\"\n```\n\n### Delete site\n\nThe following command deletes site by ID:\n\n```shell\ncurl -X DELETE --location \"http://localhost/api/v1/site/36\" \\\n    -H \"Content-Type: application/json\" \\\n    -H \"Accept: application/json\"\n```\n\nActually there is more to refactor and improve in the app, but it requires more time to spend.\nE.g. I could define messages in lang/ directory or could add more integration tests for components like SiteHelper for test coverage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhakobyansen%2Fsites-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhakobyansen%2Fsites-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhakobyansen%2Fsites-app/lists"}