Views
AG Grid view definitions and server-side row data for the SPA UI.
ποΈ Get the metadata of a grid view
Returns columns, default sort, capabilities, actions and the user's persisted UI state. The view is built from the FieldDef catalog when the legacy plantilla is not configured (`{feature}-main` always works), and overridden by the user's plantilla when one exists. Cached for 5 minutes per the contract.
ποΈ Save the column layout of a view
Persists the column selection (order + width). The list is the visible column set; the backend keeps adding the PK, FK pair counterparts and ALWAYS_VISIBLE_COLUMN fields on the next GET. Both native (`name`, `code`...) and custom (`customFields.<id>`) apiNames are accepted.
ποΈ Delete a view template
Deletes a named template and sweeps every reference: the template selection of ALL users (`UserPreferencesDocument.viewTemplates` stops listing it, so they fall back to the system view) and the per-user grid states persisted for this viewId. Idempotent: deleting an id that no longer exists returns 204. The system view is not deletable (400).
ποΈ Rename or change visibility of a view template
Merge-patch of `{ name?, visibility? }`; omitted fields are left untouched. Columns are NOT patched here ΓΓΓΆ they go through the existing `PUT /api/v2/views/{viewId}`. The system view (`{featureType}-main`) is not patchable (400). A private template of another user answers 404 (not 403).
ποΈ Persist the user's UI state for a view
Body is the full `UserGridState`. The backend stores it verbatim associated to (userId, viewId) and overwrites the existing state. `filterModel` is OPAQUE: never interpreted by the backend. Max payload ~32 KB.
ποΈ Reset the user's UI state for a view
Idempotent. Returns 204 whether or not the user had a persisted state. After this the next GET returns the default layout.
ποΈ List view templates for a feature
Returns every template the caller can use for the given featureType: the system view (`{featureType}-main`, always first, not editable), then the tenant-shared templates (`visibility=everyone`) and the caller's private ones, each bucket sorted alphabetically. `canEdit`/`canDelete` are computed for the caller: owner of the template, or holder of the EDITAR_PLANTILLASGLOBALES permission.
ποΈ Create a named view template
Creates a template from the grid's current column state. `columns` follows the same shape and normalization as saveViewLayout (order + width; PK, FK pairs and ALWAYS_VISIBLE_COLUMN fields are added by the backend on the next GET). The name is unique (case-insensitive) per (tenant, featureType, owner). Creating with `visibility=everyone` requires the EDITAR_PLANTILLASGLOBALES permission. The create does NOT change the caller's selected template; that stays in `PUT /api/v2/me/preferences` (viewTemplates).
ποΈ Fetch rows for a grid view
Returns a page of rows that satisfies the QueryDSL (pagination, sort, filter, search, grouping, drill-down). Order of evaluation: search → filter → sort → pagination. The hard limit is 500 rows per page.
ποΈ Available fields for a view
Returns every field eligible to be added to the view's plantilla: native FieldDefs (excluding INTERNAL ones) plus the tenant's custom fields. Each entry carries `inPlantilla` so the SPA can render which fields are already part of the user's current layout.