Commit Graph
6 Commits
Author SHA1 Message Date
jimmy fe83013c37 removed m2m markers 2026-09-05 00:28:15 +02:00
jimmy 72b9a116be feat: expose composite foreign keys and m2m columns in OpenAPI
Replace the single-column `<fk table='...' column='...'/>` marker with a
unified, composite-capable format `<fk table='...' columns='local:foreign,...'/>`
and emit full column lists for many-to-many markers, so clients can
reconstruct composite relationships.

- Match every real table relationship a column participates in, instead of
  only single-column foreign keys, still preferring tables over the
  view-derived relationships.
- Emit the full ordered local->foreign column mapping in the `<fk>` marker
  and the full source/target column lists in the `<m2m>` marker.
- Add composite foreign key and composite m2m fixtures plus OpenAPI spec
  assertions.
2026-09-04 23:53:23 +02:00
jimmy 7989108b0b feat: expose row-level can_edit/can_delete on select *
Compute per-row editability and deletability from a table's row-level
security policies and return them as synthetic columns so clients can
hide edit/delete affordances for rows the user cannot change.

- Introspect pg_policies and relrowsecurity at schema-cache load and
  combine the UPDATE/DELETE USING qualifiers per table (permissive OR,
  restrictive AND).
- Store the combined qualifiers on Table and inject can_edit/can_delete
  as computed select fields when expanding `select *`, only for
  RLS-enabled tables with a matching policy (COALESCE'd to a boolean).
- Keep the computed columns out of the OpenAPI spec so they are not
  rendered as regular fields.
- Add a cfExpression field to CoercibleField to carry raw SQL
  expressions through the planner to SqlFragment.
2026-08-29 11:30:21 +02:00
jimmy 77ab8f83ac feat: expose unique columns and many-to-many markers in OpenAPI
Add unique constraint and many-to-many relationship metadata to the
generated OpenAPI spec so clients can render them.

- Store unique constraints on Table as tableUniqueCols (mirroring
  tablePKCols) instead of denormalizing them onto each Column.
- Compute unique constraints via a per-table tbl_unique_cols CTE in
  tablesSqlQuery.
- Annotate unique columns and composite unique constraints in property
  descriptions, and emit m2m markers in table descriptions.
2026-08-20 18:03:43 +02:00
jimmy ce7ea53a57 instead of select * inspect schema to get selectable columns 2026-08-16 14:41:13 +02:00
jimmy 4a5d626112 restrict openapi spec based on sql grants 2026-08-15 21:41:45 +02:00