Recovered source transcript
1// Code generated by sqlc. DO NOT EDIT.
2// versions:
3// sqlc v1.31.1
4
5package dbgen
6
7import (
8 "context"
9
10 "github.com/google/uuid"
11)
12
13type Querier interface {
14 AddCandidateCertification(ctx context.Context, arg AddCandidateCertificationParams) error
15 AddCandidateCustomerExperience(ctx context.Context, arg AddCandidateCustomerExperienceParams) error
16 AddCandidateSkill(ctx context.Context, arg AddCandidateSkillParams) error
17 AddRequiredCertification(ctx context.Context, arg AddRequiredCertificationParams) error
18 AddRequiredSkill(ctx context.Context, arg AddRequiredSkillParams) error
19 AddSlateMember(ctx context.Context, arg AddSlateMemberParams) (SlateMember, error)
20 // Right to erasure as anonymize in place: wipe the identifying PII while KEEPING the row so the de
21 // identified scored outcomes (slate_members) and the demographic bucket survive for the adverse impact
22 // record. Once the name, email, contact, and resume vector are gone the row is no longer personal data,
23 // so erasure is satisfied and the compliance history is preserved. Idempotent on anonymized_at.
24 AnonymizeCandidate(ctx context.Context, id uuid.UUID) (int64, error)
25 AwardsSyncMeta(ctx context.Context) (AwardsSyncMetaRow, error)
26 CreateCandidate(ctx context.Context, arg CreateCandidateParams) (Candidate, error)
27 CreateOpportunity(ctx context.Context, arg CreateOpportunityParams) (Opportunity, error)
28 // W3 AI Staffing Recommendations queries. Reads are RLS scoped by the app.current_org_id policy, so a
29 // bare SELECT only ever sees the caller's org; writes pass organization_id explicitly and the RLS WITH
30 // CHECK validates it matches the session org. No query here names the eeo schema, and none can: the
31 // generated code is built only from public schema queries.
32 CreateRecommendationRun(ctx context.Context, arg CreateRecommendationRunParams) (RecommendationRun, error)
33 CreateRequirement(ctx context.Context, arg CreateRequirementParams) (Requirement, error)
34 CreateSlate(ctx context.Context, arg CreateSlateParams) (Slate, error)
35 CreateStaffingRecommendation(ctx context.Context, arg CreateStaffingRecommendationParams) (StaffingRecommendation, error)
36 CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
37 DeleteExternalCandidate(ctx context.Context, id uuid.UUID) (int64, error)
38 // Right to erasure: when a candidate is anonymized or sourced-erased, their recommendation rows are
39 // removed (anonymize in place does not delete the candidate row, so this is explicit, mirroring the
40 // ai_memory cleanup).
41 DeleteRecommendationsForCandidate(ctx context.Context, candidateID *uuid.UUID) error
42 // Erasure must also remove slate placements of the sourced person; slate_members has no ON DELETE rule
43 // so the candidate delete would otherwise fail. RLS scopes this to the caller's org.
44 DeleteSlateMembersForCandidate(ctx context.Context, candidateID uuid.UUID) error
45 DetachSourcingLog(ctx context.Context, candidateID *uuid.UUID) error
46 // Identity resolution blocking key 1: an exact (case insensitive) email match in the same org. Email is
47 // the strongest identity signal, so a sourced lead with a known email merges into the existing person.
48 FindCandidateByEmail(ctx context.Context, arg FindCandidateByEmailParams) (uuid.UUID, error)
49 // Identity resolution blocking key 2: same normalized full name AND same normalized location in the org.
50 // Name alone is too weak (two John Smiths); name plus location is a defensible second signal. The caller
51 // only invokes this with a non empty location.
52 FindCandidateByNameLocation(ctx context.Context, arg FindCandidateByNameLocationParams) (uuid.UUID, error)
53 GetCandidate(ctx context.Context, id uuid.UUID) (Candidate, error)
54 GetCandidateEvaluation(ctx context.Context, arg GetCandidateEvaluationParams) (CandidateEvaluation, error)
55 GetOpportunity(ctx context.Context, id uuid.UUID) (Opportunity, error)
56 GetOpportunityRecord(ctx context.Context, id uuid.UUID) (OpportunityRecord, error)
57 GetOrganization(ctx context.Context, id uuid.UUID) (Organization, error)
58 GetRequirement(ctx context.Context, id uuid.UUID) (Requirement, error)
59 // One requirement with its backing opportunity value, provenance, and status, for the gap view. The
60 // service uses deleted_at and the opportunity status to 404 a requirement that is not a real open gap.
61 GetRequirementWithValue(ctx context.Context, id uuid.UUID) (GetRequirementWithValueRow, error)
62 GetSamOpportunity(ctx context.Context, noticeID string) (SamOpportunity, error)
63 GetSkillByName(ctx context.Context, name string) (Skill, error)
64 GetSlate(ctx context.Context, id uuid.UUID) (Slate, error)
65 // PK tiebreaker => total order [review SQLC-5]
66 // The frozen decision record for one member: the full per component trace, rationale, and gap summary
67 // for the audit and candidate facing explanation.
68 GetSlateMember(ctx context.Context, arg GetSlateMemberParams) (SlateMember, error)
69 // Locks the row for the decision path so two concurrent decisions on the same recommendation serialize;
70 // the service checks existence (else 404) and status (else 409) under this lock before deciding.
71 GetStaffingRecommendationForUpdate(ctx context.Context, id uuid.UUID) (StaffingRecommendation, error)
72 GetUser(ctx context.Context, id uuid.UUID) (User, error)
73 GetUserByEmail(ctx context.Context, lower string) (User, error)
74 // audit_logs is append-only (enforced by trigger); only INSERT/SELECT are granted.
75 InsertAuditLog(ctx context.Context, arg InsertAuditLogParams) (InsertAuditLogRow, error)
76 InsertCandidateNotice(ctx context.Context, arg InsertCandidateNoticeParams) (AedtCandidateNotice, error)
77 InsertSourcingLog(ctx context.Context, arg InsertSourcingLogParams) error
78 // Identity resolution merge: link a sourced lead to an existing candidate. Sets the external id and
79 // backfills headline and years ONLY where the existing row is empty or lower, never clobbering curated
80 // bench data. Source is intentionally left unchanged so a verified bench person stays a bench person.
81 LinkSourcedCandidate(ctx context.Context, arg LinkSourcedCandidateParams) error
82 ListAedtInventory(ctx context.Context) ([]AedtInventory, error)
83 // audit_logs has NO RLS policy by design. Bind the read to the validated session GUC (NOT a
84 // caller supplied org param) so it inherits the same fail closed default deny as every RLS table,
85 // a missing or wrong org can no longer leak another tenant's trail. Run inside RunInTenantTx so the GUC
86 // is set [review AUDIT-2/RLS-3].
87 ListAuditLogsForOrg(ctx context.Context, arg ListAuditLogsForOrgParams) ([]AuditLog, error)
88 // Incumbents and similar awards for a NAICS, largest first (excludes Galapagos own awards).
89 ListAwardsByNaics(ctx context.Context, arg ListAwardsByNaicsParams) ([]UsaspendingAward, error)
90 ListBlsWages(ctx context.Context) ([]BlsWage, error)
91 ListCandidateCertifications(ctx context.Context, candidateID uuid.UUID) ([]string, error)
92 ListCandidateCustomerExperience(ctx context.Context, candidateID uuid.UUID) ([]string, error)
93 ListCandidateSkills(ctx context.Context, candidateID uuid.UUID) ([]ListCandidateSkillsRow, error)
94 // id is a unique trailing sort key so created_at ties give a total order and stable LIMIT/OFFSET paging.
95 ListCandidates(ctx context.Context, arg ListCandidatesParams) ([]Candidate, error)
96 // Available (staffable) candidates first, most recently updated next, so the workforce intelligence
97 // surface leads with the talent you can deploy and newly staffed or sourced people are always scored.
98 // The trailing id makes the order total, so the same set is selected before the LIMIT cut every run.
99 ListCandidatesForIntel(ctx context.Context, limit int32) ([]Candidate, error)
100 // A candidate is committed to a requirement when they are an approved slate member (the source of truth)
101 // or have an approved W3 ASSIGN that has not yet flowed to a slate (provisional commitment). The gap view
102 // reads this so a committed candidate is classified REASSIGN, never a duplicate ASSIGN.
103 ListCommitments(ctx context.Context) ([]ListCommitmentsRow, error)
104 // The persisted screenMATCH qualifications for one requirement, joined to the candidate name and
105 // availability, best first. missionMATCH "who can support this mission today" reads this STORED
106 // artifact rather than rescore the pool. Both tables are RLS scoped, so the join cannot cross tenants.
107 ListEvaluationsForRequirement(ctx context.Context, requirementID uuid.UUID) ([]ListEvaluationsForRequirementRow, error)
108 // id is the unique trailing sort key so created_at ties leave a total order and the LIMIT cut is stable.
109 ListExternalCandidates(ctx context.Context, limit int32) ([]ListExternalCandidatesRow, error)
110 // Galapagos own past performance, largest first.
111 ListGalapagosAwards(ctx context.Context, lim int32) ([]UsaspendingAward, error)
112 // AEDT governance: model version registry, the org AEDT inventory, candidate notices, and the
113 // retention sweep. All on the app pool under RLS (the eeo schema is reached only by the compliance
114 // pool, never here).
115 ListModelVersions(ctx context.Context) ([]AedtModelVersion, error)
116 // Only requirements whose opportunity is open, plus standalone requirements (NULL opportunity_id),
117 // mirroring the Command Center predicate (o.id IS NULL OR o.status='open'). The LEFT JOIN selects r.*
118 // so the row type stays Requirement. Used by the Opportunity Fit Engine, which scores only OPEN ones.
119 ListOpenRequirements(ctx context.Context, arg ListOpenRequirementsParams) ([]Requirement, error)
120 // Open requirements with their backing opportunity dollar value and its provenance, for the portfolio
121 // value function. A standalone requirement (no opportunity) has a null value and is handled by the
122 // documented value fallback in the optimizer.
123 ListOpenRequirementsWithValue(ctx context.Context, arg ListOpenRequirementsWithValueParams) ([]ListOpenRequirementsWithValueRow, error)
124 ListOpportunities(ctx context.Context, arg ListOpportunitiesParams) ([]Opportunity, error)
125 // Optional filters (NULL array = no filter). Soonest closing first, then most recently posted, then id
126 // as a unique tiebreaker so the order is deterministic. Text equality filters compare upper() on both
127 // sides; the service upper cases the params so casing drift cannot silently zero out results.
128 ListOpportunityRecords(ctx context.Context, arg ListOpportunityRecordsParams) ([]OpportunityRecord, error)
129 // The current bench watch: pending recommendations from proactive runs, capped and paginated.
130 ListProactiveRecommendations(ctx context.Context, arg ListProactiveRecommendationsParams) ([]StaffingRecommendation, error)
131 ListRequiredCertifications(ctx context.Context, requirementID uuid.UUID) ([]string, error)
132 ListRequiredSkills(ctx context.Context, requirementID uuid.UUID) ([]ListRequiredSkillsRow, error)
133 // id is a unique trailing sort key so the order is total: ties on created_at no longer leave the
134 // LIMIT/OFFSET cut and the downstream Best Fit pick nondeterministic.
135 ListRequirements(ctx context.Context, arg ListRequirementsParams) ([]Requirement, error)
136 ListRequirementsForOpportunity(ctx context.Context, opportunityID *uuid.UUID) ([]Requirement, error)
137 // All filters are optional (NULL array / NULL scalar = "no filter"). active_only defaults true at the
138 // handler. Soonest-closing first, then most-recently-posted.
139 // Text equality filters are case-insensitive (upper() both sides; the service upper-cases the params)
140 // so casing drift from SAM's path text can't silently zero out results [review COR-3]. The title search
141 // is a literal substring (position()), NOT a LIKE pattern, so q's %/_/\ are matched literally and a
142 // trailing backslash can't 500 the request [review COR-1]. Past-deadline / null-deadline notices sort
143 // to the bottom so the feed leads with what's still open [review COR-2].
144 ListSamOpportunities(ctx context.Context, arg ListSamOpportunitiesParams) ([]SamOpportunity, error)
145 ListSkills(ctx context.Context, arg ListSkillsParams) ([]Skill, error)
146 ListSlateMembers(ctx context.Context, slateID uuid.UUID) ([]SlateMember, error)
147 // The slate roster joined to the candidate name for the slateMATCH detail and the branded export. Both
148 // tables are RLS scoped to the caller's org, so the join cannot cross tenants.
149 ListSlateMembersWithNames(ctx context.Context, slateID uuid.UUID) ([]ListSlateMembersWithNamesRow, error)
150 ListSlatesForRequirement(ctx context.Context, requirementID uuid.UUID) ([]Slate, error)
151 // id is the unique trailing sort key so collected_at ties leave a total order and the LIMIT cut is stable.
152 ListSourcingLog(ctx context.Context, limit int32) ([]ListSourcingLogRow, error)
153 // Platform/security events with NO org (e.g. failed logins before org resolution). Privileged read
154 // path only, never the per-tenant app path, so these events are not a black hole [review AUDIT-3].
155 ListSystemAuditLogs(ctx context.Context, arg ListSystemAuditLogsParams) ([]AuditLog, error)
156 ListUsers(ctx context.Context, arg ListUsersParams) ([]User, error)
157 // Status guarded: only a pending row can be decided, so a row that was concurrently superseded or
158 // decided returns no row and the service surfaces 409 rather than overwriting a dead or decided row.
159 MarkRecommendationDecision(ctx context.Context, arg MarkRecommendationDecisionParams) (StaffingRecommendation, error)
160 OpportunityRecordMeta(ctx context.Context) (OpportunityRecordMetaRow, error)
161 // Band/decision rollup across every slate member under one opportunity's requirements, the source
162 // for GET /proposal-readiness [review COMPL-2]. RLS scopes all three tables to the caller's org.
163 ProposalReadiness(ctx context.Context, opportunityID *uuid.UUID) ([]ProposalReadinessRow, error)
164 // Candidates whose most recent recorded decision is older than the retention window and whose PII is
165 // not yet anonymized. The de identified slate_members outcomes are retained; only the candidate PII is
166 // wiped (by AnonymizeCandidate). RLS scopes this to the caller's org.
167 RetentionDueCandidates(ctx context.Context, dollar_1 int32) ([]uuid.UUID, error)
168 SamSyncMeta(ctx context.Context) (SamSyncMetaRow, error)
169 // Hybrid retrieval: pgvector cosine kNN fused with full-text rank via Reciprocal Rank Fusion (k=60).
170 // RLS already scopes both legs to the caller's org. $1=query embedding, $2=limit, $3=text query.
171 // The vector arm is MATERIALIZED so the relaxed_order HNSW output is re-sorted by TRUE cosine distance
172 // before it is ranked: under hnsw.iterative_scan = relaxed_order the index returns rows slightly out of
173 // distance order, and ranking them without the re-sort would mis-rank the nearest neighbors at scale
174 // (pgvector 0.8 README; AWS pgvector 0.8 Aurora guidance). Every ORDER BY carries a unique tiebreaker
175 // (id) so results are byte-stable for fixed inputs, the AEDT reproducibility mandate. The caller SETs
176 // LOCAL hnsw.ef_search and hnsw.iterative_scan first.
177 SearchCandidatesHybrid(ctx context.Context, arg SearchCandidatesHybridParams) ([]SearchCandidatesHybridRow, error)
178 // Cosine nearest-neighbor over the skills ontology (powers semantic skill adjacency).
179 SearchSkillsSemantic(ctx context.Context, arg SearchSkillsSemanticParams) ([]SearchSkillsSemanticRow, error)
180 // An org FSO records HOW a candidate's clearance is known. RLS scopes this to the caller's own org.
181 // verified_at is the date the FSO confirmed it; it is NULL for a self reported indicator. The platform
182 // never verifies a clearance itself, it records the org's authoritative assertion.
183 SetCandidateClearanceProvenance(ctx context.Context, arg SetCandidateClearanceProvenanceParams) (int64, error)
184 // Human-in-the-loop: a person approves/rejects each member, optionally with a note. Never auto-decided.
185 SetSlateMemberDecision(ctx context.Context, arg SetSlateMemberDecisionParams) (SlateMember, error)
186 SoftDeleteCandidate(ctx context.Context, id uuid.UUID) error
187 // A fresh gap run for a requirement supersedes ONLY the prior pending gap rows for that requirement.
188 // Decided rows (approved, rejected, dismissed) are immutable and are never touched.
189 SupersedePendingGap(ctx context.Context, requirementID uuid.UUID) error
190 // A fresh portfolio run supersedes ONLY the prior pending portfolio rows for the org. Decided rows are
191 // immutable.
192 SupersedePendingPortfolio(ctx context.Context) error
193 // A fresh proactive recompute for one candidate supersedes ONLY that candidate's prior pending proactive
194 // rows. Decided rows are immutable.
195 SupersedePendingProactive(ctx context.Context, candidateID *uuid.UUID) error
196 TouchUserLogin(ctx context.Context, id uuid.UUID) error
197 UpdateSlateStatus(ctx context.Context, arg UpdateSlateStatusParams) (Slate, error)
198 UpsertAedtInventory(ctx context.Context, arg UpsertAedtInventoryParams) (AedtInventory, error)
199 // USASpending awards cache. Global public catalog (no organization_id, outside RLS): reads run off
200 // the pool, writes come from the daily sync (cmd/awards-sync) as the migrator role.
201 UpsertAward(ctx context.Context, arg UpsertAwardParams) error
202 // BLS OEWS wage baseline cache. Global public catalog (no organization_id, outside RLS): reads run
203 // off the pool, writes come from the weekly rates sync (cmd/rates-sync) as the migrator role.
204 UpsertBlsWage(ctx context.Context, arg UpsertBlsWageParams) error
205 // Upsert the latest screenMATCH qualification for one (candidate, requirement) pair. A fresh screen
206 // overwrites the prior row so there is exactly one current evaluation per pair, which missionMATCH
207 // reads instead of recomputing. evaluated_at is preserved as the first time the pair was screened;
208 // updated_at moves to now() on every rescreen.
209 UpsertCandidateEvaluation(ctx context.Context, arg UpsertCandidateEvaluationParams) error
210 // External candidate sourcing. The import command (cmd/import-candidates) writes as the migrator role
211 // with an explicit organization_id; the delete path runs as the app role inside a tenant tx (RLS).
212 UpsertExternalCandidate(ctx context.Context, arg UpsertExternalCandidateParams) (uuid.UUID, error)
213 // Opportunity Intelligence unified records. Global public catalog (no organization_id, outside RLS):
214 // reads run straight off the pool, writes come from cmd/opp-sync as the migrator role.
215 UpsertOpportunityRecord(ctx context.Context, arg UpsertOpportunityRecordParams) error
216 // SAM.gov opportunities cache. Global public catalog (no organization_id, outside RLS): reads run
217 // straight off the pool, writes come from the daily sync (cmd/sam-sync) as the migrator role.
218 UpsertSamOpportunity(ctx context.Context, arg UpsertSamOpportunityParams) error
219 // COALESCE keeps an existing category or embedding when a caller upserts by name only (for example the
220 // ingest and mission check paths that pass just a skill name), so a later name only upsert never nulls a
221 // category that was set before and an embedding can still be backfilled once it is supplied.
222 UpsertSkill(ctx context.Context, arg UpsertSkillParams) (Skill, error)
223 WagesSyncMeta(ctx context.Context) (WagesSyncMetaRow, error)
224}
225
226var _ Querier = (*Queries)(nil)
227