Files
member-console/internal/entitlements/queries/resource_pools.sql
T
cgalo5758 8e3c68c6be Make UI surfaces honestly reflect system state
- Add deployment-name branding to titles, mastheads, and OG tags
- Share one grant delivery-state query with lineage across grants
  surfaces
- Show pool status/usage, org owners, and config readiness
- Make billing views projection-aware with recency and sync vocabulary
- Guard FedWiki creation without domains and render route-aware 404s
2026-08-23 01:45:52 -05:00

33 lines
1.2 KiB
SQL

-- name: CreateResourcePool :one
INSERT INTO core.resource_pools (org_id, name, slug, pool_type, is_auto_managed)
VALUES ($1, $2, $3, $4, $5)
RETURNING *;
-- name: GetResourcePoolByID :one
SELECT * FROM core.resource_pools
WHERE pool_id = $1;
-- name: GetDefaultPoolByOrgID :one
SELECT * FROM core.resource_pools
WHERE org_id = $1 AND pool_type = 'default' AND status = 'active'
LIMIT 1;
-- name: GetResourcePoolsByOrgID :many
SELECT * FROM core.resource_pools
WHERE org_id = $1 AND status = 'active'
ORDER BY pool_type ASC, name ASC;
-- name: ListResourcePoolsByOrgIDAnyStatus :many
-- Every pool row for the organization regardless of status -- unlike
-- GetResourcePoolsByOrgID's active-only filter, this does not hide a
-- suspended or archived pool from view. The org-detail composite uses
-- this for its pools panel so an operator sees a pool's actual status
-- (ux-honest-surfaces requirement: "pool status and usage are visible on
-- the organization view") instead of the pool silently vanishing from the
-- list, and so "this org has zero pool rows" (the pool-less breakage
-- case) is distinguishable from "this org's only pool exists but is not
-- active".
SELECT * FROM core.resource_pools
WHERE org_id = $1
ORDER BY pool_type ASC, name ASC;