Skip to content

fix(api): default EmployeeInvite.Status to Pending so accept-by-code works#283

Merged
bllr777 merged 1 commit into
mainfrom
fix/employee-invite-pending-status-default
May 16, 2026
Merged

fix(api): default EmployeeInvite.Status to Pending so accept-by-code works#283
bllr777 merged 1 commit into
mainfrom
fix/employee-invite-pending-status-default

Conversation

@bllr777
Copy link
Copy Markdown
Collaborator

@bllr777 bllr777 commented May 16, 2026

Why

Newly created employee invites were saved with Status = 0 because:

  • EmployeeInviteStatus.Pending is 1, not 0.
  • EmployeeInvite.Status had no default initializer, so it defaulted to (EmployeeInviteStatus)0.
  • InviteAsync never assigned Status explicitly before insert.

Result: GET /api/employeeinvite/{code} filters by Status == Pending (1) and always returned 404 for freshly created invites - exactly what staging saw with code N72cZl.

What changed

  • EmployeeInvite.Status now initialized to EmployeeInviteStatus.Pending.
  • InviteAsync also sets invite.Status = EmployeeInviteStatus.Pending explicitly (belt + suspenders, in case the caller passes a partially populated entity).
  • Fixed pre-existing bug in the duplicate-invite check: it was filtering by invite.Status (the new invite, always Pending after this fix) instead of e.Status (the row being scanned). Now correctly checks for an existing Pending invite for the same email.

Verification

  • dotnet build - 0 errors, 0 warnings.
  • dotnet test - 54/54 passing.
  • Staging row N72cZl hot-patched to Status = 1; full GET-by-code path verified to behave correctly with the new defaults.

@bllr777 bllr777 merged commit cb24724 into main May 16, 2026
6 checks passed
@bllr777 bllr777 deleted the fix/employee-invite-pending-status-default branch May 16, 2026 02:23
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.

1 participant