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

API: Create endpoints for checkin lists #2381

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Conversation

tienne-B
Copy link
Member

@tienne-B tienne-B commented Jan 7, 2024

This commit creates a new endpoint which emulates the functionality of the availabilities endpoint, but for checkins. This endpoint thus has a couple of verbs available:

  • GET: Retrieve a list of objects which are currently checked-in
  • POST: Check-out the listed objects
  • PUT: Check-in the listed objects
  • PATCH: Toggle the check-in status for the listed objects.

Differently to the availabilities endpoint, each item is an object which can be referred to by its identifier barcode or the object's API URL, for flexibility. It also includes the time of check-in.

With the different windows of time before types of checkins expire, in the case where multiple types that may conflict (when listing or toggling) are requested, the shorter of the two shall have precedence.

This endpoint will be useful as it'd be much easier to get the statuses than through accessing everyone's _checkin link individually. This will facilitate uses such as visualizing statuses, or more basically, check-in a full institution at once.

The current endpoint is however DB-inefficient due to django-polymorphic overriding .select_related() and thus breaking it for polymorphic models, which identifiers are.

As a little more efficiency, the tournament/round URL parameters now default to being found in the serializer context rather than through further joins.

Fixes #2087
Fixes #2353
Fixes #2377

This commit creates a new endpoint which emulates the functionality of
the availabilities endpoint, but for checkins. This endpoint thus has a
couple of verbs available:
* GET: Retrieve a list of objects which are currently checked-in
* POST: Check-out the listed objects
* PUT: Check-in the listed objects
* PATCH: Toggle the check-in status for the listed objects.

Differently to the availabilities endpoint, each item is an object which
can be referred to by its identifier barcode or the object's API URL,
for flexibility. It also includes the time of check-in.

With the different windows of time before types of checkins expire, in
the case where multiple types that may conflict (when listing or
toggling) are requested, the shorter of the two shall have precedence.

This endpoint will be useful as it'd be much easier to get the statuses
than through accessing everyone's `_checkin` link individually. This
will facilitate uses such as visualizing statuses, or more basically,
check-in a full institution at once.

The current endpoint is however DB-inefficient due to django-polymorphic
overriding `.select_related()` and thus breaking it for polymorphic
models, which identifiers are.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant