Use v2 as prefix
This commit is contained in:
parent
e3c4930819
commit
03f84170b8
|
@ -23,7 +23,7 @@ function priceTable(): Table {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
describe("/views/v2", () => {
|
describe("/v2/views", () => {
|
||||||
const request = setup.getRequest()
|
const request = setup.getRequest()
|
||||||
const config = setup.getConfig()
|
const config = setup.getConfig()
|
||||||
let table: Table
|
let table: Table
|
||||||
|
@ -37,7 +37,7 @@ describe("/views/v2", () => {
|
||||||
|
|
||||||
const saveView = async (view: ViewV2) => {
|
const saveView = async (view: ViewV2) => {
|
||||||
return request
|
return request
|
||||||
.post(`/api/views/v2`)
|
.post(`/api/v2/views`)
|
||||||
.send(view)
|
.send(view)
|
||||||
.set(config.defaultHeaders())
|
.set(config.defaultHeaders())
|
||||||
.expect("Content-Type", /json/)
|
.expect("Content-Type", /json/)
|
||||||
|
@ -46,7 +46,7 @@ describe("/views/v2", () => {
|
||||||
|
|
||||||
const getView = (viewId: string) => {
|
const getView = (viewId: string) => {
|
||||||
return request
|
return request
|
||||||
.get(`/api/views/v2/${viewId}`)
|
.get(`/api/v2/views/${viewId}`)
|
||||||
.set(config.defaultHeaders())
|
.set(config.defaultHeaders())
|
||||||
.expect("Content-Type", /json/)
|
.expect("Content-Type", /json/)
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ describe("/views/v2", () => {
|
||||||
|
|
||||||
it("returns all views", async () => {
|
it("returns all views", async () => {
|
||||||
const res = await request
|
const res = await request
|
||||||
.get(`/api/views/v2`)
|
.get(`/api/v2/views`)
|
||||||
.set(config.defaultHeaders())
|
.set(config.defaultHeaders())
|
||||||
.expect("Content-Type", /json/)
|
.expect("Content-Type", /json/)
|
||||||
.expect(200)
|
.expect(200)
|
||||||
|
@ -90,7 +90,7 @@ describe("/views/v2", () => {
|
||||||
newViews.push(res.body)
|
newViews.push(res.body)
|
||||||
}
|
}
|
||||||
const res = await request
|
const res = await request
|
||||||
.get(`/api/views/v2?tableId=${newTable._id}`)
|
.get(`/api/v2/views?tableId=${newTable._id}`)
|
||||||
.set(config.defaultHeaders())
|
.set(config.defaultHeaders())
|
||||||
.expect("Content-Type", /json/)
|
.expect("Content-Type", /json/)
|
||||||
.expect(200)
|
.expect(200)
|
||||||
|
@ -104,7 +104,7 @@ describe("/views/v2", () => {
|
||||||
it("can not filter by multiple table ids", async () => {
|
it("can not filter by multiple table ids", async () => {
|
||||||
const res = await request
|
const res = await request
|
||||||
.get(
|
.get(
|
||||||
`/api/views/v2?tableId=${structures.generator.guid()}&tableId=${structures.generator.guid()}`
|
`/api/v2/views?tableId=${structures.generator.guid()}&tableId=${structures.generator.guid()}`
|
||||||
)
|
)
|
||||||
.set(config.defaultHeaders())
|
.set(config.defaultHeaders())
|
||||||
.expect("Content-Type", /json/)
|
.expect("Content-Type", /json/)
|
||||||
|
@ -166,7 +166,7 @@ describe("/views/v2", () => {
|
||||||
await getView(view._id).expect(200)
|
await getView(view._id).expect(200)
|
||||||
|
|
||||||
await request
|
await request
|
||||||
.delete(`/api/views/v2/${view._id}`)
|
.delete(`/api/v2/views/${view._id}`)
|
||||||
.set(config.defaultHeaders())
|
.set(config.defaultHeaders())
|
||||||
.expect(204)
|
.expect(204)
|
||||||
|
|
||||||
|
|
|
@ -9,22 +9,22 @@ const router: Router = new Router()
|
||||||
|
|
||||||
router
|
router
|
||||||
.get(
|
.get(
|
||||||
"/api/views/v2",
|
"/api/v2/views",
|
||||||
authorized(permissions.BUILDER),
|
authorized(permissions.BUILDER),
|
||||||
viewController.v2.fetch
|
viewController.v2.fetch
|
||||||
)
|
)
|
||||||
.get(
|
.get(
|
||||||
`/api/views/v2/:viewId`,
|
`/api/v2/views/:viewId`,
|
||||||
authorized(permissions.BUILDER),
|
authorized(permissions.BUILDER),
|
||||||
viewController.v2.find
|
viewController.v2.find
|
||||||
)
|
)
|
||||||
.post(
|
.post(
|
||||||
"/api/views/v2",
|
"/api/v2/views",
|
||||||
authorized(permissions.BUILDER),
|
authorized(permissions.BUILDER),
|
||||||
viewController.v2.save
|
viewController.v2.save
|
||||||
)
|
)
|
||||||
.delete(
|
.delete(
|
||||||
`/api/views/v2/:viewId`,
|
`/api/v2/views/:viewId`,
|
||||||
authorized(permissions.BUILDER),
|
authorized(permissions.BUILDER),
|
||||||
viewController.v2.remove
|
viewController.v2.remove
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue