Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Todo List REST API #53

Closed
8 tasks done
nelsonic opened this issue Nov 29, 2022 · 2 comments · Fixed by #60
Closed
8 tasks done

Feat: Todo List REST API #53

nelsonic opened this issue Nov 29, 2022 · 2 comments · Fixed by #60

Comments

@nelsonic
Copy link
Member

nelsonic commented Nov 29, 2022

Once deployed to Fly.io with CI/CD #52 and auth is added #37
we should add a basic REST API endpoint to CRUD Todo List items.

Why?

As part of building a full-stack App using our chosen Tech Stack https://github.com/dwyl/technology-stack#the-petal-stack
We want to build the backend API in Phoenix.
This mini tutorial is the perfect place to showcase building such an API because all the ground-work is already done for Todo list items.

Todo

  • in the same Phoenix App, create a new api_controller.ex for CRUD-ing the Todo list items (you can use :pipe_through :json).

    Remember our objective is to leverage as much of the existing work in this repo as possible. 🙏

  • Create an API Endpoint for Creating a new todo list item and test it via cURL (or Postman)
    • Should accept a JSON payload with the necessary data, e.g:
    1. person_id (Int)
    2. status (Int)
    3. text (String)

schema "items" do
field :person_id, :integer, default: 0
field :status, :integer, default: 0
field :text, :string

  • Should create a new Todo item if the data is valid

  • Create a REST API Endpoint for editing the Todo list item.text:

    • Signature: POST /items/:id/
    • Should accept the item.id (Int) and item.text (String) and return 200 if successful. 🆗
  • Create REST API Endpoint for Updating the status of the item i.e. setting it to "done" ✅

Relevant Learning

Please read: https://github.com/dwyl/phoenix-content-negotiation-tutorial 👀
And if you have any questions regarding content negotiation please open an issue. 🆕

For this project we don't need to have all the same routes we just need:

  1. Create 🆕
  2. Edit 📝
  3. Update status ✅
@nelsonic
Copy link
Member Author

@LuchoTurtle assigning this to you. But if anything is unclear please comment. 💬 🙏

@nelsonic
Copy link
Member Author

nelsonic commented Dec 2, 2022

@LuchoTurtle please see: dwyl/hits#168 🔗

@LuchoTurtle LuchoTurtle moved this from 🔖 Ready for Development to 🏗 In progress in dwyl app kanban Dec 12, 2022
LuchoTurtle added a commit that referenced this issue Dec 13, 2022
LuchoTurtle added a commit that referenced this issue Dec 13, 2022
LuchoTurtle added a commit that referenced this issue Dec 13, 2022
@LuchoTurtle LuchoTurtle moved this from 🏗 In progress to ⏳Awaiting Review in dwyl app kanban Dec 28, 2022
nelsonic added a commit that referenced this issue Dec 30, 2022
@github-project-automation github-project-automation bot moved this from ⏳Awaiting Review to ✅ Done in dwyl app kanban Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants