From 783e8a5b08ec3113943b8b5f93e94aab247ae2be Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 25 Jul 2023 19:34:52 +0200 Subject: [PATCH] Change url to include the id --- packages/server/src/api/routes/view.ts | 2 +- packages/server/src/tests/utilities/api/viewV2.ts | 14 ++------------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/packages/server/src/api/routes/view.ts b/packages/server/src/api/routes/view.ts index e5f2fc95db..18c58134b4 100644 --- a/packages/server/src/api/routes/view.ts +++ b/packages/server/src/api/routes/view.ts @@ -14,7 +14,7 @@ router viewController.v2.create ) .put( - `/api/v2/views`, + `/api/v2/views/:viewId`, authorized(permissions.BUILDER), viewController.v2.update ) diff --git a/packages/server/src/tests/utilities/api/viewV2.ts b/packages/server/src/tests/utilities/api/viewV2.ts index bca1a97a61..fae0850f79 100644 --- a/packages/server/src/tests/utilities/api/viewV2.ts +++ b/packages/server/src/tests/utilities/api/viewV2.ts @@ -33,7 +33,7 @@ export class ViewV2API extends TestAPI { } update = async ( - viewData?: Partial, + view: ViewV2, { expectStatus, handleResponse, @@ -42,18 +42,8 @@ export class ViewV2API extends TestAPI { handleResponse?: (response: Response) => void } = { expectStatus: 200 } ): Promise => { - let tableId = viewData?.tableId - if (!tableId && !this.config.table) { - throw "Test requires table to be configured." - } - tableId = this.config.table!._id! - const view = { - tableId, - name: generator.guid(), - ...viewData, - } const result = await this.request - .put(`/api/v2/views`) + .put(`/api/v2/views/${view.id}`) .send(view) .set(this.config.defaultHeaders()) .expect("Content-Type", /json/)