bugfix: copy/regenerate link for invitation action added to connection request lis in orgs feature.

This commit is contained in:
2026-05-17 13:13:59 +03:30
parent 09b511a136
commit 046257c071
14 changed files with 384 additions and 171 deletions

View File

@@ -217,6 +217,17 @@ model Feature {
@@map("features")
}
/// Bidirectional clinic↔lab relationship. One row per unordered pair (A id < B id).
///
/// Two product flows share this table:
/// 1. **Connection request** — inviter found an existing subscribed org in search; row is PENDING
/// until the counterpart accepts. No OrganizationInvitation row.
/// 2. **Invitation link** — inviter could not find the org; inviteOrganization() creates a
/// placeholder org, an OrganizationInvitation (signup token), and a PENDING link here so the
/// inviter does not need a second request after signup. acceptInvite() sets the link to ACTIVE.
///
/// `sharedDataTypes` stores metadata (not shared clinical data yet). While PENDING, entries like
/// `requested_by:{orgId}` record who initiated the request (see OrganizationService).
model OrganizationLink {
id String @id @default(uuid())
@@ -235,6 +246,16 @@ model OrganizationLink {
@@map("organization_links")
}
/// Signup invite for a counterpart org that is not on DyoLink yet (or has no active subscription).
/// Complements OrganizationLink: invite flow always creates both records in one transaction.
///
/// Only the token *hash* is stored; the plain token is returned once on create/regenerate and may
/// be cached in the browser (see frontend useOrganizationInviteLinkCopy). Regenerating rotates
/// tokenHash and expiresAt on the same invitation row.
///
/// `invitedOrganizationId` points at a placeholder Organization (pending-* email) until accept;
/// list() joins open invitations to links so the UI can offer "copy invitation link" on the
/// pending connection row (pendingInvitationId on the API response).
model OrganizationInvitation {
id String @id @default(uuid())
@@ -278,6 +299,8 @@ model Session {
@@map("sessions")
}
/// OrganizationLink lifecycle. Invitation rows use overlapping semantics in API mappers
/// (e.g. accepted invitation → ACTIVE in listInvitationHistory).
enum LinkStatus {
PENDING
ACTIVE