{"id":19558502,"url":"https://github.com/mach-kernel/restaurant-schema-challenge","last_synced_at":"2025-10-09T22:33:46.428Z","repository":{"id":146171390,"uuid":"66891921","full_name":"mach-kernel/restaurant-schema-challenge","owner":"mach-kernel","description":"leveraging cross-platform synergies, the finest enterprise buzzwords, and probably microsoft edge","archived":false,"fork":false,"pushed_at":"2017-04-21T16:51:17.000Z","size":12070,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-09T22:33:16.794Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/mach-kernel.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":"2016-08-30T00:39:32.000Z","updated_at":"2017-04-21T16:54:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"997306ee-18bf-4196-8690-ada6c958332a","html_url":"https://github.com/mach-kernel/restaurant-schema-challenge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mach-kernel/restaurant-schema-challenge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mach-kernel%2Frestaurant-schema-challenge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mach-kernel%2Frestaurant-schema-challenge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mach-kernel%2Frestaurant-schema-challenge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mach-kernel%2Frestaurant-schema-challenge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mach-kernel","download_url":"https://codeload.github.com/mach-kernel/restaurant-schema-challenge/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mach-kernel%2Frestaurant-schema-challenge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002107,"owners_count":26083307,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-11-11T04:47:18.937Z","updated_at":"2025-10-09T22:33:46.410Z","avatar_url":"https://github.com/mach-kernel.png","language":"JavaScript","readme":"# restaurant-schema-challenge\nleveraging cross-platform synergies, the finest enterprise buzzwords, and probably microsoft edge\n\n\n[![Code Climate](https://codeclimate.com/github/mach-kernel/restaurant-schema-challenge/badges/gpa.svg)](https://codeclimate.com/github/mach-kernel/restaurant-schema-challenge)\n[![Test Coverage](https://codeclimate.com/github/mach-kernel/restaurant-schema-challenge/badges/coverage.svg)](https://codeclimate.com/github/mach-kernel/restaurant-schema-challenge/coverage)\n[![CircleCI](https://circleci.com/gh/mach-kernel/restaurant-schema-challenge/tree/master.svg?style=shield)](https://circleci.com/gh/mach-kernel/restaurant-schema-challenge/tree/master)\n\n## Getting Started\n\n### Requirements\n- node.js runtime with npm\n- mongodb\n\n### Setup\n```bash\ngit clone\nbundle\nrake db:mongoid:create_indexes\nrake db:seed\nnpm install\nforeman start (might want to background this or use sep. tmux tab)\nrails s\n```\n\n## API\n\n### HAL\nThe resource schemas use [HAL](http://stateless.co/hal_specification.html). As a brief overview, HAL allows a user to traverse API resource relationships as each entity (ideally) should be reflective.\n\nFor example, to access a location that is associated with a brand, just navigate to its resource URL, or in this case, `/v1/location/57cee2ebb4ed495608b1cfe7`. `self` will be present for each request, to show the user where they are, and for each entity, to allow easy traversal. \n\n```javascript\n{\n  \"name\": \"McDonalds\",\n  \"links\": [\n    {\n      \"rel\": \"self\",\n      \"href\": \"http:\\/\\/localhost:3000\\/v1\\/brand\\/57cee2ebb4ed495608b1cfe5\"\n    }\n  ],\n  \"locations\": [\n    {\n      \"name\": \"McLoc 0\",\n      \"links\": [\n        {\n          \"rel\": \"self\",\n          \"href\": \"http:\\/\\/localhost:3000\\/v1\\/location\\/57cee2ebb4ed495608b1cfe7\"\n        },\n        {\n          \"rel\": \"brand\",\n          \"href\": \"http:\\/\\/localhost:3000\\/v1\\/brand\\/57cee2ebb4ed495608b1cfe5\"\n        }\n      ],\n      \"order_types\": [...],\n      \"day_parts\": [...]\n    },\n  ]\n}\n```\n\n### Resources\n\n- Brand\n  - Location\n    - Order Type\n    - Day Part (optional member)\n  - Menu Item\n    - Price Level (optional member)\n\nEach resource supports standard `CRUD` operation (and thereby has an endpoint), and has its own entity in `app/entities`. Calling `GET` on a resource without an ID will use a generic `List` entity presenter with each resource present under `links/resources` array. When `GET`-ing a resource with an ID, all child documents will be sideloaded along with their children, into the response body.\n\n**Note on deletions**: If you `DELETE` a parent entity, such as `Location` or `Brand`, you will also delete its children!\n\n### Example Requests\n\n#### I want to see what brands I track\n\n##### Request\n`GET /v1/brand`\n\n##### Response\n```javascript\n{\n  \"links\": [\n    {\n      \"rel\": \"self\",\n      \"href\": \"http:\\/\\/localhost:3000\\/v1\\/brand\"\n    },\n    {\n      \"rel\": \"resources\",\n      \"href\": [\n        \"http:\\/\\/localhost:3000\\/v1\\/brand\\/57cee2ebb4ed495608b1cfe5\",\n        \"http:\\/\\/localhost:3000\\/v1\\/brand\\/57cee2ebb4ed495608b1cfe6\"\n      ]\n    }\n  ]\n}\n```\n\n#### I want to get a brand by ID\n\n##### Request\n`GET /v1/brand/57cee2ebb4ed495608b1cfe5`\n\n##### Response\n```javascript\n{\n  \"name\": \"McDonalds\",\n  \"links\": [\n    {\n      \"rel\": \"self\",\n      \"href\": \"http:\\/\\/localhost:3000\\/v1\\/brand\\/57cee2ebb4ed495608b1cfe5\"\n    }\n  ],\n  \"locations\": [\n    {\n      \"name\": \"McLoc 0\",\n      \"links\": [\n        {\n          \"rel\": \"self\",\n          \"href\": \"http:\\/\\/localhost:3000\\/v1\\/location\\/57cee2ebb4ed495608b1cfe7\"\n        },\n        {\n          \"rel\": \"brand\",\n          \"href\": \"http:\\/\\/localhost:3000\\/v1\\/brand\\/57cee2ebb4ed495608b1cfe5\"\n        }\n      ],\n      \"order_types\": [\n        {\n          \"name\": \"Sit-In 0\",\n          \"links\": [\n            {\n              \"rel\": \"self\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/order_type\\/57cee2ebb4ed495608b1d005\"\n            },\n            {\n              \"rel\": \"location\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/location\\/57cee2ebb4ed495608b1d005\"\n            }\n          ]\n        },\n        {\n          \"name\": \"Pigeon 0\",\n          \"links\": [\n            {\n              \"rel\": \"self\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/order_type\\/57cee2ebb4ed495608b1d00a\"\n            },\n            {\n              \"rel\": \"location\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/location\\/57cee2ebb4ed495608b1d00a\"\n            }\n          ]\n        }\n      ],\n      \"day_parts\": [\n        {\n          \"name\": \"Breakfast 0\",\n          \"links\": [\n            {\n              \"rel\": \"self\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/day_part\\/57cee2ebb4ed495608b1cff1\"\n            },\n            {\n              \"rel\": \"location\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/location\\/57cee2ebb4ed495608b1cff1\"\n            }\n          ]\n        },\n        {\n          \"name\": \"Dinner 0\",\n          \"links\": [\n            {\n              \"rel\": \"self\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/day_part\\/57cee2ebb4ed495608b1cff6\"\n            },\n            {\n              \"rel\": \"location\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/location\\/57cee2ebb4ed495608b1cff6\"\n            }\n          ]\n        }\n      ]\n    },\n  ],\n  \"menu_items\": [\n    {\n      \"name\": \"McThing\",\n      \"links\": [\n        {\n          \"rel\": \"self\",\n          \"href\": \"http:\\/\\/localhost:3000\\/v1\\/menu_item\\/57cee2ebb4ed495608b1d019\"\n        },\n        {\n          \"rel\": \"brand\",\n          \"href\": \"http:\\/\\/localhost:3000\\/v1\\/brand\\/57cee2ebb4ed495608b1cfe5\"\n        }\n      ],\n      \"price_levels\": [\n        {\n          \"name\": \"Price for McThing, Breakfast 0, Sit-In 0\",\n          \"links\": [\n            {\n              \"rel\": \"self\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/price_level\\/57cee2ebb4ed495608b1d01d\"\n            },\n            {\n              \"rel\": \"order_type\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/order_type\\/57cee2ebb4ed495608b1d01d\"\n            },\n            {\n              \"rel\": \"menu_item\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/menu_item\\/57cee2ebb4ed495608b1d01d\"\n            },\n            {\n              \"rel\": \"day_part\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/day_part\\/57cee2ebb4ed495608b1d01d\"\n            }\n          ],\n          \"amount\": \"79\"\n        },\n        {\n          \"name\": \"Price for McThing, Dinner 2, Sit-In 2\",\n          \"links\": [\n            {\n              \"rel\": \"self\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/price_level\\/57cee2ebb4ed495608b1d01f\"\n            },\n            {\n              \"rel\": \"order_type\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/order_type\\/57cee2ebb4ed495608b1d01f\"\n            },\n            {\n              \"rel\": \"menu_item\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/menu_item\\/57cee2ebb4ed495608b1d01f\"\n            },\n            {\n              \"rel\": \"day_part\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/day_part\\/57cee2ebb4ed495608b1d01f\"\n            }\n          ],\n          \"amount\": \"68\"\n        },\n        {\n          \"name\": \"Price for McThing, Dinner 4, Sit-In 4\",\n          \"links\": [\n            {\n              \"rel\": \"self\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/price_level\\/57cee2ebb4ed495608b1d021\"\n            },\n            {\n              \"rel\": \"order_type\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/order_type\\/57cee2ebb4ed495608b1d021\"\n            },\n            {\n              \"rel\": \"menu_item\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/menu_item\\/57cee2ebb4ed495608b1d021\"\n            },\n            {\n              \"rel\": \"day_part\",\n              \"href\": \"http:\\/\\/localhost:3000\\/v1\\/day_part\\/57cee2ebb4ed495608b1d021\"\n            }\n          ],\n          \"amount\": \"68\"\n        }\n      ]\n    },\n  ]\n}\n```\n\n#### I want to get the pricing for a menu item given other parameters\n\n##### Request\n`GET /v1/menu_item/:id/price?order_type_id=x\u0026day_part_id=y`\n\n##### Response\n```javascript\n{\n  \"name\": \"Price for McThing, Dinner 4, Sit-In 4\",\n  \"links\": [\n    {\n      \"rel\": \"self\",\n      \"href\": \"http:\\/\\/localhost:3000\\/v1\\/price_level\\/57cee2ebb4ed495608b1d021\"\n    },\n    {\n      \"rel\": \"order_type\",\n      \"href\": \"http:\\/\\/localhost:3000\\/v1\\/order_type\\/57cee2ebb4ed495608b1d021\"\n    },\n    {\n      \"rel\": \"menu_item\",\n      \"href\": \"http:\\/\\/localhost:3000\\/v1\\/menu_item\\/57cee2ebb4ed495608b1d021\"\n    },\n    {\n      \"rel\": \"day_part\",\n      \"href\": \"http:\\/\\/localhost:3000\\/v1\\/day_part\\/57cee2ebb4ed495608b1d021\"\n    }\n  ],\n  \"amount\": \"68\"\n}\n```\n\n## Testing\n\n- Run all tests with `rake`\n- When developing, run `guard` to watch the filesystem for changes\n- Linting done by `rubocop` to [preserve style](https://xkcd.com/1513/)\n- Please write a test for any new functionality\n\n## TODO\n\n- Don't include link to parent when sideloading from parent\n- Put sideloaded resources into `_embedded` instead of root property to be more standard-compliant.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmach-kernel%2Frestaurant-schema-challenge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmach-kernel%2Frestaurant-schema-challenge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmach-kernel%2Frestaurant-schema-challenge/lists"}