Skip to content

Conversation

@ThyMinimalDev
Copy link
Contributor

@ThyMinimalDev ThyMinimalDev commented Dec 4, 2025

What does this PR do?

Adds support for filtering round robin event type hosts via API v2. When hostSubsetIds is provided, only the specified hosts are considered for availability calculation and booking assignment.

This allows API consumers to request availability and create bookings for a specific subset of hosts within a round robin event type. For example, if a round robin event has 10 hosts but the user only wants to be matched with 2 specific hosts, they can pass those host IDs via hostSubsetIds.

Changes:

  • Add hostSubsetIds to slots API input (GET /slots/available)
  • Add hostSubsetIds to booking API input (POST /bookings)
  • Update _findQualifiedHostsWithDelegationCredentials to filter by hostSubsetIds
  • Pass hostSubsetIds through all layers: API → tRPC → slots/booking services

Requested by: [email protected] (@ThyMinimalDev)
Link to Devin run: https://app.devin.ai/sessions/c0fb075cea004bf58eb4cbec324781c5

Visual Demo (For contributors especially)

N/A - This is a backend API change with no UI components.

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A - API docs are auto-generated from OpenAPI decorators.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Testing slots endpoint:

    • Create a round robin event type with multiple hosts
    • Call GET /v2/slots/available?eventTypeId={id}&startTime=...&endTime=...&hostSubsetIds=1,2
    • Verify only slots where hosts 1 or 2 are available are returned
    • If neither host 1 nor 2 exist in the event type, verify empty slots are returned
  2. Testing booking endpoint:

    • Create a booking via POST /v2/bookings with hostSubsetIds: [1, 2]
    • Verify the booking is assigned to one of the specified hosts
  3. Edge cases to verify:

    • hostSubsetIds with IDs that don't exist in the event type → should return empty availability
    • hostSubsetIds combined with routedTeamMemberIdsroutedTeamMemberIds should filter within the hostSubsetIds subset

Checklist

  • I have read the contributing guide
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have checked if my changes generate no new warnings

Human Review Checklist

  • Verify the filtering order is intentional: hostSubsetIds is applied as a hard filter BEFORE contactOwnerEmail and routedTeamMemberIds filters
  • Verify the "hard filter" behavior is desired - when hostSubsetIds results in no matching hosts, empty availability is returned (no fallback to all hosts)
  • Consider if unit tests should be added for the new filtering logic in findQualifiedHostsWithDelegationCredentials.ts

Add support for filtering round robin event type hosts via API v2.
When hostSubsetIds is provided, only the specified hosts are considered
for availability calculation and booking assignment.

Changes:
- Add hostSubsetIds to slots API input (GET /slots/available)
- Add hostSubsetIds to booking API input (POST /bookings)
- Update _findQualifiedHostsWithDelegationCredentials to filter by hostSubsetIds
- Pass hostSubsetIds through all layers: API -> tRPC -> slots/booking services

This allows API consumers to request availability and create bookings
for a subset of hosts within a round robin event type.

Co-Authored-By: [email protected] <[email protected]>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@vercel
Copy link

vercel bot commented Dec 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
cal-companion Ready Ready Preview Comment Dec 9, 2025 2:13pm
2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal Ignored Ignored Dec 9, 2025 2:13pm
cal-eu Ignored Ignored Dec 9, 2025 2:13pm

@pull-request-size pull-request-size bot added size/XL and removed size/L labels Dec 5, 2025
@github-actions github-actions bot added the ❗️ migrations contains migration files label Dec 5, 2025
@vercel
Copy link

vercel bot commented Dec 5, 2025

Deployment failed with the following error:

You must set up Two-Factor Authentication before accessing this team.

View Documentation: https://vercel.com/docs/two-factor-authentication

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 29 files

Prompt for AI agents (all 2 issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="apps/api/v2/src/modules/slots/slots-2024-09-04/controllers/e2e/team-event-type-slots.controller.e2e-spec.ts">

<violation number="1" location="apps/api/v2/src/modules/slots/slots-2024-09-04/controllers/e2e/team-event-type-slots.controller.e2e-spec.ts:119">
P2: Missing cleanup for `teammateThree` in `afterAll`. This user is created in `beforeAll` but not deleted during test cleanup, which will cause test data pollution. Add `await userRepositoryFixture.deleteByEmail(teammateThree.email);` to the `afterAll` block.</violation>
</file>

<file name="apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/team-bookings.e2e-spec.ts">

<violation number="1" location="apps/api/v2/src/ee/bookings/2024-08-13/controllers/e2e/team-bookings.e2e-spec.ts:653">
P3: Test description has grammatical error: &quot;for force&quot; should be &quot;to force&quot;.</violation>
</file>

Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR

volnei
volnei previously approved these changes Dec 9, 2025
@ThyMinimalDev ThyMinimalDev requested review from a team, pedroccastro and supalarry December 9, 2025 13:52
@ThyMinimalDev ThyMinimalDev enabled auto-merge (squash) December 10, 2025 08:10
Copy link
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

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

RoutedMemberIds for API, looks good 👍

@ThyMinimalDev ThyMinimalDev merged commit 6b62557 into main Dec 10, 2025
43 of 45 checks passed
@ThyMinimalDev ThyMinimalDev deleted the devin/host-subset-ids-1764879512 branch December 10, 2025 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants