Skip to content

Enforce standalone workshop signup capacity on participant join paths - #173

Merged
qin-guan merged 1 commit into
mainfrom
copilot/fix-workshop-sign-up-limit
Aug 27, 2026
Merged

Enforce standalone workshop signup capacity on participant join paths#173
qin-guan merged 1 commit into
mainfrom
copilot/fix-workshop-sign-up-limit

Conversation

Copilot AI commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Standalone workshop signup limits were not enforced for participant registration, allowing over-capacity joins. This change adds capacity checks to both participant join flows so registration is rejected once active seats are exhausted.

  • Capacity enforcement in join endpoints

    • Added MaxParticipants guard to:
      • POST /participants/standalone-workshops/{StandaloneWorkshopId}/join
      • POST /participants/standalone-workshops/join (short code path)
    • Capacity is computed from active registrations only (Status == Registered && WithdrawnAt == null), matching existing analytics semantics.
    • Existing idempotent behavior is preserved for users already actively registered.
  • Behavioral coverage for full workshops

    • Added integration tests for both join paths to verify a second user receives 400 when workshop capacity is already full.
var registeredCount = await sql.Queryable<ActivityRegistration>()
    .CountAsync(r =>
        r.ActivityId == workshop.Id &&
        r.Status == ActivityRegistrationStatus.Registered &&
        r.WithdrawnAt == null, ct);

if (registeredCount >= workshop.MaxParticipants)
{
    AddError("Workshop is full");
    await Send.ErrorsAsync(400, ct);
    return;
}

Co-authored-by: qin-guan <10321883+qin-guan@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 27, 2026 06:27
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
portal db60097 Commit Preview URL

Branch Preview URL
Aug 27 2026, 05:47 AM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
portal-oidc-web-playground db60097 Commit Preview URL

Branch Preview URL
Aug 27 2026, 05:49 AM

@qin-guan
qin-guan marked this pull request as ready for review August 27, 2026 06:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 standalone workshop capacity enforcement to the participant “join” endpoints, aligning seat counting with existing analytics semantics (active registrations only) and adding integration coverage for the “workshop full” behavior.

Changes:

  • Added capacity checks to both standalone workshop participant join flows (ID-based and short-code based).
  • Capacity is computed from active registrations only (Status == Registered && WithdrawnAt == null) to match analytics.
  • Added integration tests ensuring a second distinct user receives 400 BadRequest when capacity is exhausted.

Reviewed changes

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

File Description
GeeksHackingPortal.Api/Endpoints/Participants/StandaloneWorkshops/Join/Endpoint.cs Adds capacity guard to the standard participant join route.
GeeksHackingPortal.Api/Endpoints/Participants/StandaloneWorkshops/JoinByShortCode/Endpoint.cs Adds the same capacity guard to the short-code join route.
GeeksHackingPortal.Tests/Endpoints/Participants/StandaloneWorkshops/StandaloneWorkshopJoinAndStatusTests.cs Adds integration tests asserting 400 when a second user attempts to join a full workshop via both join paths.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +47 to +54
var registeredCount = await sql.Queryable<ActivityRegistration>()
.CountAsync(
r =>
r.ActivityId == workshop.Id
&& r.Status == ActivityRegistrationStatus.Registered
&& r.WithdrawnAt == null,
ct
);
Comment on lines +48 to +55
var registeredCount = await sql.Queryable<ActivityRegistration>()
.CountAsync(
r =>
r.ActivityId == workshop.Id
&& r.Status == ActivityRegistrationStatus.Registered
&& r.WithdrawnAt == null,
ct
);
Comment on lines +55 to +57
[Test]
public async Task JoinStandaloneWorkshop_WhenWorkshopIsFull_ReturnsBadRequest()
{
@qin-guan
qin-guan merged commit 2b7ed1e into main Aug 27, 2026
10 checks passed
@qin-guan
qin-guan deleted the copilot/fix-workshop-sign-up-limit branch August 27, 2026 06:45
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