feat(invitations): let candidates read, view and decline their invitations

This commit is contained in:
shira committed 2026-10-09 17:25:12 +03:00
1 parent c410636b7f
commit ac57c05aca
27 files changed
+3285 -21

No files matched your search

@@ -157,6 +157,9 @@ type Querier interface {
// The caller appends the matching outbox intent in the same transaction only
// when this insert returns a row.
CreateAccountDeletionRequest(ctx context.Context, arg CreateAccountDeletionRequestParams) (CreateAccountDeletionRequestRow, error)
// The compare-and-swap of a decline: it applies only to an answerable
// invitation at the version the caller read and before its deadline.
DeclineInvitation(ctx context.Context, arg DeclineInvitationParams) (pgtype.UUID, error)
// A newly reserved generic idempotency window can replace an expired typed
// outcome before the new immutable response is inserted.
DeleteAssessmentAttemptIdempotencyOutcome(ctx context.Context, scopeHash []byte) error
@@ -302,6 +305,7 @@ type Querier interface {
// Explains why ConsumeEmailToken matched no row.
GetEmailTokenState(ctx context.Context, arg GetEmailTokenStateParams) (GetEmailTokenStateRow, error)
GetInvitationCreationResult(ctx context.Context, scopeHash []byte) (string, error)
GetInvitationDeclineResult(ctx context.Context, scopeHash []byte) (GetInvitationDeclineResultRow, error)
GetInvitationSendResult(ctx context.Context, scopeHash []byte) (GetInvitationSendResultRow, error)
// The caller holds the attempt row lock, so the last mark is stable.
GetLastAssessmentOriginMark(ctx context.Context, attemptID pgtype.UUID) (AssessmentAttemptOriginMark, error)
@@ -477,6 +481,8 @@ type Querier interface {
// inserted in one caller-owned transaction. The deferred reference to the
// current terms version is checked when the transaction commits.
InsertInvitation(ctx context.Context, arg InsertInvitationParams) error
InsertInvitationDecline(ctx context.Context, arg InsertInvitationDeclineParams) error
InsertInvitationDeclineResult(ctx context.Context, arg InsertInvitationDeclineResultParams) error
InsertInvitationEvent(ctx context.Context, arg InsertInvitationEventParams) error
InsertInvitationSendResult(ctx context.Context, arg InsertInvitationSendResultParams) error
InsertInvitationTermsVersion(ctx context.Context, arg InsertInvitationTermsVersionParams) error
@@ -716,6 +722,9 @@ type Querier interface {
// Acquired after C3, candidate/specialization scope, and attempt row locks.
// This independent lock serializes current category upgrades for one scope.
LockCandidateAssessmentCategory(ctx context.Context, arg LockCandidateAssessmentCategoryParams) error
// Lock one delivered invitation addressed to the candidate. Only the
// invitation row is locked, never the organization.
LockCandidateInvitation(ctx context.Context, arg LockCandidateInvitationParams) (pgtype.UUID, error)
// Locks the candidate's published row only when it refers to a C2 record
// revoked by this transaction. The setting remains linked to that immutable
// record; ReadCandidatePublication computes the effective closed state and
@@ -846,6 +855,10 @@ type Querier interface {
// Read one delivered invitation addressed to the candidate. A draft and an
// invitation of another candidate find nothing.
ReadCandidateInvitation(ctx context.Context, arg ReadCandidateInvitationParams) (ReadCandidateInvitationRow, error)
// Read one delivered invitation addressed to the candidate with the current
// name of the organization that sent it. A draft and an invitation of
// another candidate find nothing.
ReadCandidateInvitationEntry(ctx context.Context, arg ReadCandidateInvitationEntryParams) (ReadCandidateInvitationEntryRow, error)
// Queries of the candidate visibility settings: the publication of
// the card, the search status, the hidden organizations, and the history of
// these settings. Every statement is scoped by the candidate's user_id, and
@@ -888,6 +901,7 @@ type Querier interface {
// and the invitation scope the row, so another organization's identifier
// finds nothing.
ReadInvitation(ctx context.Context, arg ReadInvitationParams) (ReadInvitationRow, error)
ReadInvitationDecline(ctx context.Context, arg ReadInvitationDeclineParams) (InvitationDecline, error)
// Read one historical terms version of one invitation of one organization.
ReadInvitationTermsVersion(ctx context.Context, arg ReadInvitationTermsVersionParams) (string, error)
// Read one historical version without exposing another organization's record.
@@ -933,6 +947,10 @@ type Querier interface {
// the delivery is no longer pending or waiting, or another worker holds it.
// now is the application clock.
RecordDeliveryFailure(ctx context.Context, arg RecordDeliveryFailureParams) (string, error)
// The compare-and-swap of the first view: it applies only to a delivered
// invitation at the version the caller read and before its deadline, and it
// keeps the deadline.
RecordInvitationView(ctx context.Context, arg RecordInvitationViewParams) (pgtype.UUID, error)
// Records the latest settled outcome of a send under the reservation.
RecordMailQuotaOutcome(ctx context.Context, arg RecordMailQuotaOutcomeParams) (int64, error)
RefreshCompanyCardViewQuotaUsage(ctx context.Context, arg RefreshCompanyCardViewQuotaUsageParams) (int64, error)