Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / db/queries/opportunities.sql |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 39df94f92b2a33f852481fe1954dabed841524bb |
| Branch | w0-aedt-compliance |
| Path or archive member | db/queries/opportunities.sql |
| Original SHA-256 | 3c7a4a5424f7c380d3493782ba90dced2c1dee60a19a4cf3f32a9c130910c28a |
| Git blob SHA | 65ac363b5bc14db5731d5dce14a5040514c70804 |
| Reading-copy SHA-256 | 3c7a4a5424f7c380d3493782ba90dced2c1dee60a19a4cf3f32a9c130910c28a |
Recovered source transcript
Download complete source text ↓25 lines · 1.0 KB
-- name: CreateOpportunity :one
INSERT INTO opportunities (organization_id, name, solicitation_number, customer_agency, due_date, status)
VALUES ($1,$2,$3,$4,$5,$6)
RETURNING *;
-- name: GetOpportunity :one
SELECT * FROM opportunities WHERE id = $1;
-- name: ListOpportunities :many
SELECT * FROM opportunities ORDER BY created_at DESC LIMIT $1 OFFSET $2;
-- name: ListRequirementsForOpportunity :many
SELECT * FROM requirements WHERE opportunity_id = $1 AND deleted_at IS NULL ORDER BY created_at DESC;
-- name: ProposalReadiness :many
-- Band/decision rollup across every slate member under one opportunity's requirements — the source
-- for GET /proposal-readiness [review COMPL-2]. RLS scopes all three tables to the caller's org.
SELECT sm.band, sm.decision, COUNT(*) AS n
FROM requirements r
JOIN slates s ON s.requirement_id = r.id
JOIN slate_members sm ON sm.slate_id = s.id
WHERE r.opportunity_id = $1
GROUP BY sm.band, sm.decision
ORDER BY sm.band, sm.decision;