Remove :tableid from view create
This commit is contained in:
parent
6d973ce99a
commit
56e6d48ec7
|
@ -2,8 +2,8 @@ import sdk from "../../../sdk"
|
|||
import { CreateViewRequest, Ctx, ViewResponse } from "@budibase/types"
|
||||
|
||||
export async function create(ctx: Ctx<CreateViewRequest, ViewResponse>) {
|
||||
const { tableId } = ctx.params
|
||||
const view = ctx.request.body
|
||||
const { tableId } = view
|
||||
|
||||
const result = await sdk.views.create(tableId, view)
|
||||
ctx.status = 201
|
||||
|
|
|
@ -743,12 +743,9 @@ describe("/rows", () => {
|
|||
})
|
||||
)
|
||||
|
||||
const createViewResponse = await config.api.viewV2.create(
|
||||
config.table?._id!,
|
||||
{
|
||||
query: { equal: { age: 40 } },
|
||||
}
|
||||
)
|
||||
const createViewResponse = await config.api.viewV2.create({
|
||||
query: { equal: { age: 40 } },
|
||||
})
|
||||
|
||||
const response = await config.api.viewV2.search(createViewResponse.id)
|
||||
|
||||
|
@ -833,12 +830,9 @@ describe("/rows", () => {
|
|||
})
|
||||
}
|
||||
|
||||
const createViewResponse = await config.api.viewV2.create(
|
||||
config.table?._id!,
|
||||
{
|
||||
sort: sortParams,
|
||||
}
|
||||
)
|
||||
const createViewResponse = await config.api.viewV2.create({
|
||||
sort: sortParams,
|
||||
})
|
||||
|
||||
const response = await config.api.viewV2.search(createViewResponse.id)
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ describe("/v2/views", () => {
|
|||
name: generator.name(),
|
||||
tableId: config.table!._id!,
|
||||
}
|
||||
const res = await config.api.viewV2.create(config.table?._id, newView)
|
||||
const res = await config.api.viewV2.create(newView)
|
||||
|
||||
expect(res).toEqual({
|
||||
...newView,
|
||||
|
@ -71,7 +71,7 @@ describe("/v2/views", () => {
|
|||
tableId: config.table!._id!,
|
||||
...viewFilters,
|
||||
}
|
||||
const res = await config.api.viewV2.create(config.table!._id!, newView)
|
||||
const res = await config.api.viewV2.create(newView)
|
||||
|
||||
expect(res).toEqual({
|
||||
...newView,
|
||||
|
|
|
@ -9,7 +9,7 @@ const router: Router = new Router()
|
|||
|
||||
router
|
||||
.post(
|
||||
"/api/v2/views/:tableId",
|
||||
"/api/v2/views",
|
||||
authorized(permissions.BUILDER),
|
||||
viewController.v2.create
|
||||
)
|
||||
|
|
|
@ -9,10 +9,10 @@ export class ViewV2API extends TestAPI {
|
|||
}
|
||||
|
||||
create = async (
|
||||
tableId?: string,
|
||||
viewData?: Partial<ViewV2>,
|
||||
{ expectStatus } = { expectStatus: 201 }
|
||||
): Promise<ViewV2> => {
|
||||
let tableId = viewData?.tableId
|
||||
if (!tableId && !this.config.table) {
|
||||
throw "Test requires table to be configured."
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ export class ViewV2API extends TestAPI {
|
|||
...viewData,
|
||||
}
|
||||
const result = await this.request
|
||||
.post(`/api/v2/views/${tableId}`)
|
||||
.post(`/api/v2/views`)
|
||||
.send(view)
|
||||
.set(this.config.defaultHeaders())
|
||||
.expect("Content-Type", /json/)
|
||||
|
|
Loading…
Reference in New Issue