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/)