Skip to content

✨(backend) add list of seats of batch order API client (v2 sales tunnel)#1289

Merged
jonathanreveille merged 3 commits intomainfrom
feat/add_orders_vouchers_list_to_batch_order_serializer
Apr 1, 2026
Merged

✨(backend) add list of seats of batch order API client (v2 sales tunnel)#1289
jonathanreveille merged 3 commits intomainfrom
feat/add_orders_vouchers_list_to_batch_order_serializer

Conversation

@jonathanreveille
Copy link
Copy Markdown
Member

@jonathanreveille jonathanreveille commented Feb 17, 2026

Purpose

We want to show the list of the learners that will take part in the batch order. We need to list their fullnames and the voucher code that are available in the batch order.

Proposal

  • Add nested batch order seats viewset
  • Add filterset by owner name
  • Add addition indicators to BatchOrderSerializer API client (seats_owned & seats_to_own)

@jonathanreveille jonathanreveille self-assigned this Feb 17, 2026
@jonathanreveille jonathanreveille force-pushed the feat/add_orders_vouchers_list_to_batch_order_serializer branch 13 times, most recently from c4a3275 to 912fb93 Compare February 23, 2026 14:42
@kernicPanel kernicPanel requested a review from Copilot March 6, 2026 08:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds client-facing support for exposing batch order “seat” information: aggregated seat counters on batch orders, plus a nested endpoint to list/retrieve the individual seats (orders) and their learner/voucher info.

Changes:

  • Added seats_owned / seats_to_own indicators on BatchOrder and exposed them via client serializers (batch orders, quotes, agreements).
  • Introduced a nested /batch-orders/{batch_order_id}/seats/ API (serializer + filter + routing) to list/retrieve batch-order seats.
  • Updated OpenAPI snapshot and expanded test coverage (including perf baselines) for the new fields and endpoint.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/backend/joanie/tests/swagger/swagger.json Adds schema/paths for nested batch-order seats + new seat counters in batch-order schemas.
src/backend/joanie/tests/core/models/test_batch_order.py Adds unit tests for BatchOrder.seats_owned and BatchOrder.seats_to_own.
src/backend/joanie/tests/core/api/quotes/test_api_quotes.py Updates expected quote payload to include seat counters under batch_order.
src/backend/joanie/tests/core/api/organizations/test_api_organizations_quotes.py Updates organization quote API expectations to include seat counters.
src/backend/joanie/tests/core/api/organizations/test_api_organizations_agreements.py Updates agreement API expectations to include seat counters.
src/backend/joanie/tests/core/api/organizations/test_api_organizations_agreements.perf.yml Updates perf baseline to account for extra queries from new counters.
src/backend/joanie/tests/core/api/batch_order/test_retrieve.py Updates batch order retrieve expectations to include seat counters.
src/backend/joanie/tests/core/api/batch_order/test_retrieve.perf.yml Updates perf baseline for batch order retrieve.
src/backend/joanie/tests/core/api/batch_order/test_nested_batch_order_seats.py New test suite covering nested seats list/retrieve, permissions, pagination, and filtering.
src/backend/joanie/tests/core/api/batch_order/test_list.py Updates batch order list expectations to include seat counters.
src/backend/joanie/tests/core/api/batch_order/test_list.perf.yml Updates perf baseline for batch order list.
src/backend/joanie/core/serializers/client.py Exposes seat counters and adds NestedBatchOrderSeatsSerializer.
src/backend/joanie/core/models/products.py Adds seats_owned / seats_to_own properties to BatchOrder.
src/backend/joanie/core/filters/client/init.py Adds a filterset for nested batch-order seats (query filter).
src/backend/joanie/core/api/client/init.py Introduces GenericBatchOrderViewSet and adds NestedBatchOrderSeatsViewSet.
src/backend/joanie/client_urls.py Registers nested batch-order seats routes under /batch-orders/{batch_order_id}/.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/backend/joanie/core/filters/client/__init__.py
Comment thread src/backend/joanie/tests/swagger/swagger.json
Comment thread src/backend/joanie/core/models/products.py Outdated
Comment thread src/backend/joanie/tests/core/api/batch_order/test_nested_batch_order_seats.py Outdated
Comment thread src/backend/joanie/core/serializers/client.py
Comment thread src/backend/joanie/core/api/client/__init__.py Outdated
Comment thread src/backend/joanie/core/api/client/__init__.py Outdated
@jonathanreveille jonathanreveille force-pushed the feat/add_orders_vouchers_list_to_batch_order_serializer branch from 912fb93 to 859ada6 Compare March 6, 2026 15:59
@jonathanreveille jonathanreveille force-pushed the feat/add_orders_vouchers_list_to_batch_order_serializer branch 2 times, most recently from 1542d34 to cac5481 Compare March 9, 2026 15:46
@jonathanreveille jonathanreveille changed the title ✨(backend) add list of seats of batch order API client ✨(backend) add list of seats of batch order API client (v2 sales tunnel batch orders) Mar 16, 2026
@jonathanreveille jonathanreveille changed the title ✨(backend) add list of seats of batch order API client (v2 sales tunnel batch orders) ✨(backend) add list of seats of batch order API client (v2 sales tunnel) Mar 19, 2026
@jonathanreveille jonathanreveille force-pushed the feat/add_orders_vouchers_list_to_batch_order_serializer branch from cac5481 to 38bdf3b Compare April 1, 2026 15:31
We want to show the list of the learners that will take part in
the batch order. We need to list their fullnames and the
voucher code that are available in the batch order.
We want authenticated user who owns a batch order or users with
the right permissions of an organization (role : owner or admin) to
be able to query filter by username,  firstname, lastname, or email
the learners of the batch order.
We want our API consumer to track the amount of seats claimed
and the seats available. We added two new properties `seats_to_own`
and `seats_owned`. We added this information to the different
serializers for our API consumers can have this information from the
learner's dashbaord and from the organization's dashboard.
@jonathanreveille jonathanreveille force-pushed the feat/add_orders_vouchers_list_to_batch_order_serializer branch from 38bdf3b to d125c21 Compare April 1, 2026 15:34
@jonathanreveille jonathanreveille merged commit 80a1486 into main Apr 1, 2026
17 checks passed
@jonathanreveille jonathanreveille deleted the feat/add_orders_vouchers_list_to_batch_order_serializer branch April 1, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants