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

3w: Create API #444

Closed
batpad opened this issue Jun 25, 2019 · 7 comments
Closed

3w: Create API #444

batpad opened this issue Jun 25, 2019 · 7 comments

Comments

@batpad
Copy link
Collaborator

batpad commented Jun 25, 2019

Relates to #443 - based on the frontend for the 3w data, create API endpoints to:

  • Get all Projects for a Country
  • Edit existing Project (permissions based on Submitting National Society)
  • Add Project (permissions based on National Society user is logged in with?)

cc @szabozoltan69 @guipizzini

@szabozoltan69
Copy link
Contributor

szabozoltan69 commented Jun 25, 2019

Good idea.
Let's see the details, what do we include into a Project?

@batpad
Copy link
Collaborator Author

batpad commented Jun 26, 2019

@szabozoltan69 I have created the tickets for what we need on the frontend - the form and the visualization.

We will need an API end-point to receive all the details from the form and Create a New Project, based on the model in the database.

We will probably also need an API end-point to EDIT an existing form.

Also, an end-point where we can pass a Country, and it returns all Projects for that Country, with all the details that are in the model.

I think the rest of the filters, etc. can just be implemented directly on the frontend. So, for a start:

  • Endpoint to receive POST data from client and save a new Project
  • Endpoint to receive PUT data from client and edit an existing Project
  • Endpoint to receive GET request from client with Country parameter, returning all Projects for that country (This will be something like Project.objects.filter(district__country=<country>)

We may also need to implement some Permission model so, for example, only a user who belongs to the national society of the reporting_national_society is allowed to post a Project as that National Society. I will get more details of the exact permission model here.

@szabozoltan69 let me know if you might be able to take on any of this work.

@szabozoltan69
Copy link
Contributor

@batpad I can begin to create endpoints for POST and GET parts, later the others.

@batpad
Copy link
Collaborator Author

batpad commented Jun 26, 2019

@szabozoltan69 that sounds fantastic! Let me know if there is anything I can help with - I have started digging into the frontend code and hopefully will be able to start making progress on the form and then the frontend to talk to the APIs.

@szabozoltan69
Copy link
Contributor

szabozoltan69 commented Jun 26, 2019

If I am right, I should do it in the "3w" branch.

@szabozoltan69
Copy link
Contributor

szabozoltan69 commented Jun 26, 2019

I created the first end-point and some tests also, which can be run in the vm via
./manage.py test -k w3
(or simply ./manage.py test -k – for all test cases, or docker-compose run --rm test (outside the vm)

@batpad batpad added this to Goals in IFRC Go Phase 3 Jun 27, 2019
@batpad batpad moved this from Goals to In Progress in IFRC Go Phase 3 Jun 27, 2019
@batpad
Copy link
Collaborator Author

batpad commented Jun 27, 2019

This is done in #451

Great work, @szabozoltan69 !

@batpad batpad closed this as completed Jun 27, 2019
@batpad batpad moved this from In Progress to Done in IFRC Go Phase 3 Jun 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

No branches or pull requests

2 participants