activist icon indicating copy to clipboard operation
activist copied to clipboard

Events API

Open to-sta opened this issue 1 year ago • 13 comments
trafficstars

Terms

Description

We are starting with creating the API's that will be used by the frontend in production soon 😃.

We are using django-rest-framework in the backend to create our API's. ViewSets in particular the ModelViewSet are used for creating the different HTTP methods. Another benefit of using the ModelViewSet is that we are getting some validation from the model itself and only need to extend that in the serializer if necessary.

Have look at the scheme and the models.py file.

Task is to implement all these methods for the OrganizationViewSet that represent the different HTTP methods:

def list(self, request):
    pass

def create(self, request):
    pass

def retrieve(self, request, pk=None):
    pass

def update(self, request, pk=None):
    pass

def partial_update(self, request, pk=None):
    pass

def destroy(self, request, pk=None):
    pass

The API generally is a combiniation of:

  • views.py
  • serializer.py
  • models.py

Also feel free to suggest changes to the model, in case it is necessary for the logic. They are not set in stone 😃. In terms of testing, you can use Swagger UI for manuall testing (backend endpoint: /v1/schema/swagger-ui/).

[!NOTE] Please use an appropiate http status code for your responses.

Contribution

I am happy to help with this issue.

to-sta avatar Dec 26 '23 16:12 to-sta

Do you want to work on this issue @bharath637462 ?

to-sta avatar Dec 26 '23 16:12 to-sta

Yes @bharath637462, let's keep it to one API for now :)

andrewtavis avatar Dec 26 '23 16:12 andrewtavis

We can work on others as soon as some are finished.

andrewtavis avatar Dec 26 '23 16:12 andrewtavis

yes @to-sta

bharath637462 avatar Dec 26 '23 16:12 bharath637462

Let's please finish the work for the current frontend issue before starting on this one as well, @bharath637462.

andrewtavis avatar Dec 26 '23 16:12 andrewtavis

@to-sta but event has already api written on it class EventViewSet(viewsets.ModelViewSet[Event]): queryset = Event.objects.all() serializer_class = EventSerializer pagination_class = CustomPagination throttle_classes = [AnonRateThrottle, UserRateThrottle]

at backend/events/views.py

what shold i do could you please explain breifly

bharath637462 avatar Dec 26 '23 16:12 bharath637462

@bharath637462, this is the PR for resources. That would roughly be what we're looking for :)

andrewtavis avatar Dec 26 '23 16:12 andrewtavis

Hi @andrewtavis, was wondering if this issue is still open and what is needed to be done. I am looking at another issue #621 as well. Do let me know which issue you would like me to work on.

UnknownSean8 avatar Dec 30 '23 18:12 UnknownSean8

Hey @UnknownSean8 👋 We're holding off on this issue for now. If you had thoughts on #621 then by all means write in there as we definitely need to think about how locations will be modeled on the platform. Your input would be invaluable! Also let me know on #527 as I mentioned most in the close of the other one you worked on :)

andrewtavis avatar Dec 30 '23 18:12 andrewtavis

Ah okay, no problem, I am happy to work on #527. I saw that it's referencing #597 as well. Perhaps you could highlight the features/fixes that you would like me to work on so that I can better implement what you had in mind and assign me to it as well?

Thanks :D

UnknownSean8 avatar Dec 30 '23 18:12 UnknownSean8

Thank you, @UnknownSean8! Do you want to write in there so I can assign and we can go from there with me outlining it more?

andrewtavis avatar Dec 30 '23 18:12 andrewtavis

Hi @andrewtavis, are we still holding off on this issue?

josueemartinezz avatar Mar 02 '24 23:03 josueemartinezz

I think it'd be alright for you to give this a go, @josueemartinezz :) Let us know if you need any help here!

andrewtavis avatar Mar 03 '24 23:03 andrewtavis