feat(bridge): GET /admin/tables/:tableId/views to list views
Some checks failed
CI / Lint bridge (Biome) (push) Has been cancelled
CI / Security scan (push) Has been cancelled
E2E Playwright / Playwright e2e (chromium) (push) Has been cancelled
CI / Type-check bridge (push) Has been cancelled
CI / Tests unit bridge (push) Has been cancelled
CI / Tests integration bridge (push) Has been cancelled
CI / Docker build + healthcheck (push) Has been cancelled

Needed by the create-database flow on the client to resolve the
auto-created Grid view id and insert the embed node with a real
viewId (so the renderer can fetch its rows).
This commit is contained in:
Corentin JOGUET 2026-05-12 09:08:29 +00:00
parent 4d9fb518b1
commit 617411e5b6
2 changed files with 15 additions and 0 deletions

View file

@ -198,6 +198,10 @@ export class BaserowAdminClient {
// -------- Views --------
async listViews(tableId: number): Promise<unknown[]> {
return this.request<unknown[]>(`/database/views/table/${tableId}/`);
}
async createView(tableId: number, payload: CreateViewPayload): Promise<unknown> {
return this.request(`/database/views/table/${tableId}/`, {
method: 'POST',

View file

@ -14,6 +14,7 @@
* POST /v1/admin/tables/:tableId/fields body: { name, type, ... }
* PATCH /v1/admin/fields/:fieldId body: { name?, type?, ... }
* DELETE /v1/admin/fields/:fieldId
* GET /v1/admin/tables/:tableId/views list views in table
* POST /v1/admin/tables/:tableId/views body: { name, type }
* PATCH /v1/admin/views/:viewId body: { name?, ... }
* DELETE /v1/admin/views/:viewId
@ -196,6 +197,16 @@ adminRoutes.delete('/fields/:fieldId', requireScope('tables:write'), async (c) =
// ---------- Views ----------
adminRoutes.get(
'/tables/:tableId/views',
requireScope('tables:write'),
async (c) => {
const tableId = parseIntId(c.req.param('tableId'), 'tableId');
const data = await getContainer().baserowAdmin.listViews(tableId);
return c.json({ data });
},
);
adminRoutes.post(
'/tables/:tableId/views',
requireScope('tables:write'),