feat: persist versioned organization needs

This commit is contained in:
TakuyaYagam1 committed 2026-10-07 16:25:17 +03:00
1 parent f81cd0ae09
commit ee3738ee73
14 files changed
+2388

No files matched your search

@@ -30,6 +30,11 @@ type Querier interface {
// Advances an existing questionnaire only at the version read by the caller.
// The row lock serializes saves for one user; a stale writer returns no row.
AdvanceCandidateQuestionnaireVersion(ctx context.Context, arg AdvanceCandidateQuestionnaireVersionParams) (CandidateQuestionnaire, error)
// The conditional parent update is the compare-and-swap. Appending the
// snapshot is part of the same SQL statement, so a failed insert leaves the
// parent pointer unchanged even before the surrounding transaction rolls
// back. No row is returned when the expected version lost a race.
AdvanceOrganizationNeed(ctx context.Context, arg AdvanceOrganizationNeedParams) (string, error)
// Starts a new registration of an unverified account without touching its
// credentials, scenario, or onboarding step: the new registration carries
// them on its verification token. Advances the registration version, which
@@ -353,6 +358,10 @@ type Querier interface {
// transaction at commit unless an active owner membership was inserted in
// it too.
InsertOrganization(ctx context.Context, arg InsertOrganizationParams) error
// The parent and first immutable snapshot are inserted in one caller-owned
// transaction. Deferred version references are checked when it commits.
InsertOrganizationNeed(ctx context.Context, arg InsertOrganizationNeedParams) error
InsertOrganizationNeedVersion(ctx context.Context, arg InsertOrganizationNeedVersionParams) error
// Stores one representative at its position in the list. The adapter calls it
// once per representative after it deleted the previous list, in the same
// transaction.
@@ -533,6 +542,10 @@ type Querier interface {
// lapse is computed by the caller from lapses_at and its clock and is never
// written.
ReadCandidateSearchStatus(ctx context.Context, userID pgtype.UUID) (CandidateSearchStatus, error)
// Read one current version with its organization-scoped parent metadata.
ReadCurrentOrganizationNeed(ctx context.Context, arg ReadCurrentOrganizationNeedParams) (ReadCurrentOrganizationNeedRow, error)
// Read one historical version without exposing another organization's record.
ReadOrganizationNeedVersion(ctx context.Context, arg ReadOrganizationNeedVersionParams) (string, error)
// The organization-facing read of a candidate's publication: the effective
// view (published and backed by an unrevoked C2) and no hiding of the reading
// organization. No row means the organization reads nothing, whichever of