Regenerate types/database.ts from a local Supabase built from the canonical scripts/schema.sql. The running dev DB was stale (missing the 'stripe' payment_platform value, members_with_permission, spaces.host_requires_card, payments.link_status, dues_payment_methods.space_id), so it was rebuilt from schema.sql first. With real relationship metadata the 11 `as unknown as … // TODO(types)` join casts are no longer needed: - me portal, session-attendance, member-certifications, equipment-reservations: narrow the action result with `'data' in res` instead of a blanket cast. - stripe / door embeds read the now-typed relation directly. - completeSession + listEquipmentReservations route the embedded-select query through the fully-typed createClient() rather than the wide ServerSupabase gate client (the pattern documented in auth-helpers.ts); equipment disambiguates its two space_members FKs with an explicit !fkey hint. Collapse the hand-maintained governance rows/enums in types/domain/governance.ts into Tables<>/Enums<> aliases. Tighten duesPaymentMethodSchema.platform to the DUES_LINK_PLATFORMS literal union (the old `as unknown as [string,...]` erased it), which the now-correct payment_platform enum requires. The hand-added class_signup_tx / class_cancel_tx RPC entries are now generated natively. typecheck 0 · lint 0 errors · 645 tests · build ok
31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
/**
|
|
* Governance-kernel domain types (proposals, votes, incidents, policies,
|
|
* areas) and their enums.
|
|
*
|
|
* These are thin aliases over the generated database types (`types/database.ts`,
|
|
* regenerated from the canonical schema). Keep them as `Tables<>` / `Enums<>`
|
|
* aliases — do NOT hand-maintain the row shapes here; regenerate the database
|
|
* types instead.
|
|
*/
|
|
import type { Tables, Enums } from '@/types/database'
|
|
|
|
// Enums
|
|
export type ProposalType = Enums<'proposal_type'>
|
|
export type ProposalStatus = Enums<'proposal_status'>
|
|
export type ThresholdRule = Enums<'threshold_rule'>
|
|
export type VotePosition = Enums<'vote_position'>
|
|
export type IncidentStatus = Enums<'incident_status'>
|
|
export type IncidentSeverity = Enums<'incident_severity'>
|
|
export type IncidentUpdateVisibility = Enums<'incident_update_visibility'>
|
|
export type PolicyStatus = Enums<'policy_status'>
|
|
export type FinancialVisibility = Enums<'financial_visibility'>
|
|
export type DirectoryVisibility = Enums<'directory_visibility'>
|
|
|
|
// Rows
|
|
export type SpaceArea = Tables<'space_areas'>
|
|
export type Proposal = Tables<'proposals'>
|
|
export type ProposalVote = Tables<'proposal_votes'>
|
|
export type Incident = Tables<'incidents'>
|
|
export type IncidentUpdateRow = Tables<'incident_updates'>
|
|
export type Policy = Tables<'policies'>
|