feat(company-memberships): service + validators + tests

Adds company-membership service with six operations (add, update, end,
setPrimary, listByCompany, listByClient), the corresponding Zod
validators, three socket events, and a unit-test suite covering the
portId-scoping rules, the unique_cm_exact conflict path, and the atomic
setPrimary transaction.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt Ciaccio
2026-04-24 12:07:58 +02:00
parent 037f2544e8
commit 15a79e7990
5 changed files with 816 additions and 0 deletions

View File

@@ -91,6 +91,22 @@ export interface ServerToClientEvents {
'company:updated': (payload: { companyId: string; changedFields: string[] }) => void;
'company:archived': (payload: { companyId: string }) => void;
// Company membership events
'company_membership:added': (payload: {
membershipId: string;
companyId: string;
clientId: string;
}) => void;
'company_membership:updated': (payload: {
membershipId: string;
changedFields: string[];
}) => void;
'company_membership:ended': (payload: {
membershipId: string;
companyId: string;
clientId: string;
}) => void;
// Document events
'document:created': (payload: { documentId: string; type?: string; interestId?: string }) => void;
'document:updated': (payload: { documentId: string; changedFields?: string[] }) => void;