Skip to content

Commit

Permalink
some docstring stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
rohangpta committed Oct 16, 2022
1 parent df42cbd commit c6eca49
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 0 additions & 1 deletion backend/clubs/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ def has_object_permission(self, request, view, obj):
return membership is not None and membership.role <= Membership.ROLE_OFFICER
elif view.action in ["add_to_cart", "remove_from_cart"]:
return request.user.is_authenticated
print("action", view.action)
return True


Expand Down
15 changes: 14 additions & 1 deletion backend/clubs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2462,6 +2462,8 @@ def create_tickets(self, request, *args, **kwargs):
event = self.get_object()
quantities = request.data.get("quantities")

# Atomicity ensures idempotency

Ticket.objects.filter(event=event).delete() # Idempotency
tickets = [
Ticket(event=event, type=item["type"])
Expand Down Expand Up @@ -2657,6 +2659,12 @@ class EventViewSet(ClubEventViewSet):
destroy:
Delete an event.
fair:
Get information about a fair listing
owned:
Return all events that the user has officer permissions over.
"""

def get_operation_id(self, **kwargs):
Expand Down Expand Up @@ -4479,6 +4487,9 @@ class TicketViewSet(viewsets.ModelViewSet):
checkout:
Initiate a hold on the tickets in a user's cart
checkout_success_callback:
Callback after third party payment succeeds
buy:
Buy the tickets in a user's cart
Expand Down Expand Up @@ -4578,7 +4589,7 @@ def checkout(self, request, *args, **kwargs):

# The assumption is that this filter query should return all tickets in the cart
# however we cannot guarantee atomicity between cart and checkout
#

# customers will be prompted to review the cart before payment

tickets = cart.tickets.select_for_update().filter(
Expand Down Expand Up @@ -4638,6 +4649,8 @@ def buy(self, request, *args, **kwargs):
---
"""

# TODO: Implement

# Some logic here to serialize all held tickets down to whatever
# format third party asks for

Expand Down

0 comments on commit c6eca49

Please sign in to comment.