Files
member-console/internal/organization/querier.go
T
cgalo5758 257955c9d3 Add operator list-scale contract and People directory
Governed operator lists (organizations, grants, people, billing×4) gain
server-side search, status filters, and 50-row pages with true totals
from count(*) OVER(); state is URL-addressable, out-of-range pages
clamp,
and no-match is distinct from true-empty.

People is the eighth flat sidebar entry: /operator/persons lists persons
newest-joined first (excluding the reserved system person), rows linking
to the existing detail.

Billing gains an operator invoice detail at
/operator/billing/invoices/{invoiceID} reusing the member projection;
open invoices past due present as Overdue (derived, filterable, stored
status untouched); all four views lead with the linked organization and
mute object IDs.

Grants filter over the derived Live/Superseded/Inactive state, the SQL
HAVING predicate pinned to the Go derivation by test. Embedded lists
(org composite ledger, Tier changes) adopt the shared controls under
namespaced params with sibling-state-preserving URLs and scoped htmx
swaps that hold the viewport.

Review corrections: blocked ladder Delete renders disabled with tooltip
and mutations fire toasts; collapse triggers paint their open state;
sections use outside headings; plan topology drops the orphan-product
check; domains policy collapses behind a disclosure.
2026-08-24 03:58:18 -05:00

92 lines
5.7 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.29.0
package organization
import (
"context"
)
type Querier interface {
// Setup-checklist existence probe; reserved types never carry a default.
AnyOrgTypeWithDefaultPlan(ctx context.Context) (bool, error)
// Operator overview headline. Personal orgs exist one-per-member by
// structural convention (design/organization/architecture.md §2), so an
// organizations count that includes them tracks the people count and reads
// as an error. Negative-space predicate instead of org_type = 'team':
// everything active that is neither the auto-created personal type nor a
// reserved type counts, so team, enterprise, and deployment-defined types
// need no code change here and the reserved system org never appears.
CountTeamOrganizations(ctx context.Context) (int64, error)
CountWorkspacesByOrgID(ctx context.Context, orgID string) (int64, error)
CreateOrgMember(ctx context.Context, arg CreateOrgMemberParams) (OrgMember, error)
CreateOrganization(ctx context.Context, arg CreateOrganizationParams) (Organization, error)
CreateRoleAssignment(ctx context.Context, arg CreateRoleAssignmentParams) (RoleAssignment, error)
CreateWorkspace(ctx context.Context, arg CreateWorkspaceParams) (Workspace, error)
// Idempotently insert the reserved 'system' org type. is_reserved=TRUE keeps it
// out of the operator config UI; default_plan_ladder_id stays NULL, so
// auto-provisioning issues no default grant for system orgs.
EnsureSystemOrgType(ctx context.Context, arg EnsureSystemOrgTypeParams) error
// Idempotently insert the singleton System organization (keyed on the unique
// slug). Read back with GetOrganizationBySlug.
EnsureSystemOrganization(ctx context.Context, arg EnsureSystemOrganizationParams) error
// Idempotently insert the System tenant's workspace (keyed on the unique
// org_id+slug). Only called when the system org has no workspace yet.
EnsureSystemWorkspace(ctx context.Context, arg EnsureSystemWorkspaceParams) error
GetOrgMemberByPersonAndOrg(ctx context.Context, arg GetOrgMemberByPersonAndOrgParams) (OrgMember, error)
GetOrgMembersByOrgID(ctx context.Context, orgID string) ([]GetOrgMembersByOrgIDRow, error)
GetOrgType(ctx context.Context, orgType string) (OrgType, error)
GetOrganizationByID(ctx context.Context, orgID string) (Organization, error)
GetOrganizationBySlug(ctx context.Context, slug string) (Organization, error)
GetOrganizationsByOwner(ctx context.Context, ownerPersonID string) ([]Organization, error)
GetRoleAssignmentsByPersonAndOrg(ctx context.Context, arg GetRoleAssignmentsByPersonAndOrgParams) ([]GetRoleAssignmentsByPersonAndOrgRow, error)
// Natural-key resolver: the workspace of the singleton organization whose
// org_type is 'system'. Returns the oldest workspace so a pre-existing
// workspace (e.g. an ad-hoc seed using a different slug) is adopted rather
// than duplicated.
GetSystemOrgWorkspace(ctx context.Context) (Workspace, error)
GetSystemRoleByName(ctx context.Context, roleName string) (Role, error)
GetWorkspaceByID(ctx context.Context, workspaceID string) (Workspace, error)
GetWorkspacesByOrgID(ctx context.Context, orgID string) ([]Workspace, error)
// Operator composite's Members section. Active members only (status='active',
// excluding removed/historical rows). Defensive LIMIT 200 per design D5;
// pagination is YAGNI until a real org pushes 50+ members.
ListActiveMembersByOrgID(ctx context.Context, orgID string) ([]ListActiveMembersByOrgIDRow, error)
// Person-detail "Org memberships" section. Returns each org the person
// belongs to (active memberships only) with the org's display fields and
// the person's role at that org. Sorted by joined_at DESC so the most
// recent membership appears first — operators usually want "what's the
// person doing now" rather than "where did they start."
ListActiveMembershipsByPersonID(ctx context.Context, personID string) ([]ListActiveMembershipsByPersonIDRow, error)
// Operator-facing list: excludes reserved (app-managed) org types like 'system'
// so they don't render as editable cards on the Org Types management page.
ListConfigurableOrgTypes(ctx context.Context) ([]OrgType, error)
ListOrgTypes(ctx context.Context) ([]OrgType, error)
ListOrganizations(ctx context.Context) ([]Organization, error)
ListOrganizationsByType(ctx context.Context, orgType string) ([]Organization, error)
// Organizations list operator surface (operator-list-scale UX-4): the
// paged, searched, org-type-filtered successor to ListOrganizationsWithOwner
// -- each row still carries its owner's display name so no organization can
// read as unowned (ux-honest-surfaces UX-16). owner_person_id is NOT NULL
// (every organization has an owner person, the System tenant included --
// 00001_init.sql), so the LEFT JOIN is defensive rather than expected to
// ever drop the owner's name.
//
// sqlc.narg(q): NULL matches every row; set, a case-insensitive substring
// match against the organization's name or slug, or its owner's display
// name or primary email (operator-list-scale: "carries a scoped
// server-side search" -- "organizations: name, slug, and owner name or
// email").
// sqlc.narg(org_type): NULL matches every org type; set, an exact facet
// match (operator-list-scale: "Status filters exist ... organizations: org
// type").
// count(*) OVER() carries the true total for the filtered set alongside
// the page's rows (design D2), so the stated total never reflects only the
// page.
ListOrganizationsPage(ctx context.Context, arg ListOrganizationsPageParams) ([]ListOrganizationsPageRow, error)
UpdateOrgTypeDefaultPlanLadder(ctx context.Context, arg UpdateOrgTypeDefaultPlanLadderParams) (OrgType, error)
}
var _ Querier = (*Queries)(nil)