Don't persist the view as doc

This commit is contained in:
Adria Navarro 2023-07-19 15:53:22 +02:00
parent d6121d1504
commit 21e17053c6
4 changed files with 2 additions and 15 deletions

View File

@ -62,9 +62,6 @@ describe("/v2/views", () => {
...newView, ...newView,
id: expect.any(String), id: expect.any(String),
version: 2, version: 2,
_id: expect.any(String),
createdAt: expect.any(String),
updatedAt: expect.any(String),
}) })
}) })
@ -81,9 +78,6 @@ describe("/v2/views", () => {
...viewFilters, ...viewFilters,
id: expect.any(String), id: expect.any(String),
version: 2, version: 2,
_id: expect.any(String),
createdAt: expect.any(String),
updatedAt: expect.any(String),
}) })
}) })
}) })

View File

@ -13,12 +13,8 @@ export async function create(
id: coreUtils.newid(), id: coreUtils.newid(),
version: 2, version: 2,
} }
view._id = view.id
const db = context.getAppDB() const db = context.getAppDB()
await db.put(view, {})
const table = await sdk.tables.getTable(tableId) const table = await sdk.tables.getTable(tableId)
table.views ??= {} table.views ??= {}

View File

@ -4,7 +4,4 @@ export interface ViewResponse {
data: ViewV2 data: ViewV2
} }
export type CreateViewRequest = Omit< export type CreateViewRequest = Omit<ViewV2, "version" | "id">
ViewV2,
"_id" | "_rev" | "createdAt" | "updatedAt" | "version" | "id"
>

View File

@ -14,7 +14,7 @@ export interface View {
meta?: Record<string, any> meta?: Record<string, any>
} }
export interface ViewV2 extends Document { export interface ViewV2 {
version: 2 version: 2
id: string id: string
name: string name: string