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

Generate API Views for front-end #2

Open
7 of 11 tasks
nikolajbaer opened this issue Apr 30, 2019 · 7 comments
Open
7 of 11 tasks

Generate API Views for front-end #2

nikolajbaer opened this issue Apr 30, 2019 · 7 comments
Assignees
Labels
backend Django Related help wanted Extra attention is needed
Milestone

Comments

@nikolajbaer
Copy link
Member

nikolajbaer commented Apr 30, 2019

Title Listing

  • paged listing of Titles, filterable by language & media type, searchable by Title / Author / Description

Title Detail

  • Title information
  • Current Items ( available / total )

TitleRequest Detail

  • Current user's status on TitleRequest (or nothing if not logged in)

TitleRequests for User

  • All current User's Title Requests

Cancel Title Request

  • Authenticated user can cancel a title request they created (if not already a loan)

Loans for User

  • All current User's Loans

Items for User

  • All current User's Items

User Details

  • User profile data (name, email, notification prefs, library card-readonly)
  • Update User Profile data for current user
    Login
  • Login endpoint for user
@nikolajbaer nikolajbaer self-assigned this Apr 30, 2019
@NickEngmann NickEngmann added this to the v1.0 milestone May 19, 2019
@NickEngmann NickEngmann added backend Django Related help wanted Extra attention is needed labels May 24, 2019
@CarlGraff
Copy link
Contributor

I can help with this - just need to coordinate with others on which API views (queries) I will do.

@nikolajbaer
Copy link
Member Author

@CarlGraff why not try doing the loans for user and items for user.

You can reference the ProfileViewSet in lending/authenticated_views.py, but return Loan.objects.filter(item__owner__user=request.user).

Submit a PR and I will review / comment on your Django code.

Also make sure to build a test in the lending/test_api.py, which you can run with manage.py test lending. You can reference my test for the profile view there.

@BolunThompson
Copy link
Collaborator

BolunThompson commented Aug 7, 2019

@nikolajbaer I would be able to help with this, which ones should I do?

@nikolajbaer
Copy link
Member Author

@nikolajbaer I would be able to help with this, which ones should I do?

Great! Try doing some of the "get" ones first, e.g. the "title request", "loans", and "items" for user

@BolunThompson
Copy link
Collaborator

BolunThompson commented Aug 10, 2019

I'm looking at the code and is it just as simple to create "loans for user" by copying ProfileViewSet but then replacing return from ProfileViewSet with "Loan.objects.filter(item__owner__user=request.user)" wrapped in a serializer? Sorry if I'm missing something major, this is my first time working with API views.
@nikolajbaer

@nikolajbaer
Copy link
Member Author

@BolunThompson, looking back, I might have done some of these get views already:

https://github.com/opensandiego/p2p-lending/blob/master/p2plending/lending/authenticated_views.py

It looks like the user's title request view is not done yet, so that might be a good one to start (i think that is stubbed out at the bottom).

If you can make it this coming Tuesday evening (8/20), I would be happy to work with you on that. Otherwise hit me up on slack!

@BolunThompson
Copy link
Collaborator

Okay, I can come next Tuesday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Django Related help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants