feat: persist candidate questionnaires and enforce company quotas
This commit is contained in:
1 parent
73c7caa225
commit
3a61a8e8bb
51 files changed
+6280
-38
No files matched your search
@@ -17,6 +17,8 @@ type Querier interface {
|
||||
// Saving a profile advances onboarding only from that exact step. A retry or
|
||||
// a save after a later step is already stored never regresses onboarding.
|
||||
AdvanceCandidateOnboardingAfterProfile(ctx context.Context, arg AdvanceCandidateOnboardingAfterProfileParams) error
|
||||
// A questionnaire save advances onboarding only from its own step.
|
||||
AdvanceCandidateOnboardingAfterQuestionnaire(ctx context.Context, arg AdvanceCandidateOnboardingAfterQuestionnaireParams) error
|
||||
// Advances the version over the one the caller read, in the same statement.
|
||||
// The row lock it takes serializes concurrent saves of one profile. The update
|
||||
// time never moves back: an application clock behind the stored time (clock
|
||||
@@ -25,6 +27,9 @@ type Querier interface {
|
||||
// returns for a stale version or for an account without a profile, which the
|
||||
// caller answers as a version conflict.
|
||||
AdvanceCandidateProfileVersion(ctx context.Context, arg AdvanceCandidateProfileVersionParams) (CandidateProfile, error)
|
||||
// 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)
|
||||
// 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
|
||||
@@ -110,6 +115,8 @@ type Querier interface {
|
||||
ConsumeEmailToken(ctx context.Context, arg ConsumeEmailTokenParams) (ConsumeEmailTokenRow, error)
|
||||
// Counts the hiding records of one candidate for the settings read.
|
||||
CountCandidateHiddenOrganizations(ctx context.Context, userID pgtype.UUID) (int64, error)
|
||||
CountCompanyCardViewQuotaWindow(ctx context.Context, arg CountCompanyCardViewQuotaWindowParams) (CountCompanyCardViewQuotaWindowRow, error)
|
||||
CountCompanyInvitationQuotaWindow(ctx context.Context, arg CountCompanyInvitationQuotaWindowParams) (CountCompanyInvitationQuotaWindowRow, error)
|
||||
// Counts the families of a category that have at least one published
|
||||
// version, however many versions each has.
|
||||
CountPublishedAssessmentFamilies(ctx context.Context, category string) (int32, error)
|
||||
@@ -127,6 +134,10 @@ type Querier interface {
|
||||
// Replaces the current explicit decisions with those in the new profile.
|
||||
// The versioned profile row is advanced first in this same transaction.
|
||||
DeleteCandidateProfileOverlapConfirmations(ctx context.Context, userID pgtype.UUID) error
|
||||
// Replaces all specialization answers after the version row advanced in the
|
||||
// same transaction.
|
||||
DeleteCandidateQuestionnaireSpecializations(ctx context.Context, userID pgtype.UUID) error
|
||||
DeleteExpiredCompanyCardViewQuotaUsage(ctx context.Context, arg DeleteExpiredCompanyCardViewQuotaUsageParams) (int64, error)
|
||||
DeleteMailRequest(ctx context.Context, id pgtype.UUID) (int64, error)
|
||||
DeleteOrganizationRepresentatives(ctx context.Context, organizationID pgtype.UUID) error
|
||||
// Deletes one batch of accounts that stayed unverified since before cutoff,
|
||||
@@ -165,6 +176,8 @@ type Querier interface {
|
||||
// NULL retry_at. due_at keeps the deadline. The same guard as the
|
||||
// completion applies.
|
||||
FailScheduledJob(ctx context.Context, arg FailScheduledJobParams) (int64, error)
|
||||
FindCompanyCardViewQuotaUsage(ctx context.Context, arg FindCompanyCardViewQuotaUsageParams) (pgtype.Timestamptz, error)
|
||||
FindCompanyInvitationQuotaUsage(ctx context.Context, arg FindCompanyInvitationQuotaUsageParams) (pgtype.UUID, error)
|
||||
// Returns the newest open reservation of a delivery under a provider account
|
||||
// made at or after reserved_since. A retry of the delivery inside the
|
||||
// provider's idempotency window reuses it instead of counting again.
|
||||
@@ -260,6 +273,10 @@ type Querier interface {
|
||||
GetUnrevokedConsentRecordByVersion(ctx context.Context, arg GetUnrevokedConsentRecordByVersionParams) (GetUnrevokedConsentRecordByVersionRow, error)
|
||||
GetUserByEmailNormalized(ctx context.Context, emailNormalized string) (User, error)
|
||||
GetUserByID(ctx context.Context, id pgtype.UUID) (User, error)
|
||||
// Stores an explicit mapping against a newly-created immutable opening. The
|
||||
// insert trigger checks the opening, declared reviewer, current policy, and
|
||||
// live coverage; the adapter supplies the fingerprint of the published set.
|
||||
InsertAssessmentCategoryCatalogBinding(ctx context.Context, arg InsertAssessmentCategoryCatalogBindingParams) error
|
||||
// Stores an opening. The insert trigger derives required_families from the
|
||||
// policy document and counts the published families, and the coverage CHECK
|
||||
// refuses the row when they are fewer; both numbers from the caller are
|
||||
@@ -301,8 +318,13 @@ type Querier interface {
|
||||
// one is answered as a version conflict. The foreign key refuses a record
|
||||
// that is not a C2 record of this account.
|
||||
InsertCandidatePublication(ctx context.Context, arg InsertCandidatePublicationParams) (InsertCandidatePublicationRow, error)
|
||||
// Creates the first saved questionnaire. A missing row is version zero;
|
||||
// concurrent first saves race on the primary key and exactly one returns a row.
|
||||
InsertCandidateQuestionnaire(ctx context.Context, arg InsertCandidateQuestionnaireParams) (CandidateQuestionnaire, error)
|
||||
InsertCandidateQuestionnaireSpecialization(ctx context.Context, arg InsertCandidateQuestionnaireSpecializationParams) error
|
||||
// Stores the first status at version 1; no row returns when one exists.
|
||||
InsertCandidateSearchStatus(ctx context.Context, arg InsertCandidateSearchStatusParams) (InsertCandidateSearchStatusRow, error)
|
||||
InsertCompanyInvitationQuotaUsage(ctx context.Context, arg InsertCompanyInvitationQuotaUsageParams) error
|
||||
// Records a grant of C1, C2, C3, or C5. An unrevoked record of the same
|
||||
// subject, purpose, and text version already exists when no row returns;
|
||||
// the insert then changes nothing and does not abort the transaction.
|
||||
@@ -384,6 +406,10 @@ type Querier interface {
|
||||
// the last record of the previous page.
|
||||
ListConsentRecords(ctx context.Context, arg ListConsentRecordsParams) ([]ListConsentRecordsRow, error)
|
||||
ListCurrentContactConsentRecords(ctx context.Context, arg ListCurrentContactConsentRecordsParams) ([]ListCurrentContactConsentRecordsRow, error)
|
||||
// Produces current catalog availability in one PostgreSQL statement snapshot.
|
||||
// The adapter compares the ordered live family manifest with the pinned
|
||||
// fingerprint; stale bindings are omitted fail-closed.
|
||||
ListCurrentSpecializationAvailability(ctx context.Context) ([]ListCurrentSpecializationAvailabilityRow, error)
|
||||
ListDeliveryAttempts(ctx context.Context, deliveryID pgtype.UUID) ([]DeliveryAttempt, error)
|
||||
// Lists the organizations where an account has an active membership,
|
||||
// newest membership first. The page continues after the (membership
|
||||
@@ -413,6 +439,10 @@ type Querier interface {
|
||||
// canceled, or reclaimed after the lease expired. While the lock is held,
|
||||
// other workers skip the row, so the handler never runs twice at once.
|
||||
LockClaimedScheduledJob(ctx context.Context, arg LockClaimedScheduledJobParams) (int64, error)
|
||||
// Writers lock the organization first, then invitation/card-view state, and
|
||||
// finally usage rows. The organization lock serializes quota decisions for
|
||||
// the tenant and makes the subsequent count and insert atomic.
|
||||
LockCompanyQuotaOrganization(ctx context.Context, organizationID pgtype.UUID) (LockCompanyQuotaOrganizationRow, error)
|
||||
// Takes the candidate's current unrevoked C2 record for a publication and
|
||||
// keeps it locked until the transaction ends. The share lock conflicts with
|
||||
// the revocation stamp (an UPDATE of the row), so a revocation either commits
|
||||
@@ -496,6 +526,9 @@ type Querier interface {
|
||||
// snapshot. The effective state is computed from them: published only while
|
||||
// consent_revoked_at is NULL. No row means the candidate never published.
|
||||
ReadCandidatePublication(ctx context.Context, userID pgtype.UUID) (ReadCandidatePublicationRow, error)
|
||||
// Reads the aggregate and its ordered specializations in one statement so a
|
||||
// response never pairs a version with another version's answers.
|
||||
ReadCandidateQuestionnaire(ctx context.Context, userID pgtype.UUID) (ReadCandidateQuestionnaireRow, error)
|
||||
// No row means the status was never set, which reads as not looking. The
|
||||
// lapse is computed by the caller from lapses_at and its clock and is never
|
||||
// written.
|
||||
@@ -507,6 +540,10 @@ type Querier interface {
|
||||
// unpublished one. Every organization-facing read of a publication starts
|
||||
// from this shape.
|
||||
ReadPublicationVisibleToOrganization(ctx context.Context, arg ReadPublicationVisibleToOrganizationParams) (ReadPublicationVisibleToOrganizationRow, error)
|
||||
// Lists the exact published bank manifest while the category advisory lock is
|
||||
// held by OpenCategory. Published families have passed the independent-review
|
||||
// constraint before this read.
|
||||
ReadPublishedAssessmentCategoryManifest(ctx context.Context, category string) ([]ReadPublishedAssessmentCategoryManifestRow, error)
|
||||
// Advances a delivery past one attempt and appends the attempt in one
|
||||
// statement, so both happen or neither does, inside or outside a
|
||||
// transaction. The update applies only while the stored version still
|
||||
@@ -534,6 +571,7 @@ type Querier interface {
|
||||
RecordDeliveryFailure(ctx context.Context, arg RecordDeliveryFailureParams) (string, 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)
|
||||
// Gives a claimed delivery back without changing it, so the next pass may
|
||||
// claim it. It matches only the lease of lease_owner: a delivery that another
|
||||
// worker took over after the lease expired is left alone.
|
||||
@@ -568,6 +606,7 @@ type Querier interface {
|
||||
RevokeContactConsentRecords(ctx context.Context, arg RevokeContactConsentRecordsParams) ([]RevokeContactConsentRecordsRow, error)
|
||||
RevokeSession(ctx context.Context, arg RevokeSessionParams) (int64, error)
|
||||
RevokeUserSessions(ctx context.Context, arg RevokeUserSessionsParams) (int64, error)
|
||||
SaveCompanyCardViewQuotaUsage(ctx context.Context, arg SaveCompanyCardViewQuotaUsageParams) error
|
||||
// Stores the immutable domain snapshot of a successful create command. The
|
||||
// generic idempotency row and this result are committed with the organization
|
||||
// and owner membership. A reused expired scope replaces the snapshot in the
|
||||
|
||||
Reference in new issue
Block a user