{"id":19483521,"url":"https://github.com/librity/ignite_nutri_entities","last_synced_at":"2025-07-18T15:38:09.054Z","repository":{"id":99703988,"uuid":"353253066","full_name":"librity/ignite_nutri_entities","owner":"librity","description":"Rocket Seat - Ignite - Elixir - Challenge 10 - A calories counter backend made with Phoenix.","archived":false,"fork":false,"pushed_at":"2022-02-25T11:59:17.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-17T15:51:22.491Z","etag":null,"topics":["calories-counter","challenge","ecto","elixir","phoenix","rocketseat-ignite"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/librity.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":"2021-03-31T06:39:36.000Z","updated_at":"2021-03-31T17:51:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"ab4be24d-084d-4630-9a28-a88862375c5b","html_url":"https://github.com/librity/ignite_nutri_entities","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"librity/ignite_nutri_tests","purl":"pkg:github/librity/ignite_nutri_entities","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/librity%2Fignite_nutri_entities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/librity%2Fignite_nutri_entities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/librity%2Fignite_nutri_entities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/librity%2Fignite_nutri_entities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/librity","download_url":"https://codeload.github.com/librity/ignite_nutri_entities/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/librity%2Fignite_nutri_entities/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265787237,"owners_count":23828392,"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":["calories-counter","challenge","ecto","elixir","phoenix","rocketseat-ignite"],"created_at":"2024-11-10T20:15:25.415Z","updated_at":"2025-07-18T15:38:09.028Z","avatar_url":"https://github.com/librity.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rocket Seat Ignite - Nutri\n\n## Table of Contents\n\n- [About](#about)\n- [Endpoints](#endpoints)\n- [Setup](#setup)\n- [Bash Commands](#bash_commands)\n- [Elixir Commands](#elixir_commands)\n- [Libs](#libs)\n- [Docs](#docs)\n- [Resources](#resources)\n\n## About \u003ca name = \"about\"\u003e\u003c/a\u003e\n\nA calories counter backend made with Phoenix.\n\n## Endpoints \u003ca name = \"endpoints\"\u003e\u003c/a\u003e\n\nBuilt-in:\n\n- `GET` http://localhost:4000/dashboard\n\n`Meals`\n\n- `GET` http://localhost:4000/api/meals\n- `GET` http://localhost:4000/api/meals/:id\n- `POST` http://localhost:4000/api/meals\n- `PUT` http://localhost:4000/api/meals/:id\n- `DELETE` http://localhost:4000/api/meals/:id\n\n## Setup \u003ca name = \"setup\"\u003e\u003c/a\u003e\n\nInstall `Erlang`, `Elixir` and `Phoenix`.\n\n### Postgres\n\nCreate a postgress docker container with:\n\n```bash\n$ docker run --name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres\n```\n\n## Bash Commands \u003ca name = \"bash_commands\"\u003e\u003c/a\u003e\n\n```bash\n# Create phoenix app without webpacker or html views\n$ mix phx.new app_name --no-webpack --no-html\n\n# Intall dependencies\n$ mix deps.get\n\n# Compile project\n$ mix compile\n\n# Generate linter config file\n$ mix credo.gen.config\n\n# Run linter\n$ mix credo --strict\n\n# Start Phoenix dev server on http://localhost:4000\n$ mix phx.server\n\n# Start your project as an Interactive Elixir session\n$ iex -S mix\n\n# List all configured routes\n$ mix phx.routes\n```\n\nEcto:\n\n```bash\n# Create and migrate database\n$ mix ecto.setup\n\n# Create a migration\n$ mix ecto.gen.migration create_users_table\n\n# Run pending migrations\n$ mix ecto.migrate\n\n# Drop and migrate databases\n$ mix ecto.reset\n\n# Drop databases\n$ mix ecto.drop\n\n# Create databases\n$ mix ecto.create\n```\n\nTests\n\n```bash\n# Run tests\n$ mix test\n\n# Run tests w/ coverage report\n$ mix test --cover\n```\n\n## Elixir Commands \u003ca name = \"elixir_commands\"\u003e\u003c/a\u003e\n\nCreate a meal:\n\n```elixir\n\u003e meal_params = %{\n  description: \"Royal with cheese\",\n  date: \"1994-05-21 12:00:00\",\n  calories: 500\n}\n\u003e Nutri.Meals.Create.call(meal_params)\n```\n\nFetch meals:\n\n```elixir\n\u003e Nutri.Repo.all(Nutri.Meal)\n\u003e Nutri.Repo.get(Nutri.Meal, 1)\n\n\u003e Nutri.get_meals()\n\u003e Nutri.get_meal_by_id(1)\n```\n\nUpdate meal:\n\n```elixir\n\u003e new_meal_params = %{\n  \"id\" =\u003e 1,\n  \"description\" =\u003e \"UPDATEDDDDDDD\",\n  \"date\" =\u003e \"2021-03-24 12:00:00\",\n  \"calories\" =\u003e 1000\n}\n\u003e Nutri.Meals.Update.call(new_meal_params)\n```\n\nDelete meal:\n\n```elixir\n\u003e Nutri.delete_meal(1)\n```\n\n## Libs \u003ca name = \"libs\"\u003e\u003c/a\u003e\n\n- https://github.com/phoenixframework/phoenix\n\n## Docs \u003ca name = \"docs\"\u003e\u003c/a\u003e\n\n- https://elixir-lang.org/crash-course.html\n- https://hexdocs.pm/ecto/Ecto.Changeset.html#validate_number/3\n- https://hexdocs.pm/ecto_sql/Ecto.Migration.html#alter/2\n\n## Resources \u003ca name = \"resources\"\u003e\u003c/a\u003e\n\n- https://www.tutorialspoint.com/elixir/elixir_lists_and_tuples.htm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibrity%2Fignite_nutri_entities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibrity%2Fignite_nutri_entities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibrity%2Fignite_nutri_entities/lists"}