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
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:
parent
4d9fb518b1
commit
617411e5b6
2 changed files with 15 additions and 0 deletions
|
|
@ -198,6 +198,10 @@ export class BaserowAdminClient {
|
||||||
|
|
||||||
// -------- Views --------
|
// -------- Views --------
|
||||||
|
|
||||||
|
async listViews(tableId: number): Promise<unknown[]> {
|
||||||
|
return this.request<unknown[]>(`/database/views/table/${tableId}/`);
|
||||||
|
}
|
||||||
|
|
||||||
async createView(tableId: number, payload: CreateViewPayload): Promise<unknown> {
|
async createView(tableId: number, payload: CreateViewPayload): Promise<unknown> {
|
||||||
return this.request(`/database/views/table/${tableId}/`, {
|
return this.request(`/database/views/table/${tableId}/`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
* POST /v1/admin/tables/:tableId/fields body: { name, type, ... }
|
* POST /v1/admin/tables/:tableId/fields body: { name, type, ... }
|
||||||
* PATCH /v1/admin/fields/:fieldId body: { name?, type?, ... }
|
* PATCH /v1/admin/fields/:fieldId body: { name?, type?, ... }
|
||||||
* DELETE /v1/admin/fields/:fieldId
|
* DELETE /v1/admin/fields/:fieldId
|
||||||
|
* GET /v1/admin/tables/:tableId/views list views in table
|
||||||
* POST /v1/admin/tables/:tableId/views body: { name, type }
|
* POST /v1/admin/tables/:tableId/views body: { name, type }
|
||||||
* PATCH /v1/admin/views/:viewId body: { name?, ... }
|
* PATCH /v1/admin/views/:viewId body: { name?, ... }
|
||||||
* DELETE /v1/admin/views/:viewId
|
* DELETE /v1/admin/views/:viewId
|
||||||
|
|
@ -196,6 +197,16 @@ adminRoutes.delete('/fields/:fieldId', requireScope('tables:write'), async (c) =
|
||||||
|
|
||||||
// ---------- Views ----------
|
// ---------- 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(
|
adminRoutes.post(
|
||||||
'/tables/:tableId/views',
|
'/tables/:tableId/views',
|
||||||
requireScope('tables:write'),
|
requireScope('tables:write'),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue