Skip to content

feat(api): [AB#288] redesign employee invitation flow with Firebase account linking#301

Merged
bllr777 merged 1 commit into
mainfrom
feature/288-fix-stripe-refund-exception-handling
May 18, 2026
Merged

feat(api): [AB#288] redesign employee invitation flow with Firebase account linking#301
bllr777 merged 1 commit into
mainfrom
feature/288-fix-stripe-refund-exception-handling

Conversation

@bllr777
Copy link
Copy Markdown
Collaborator

@bllr777 bllr777 commented May 18, 2026

Redesign Employee Invitation Flow — API

Related: AB#288

Summary

Reworks the employee invitation flow end-to-end. The accept endpoint now links a Firebase UID (created client-side) to a fully-provisioned User + Employee, assigns the OrganizationEmployee role, and sets custom Firebase claims so the new hire can sign in immediately. Email copy is also friendlier.

Architecture

  • Passwords never cross the API. The Angular client creates the Firebase account, then posts only the resulting UID + name fields here. Mirrors the existing OrganizationController.Register pattern.
  • New abstraction IFirebaseUserManager lives in JobFlow.Business, while the concrete FirebaseUserManager lives in JobFlow.Infrastructure. This keeps FirebaseAdmin out of JobFlow.Business (same pattern as IFirebaseTokenValidator).

Changes

  • EmailTemplate.EmployeeInvite = 7 added; BuildEmployeeInvite now includes org name and role with friendlier copy.
  • New DTO AcceptInviteRequest { FirebaseUid, FirstName?, LastName? }.
  • EmployeeInviteService.AcceptInviteAsync:
    • Validates FirebaseUid.
    • Creates User row, calls UpsertUser, assigns UserRoles.OrganizationEmployee.
    • Sets custom Firebase claims (role, organizationId) + display name.
    • Creates Employee linked to the new UserId and marks the invite Accepted.
  • New EmployeeInviteErrors: FirebaseUidRequired, AccountLinkFailed(detail).
  • Controller signature: POST /employeeinvite/accept/{token} now takes AcceptInviteRequest.

Verification

  • dotnet build — all projects clean, no warnings.

Notes

Paired with UI redesign in jobflow-ui-web#feature/287.

…ccount linking

- Add EmployeeInvite email template (id 7) with friendlier copy including org and role

- Add AcceptInviteRequest DTO carrying firebaseUid, firstName, lastName

- Introduce IFirebaseUserManager abstraction in Business + FirebaseUserManager impl in Infrastructure (keeps FirebaseAdmin out of Business)

- Rewrite AcceptInviteAsync to link Firebase UID to a new User + Employee, assign OrganizationEmployee role, and set custom claims

- Add EmployeeInviteErrors.FirebaseUidRequired and AccountLinkFailed
@bllr777 bllr777 merged commit 1d83540 into main May 18, 2026
8 checks passed
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