Change url to include the id

This commit is contained in:
Adria Navarro 2023-07-25 19:34:52 +02:00
parent 9235afb5d9
commit 783e8a5b08
2 changed files with 3 additions and 13 deletions

View File

@ -14,7 +14,7 @@ router
viewController.v2.create
)
.put(
`/api/v2/views`,
`/api/v2/views/:viewId`,
authorized(permissions.BUILDER),
viewController.v2.update
)

View File

@ -33,7 +33,7 @@ export class ViewV2API extends TestAPI {
}
update = async (
viewData?: Partial<ViewV2>,
view: ViewV2,
{
expectStatus,
handleResponse,
@ -42,18 +42,8 @@ export class ViewV2API extends TestAPI {
handleResponse?: (response: Response) => void
} = { expectStatus: 200 }
): Promise<ViewV2> => {
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/)