Description du poste
| | |
|---|---|
| Phase | P1 · Recruiter path: first job, evidence and ranking |
| Epic | AIV-P1-E01 · Workspace sign-up, sign-in and members |
| Journey | J1 Workspace and first job |
| Type / priority | Story · MUST |
| Roles | Workspace admin, Hiring owner, Interviewer |
| Estimate | 2 ideal dev-days |
| Screens | — |
| Depends on | AIV-P1-001, AIV-P0-017, AIV-P0-906 |
## Description
Let a workspace admin invite the people who work in Aivera:
- **Workspace admins and recruiters** get the whole workspace.
- **Hiring owners** (for example "Head of Engineering") and **interviewers** get access only to the jobs named in the invitation: specific jobs, or, in an agency, all of one client's jobs (ADR-009, ADR-005 point 6). A client's people never see another client's jobs or candidates.
Invitations go by email and expire after 7 days. Accepting one adds the person to the workspace with the invited role and creates their job grants through AIV-P0-906. If the person already has an Aivera account, for example a freelancer who is in another workspace, the invitation joins the same account, and they then switch between workspaces. Roles and grants drive the server-side checks from AIV-P0-010.
Deliverables:
- `@aivera/workspaces`: `invitation` table (workspace_id, email, role, title, job ids, client ids, token hash, expires_at, accepted_at) in the `workspaces` schema with RLS; forward-only Drizzle Kit migration. A check constraint requires at least one job or client for hiring_owner and interviewer, and none for admin and recruiter.
- Commands `inviteMember`, `acceptInvitation` (creates the member and its job grants in one transaction), `revokeInvitation`, `changeRole`, `changeJobAccess`, `removeMember`. Each writes an audit entry.
- Route `apps/web/src/app/(recruiter)/settings/members/page.tsx`, `features/members/...`:
- Member list with a "Jobs" column ("All jobs", or the job and client names).
- Invite form: email; role (Workspace admin / Recruiter / Hiring owner /