From 21e17053c635ed625df1b7328ff2ace71c2318fb Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 19 Jul 2023 15:53:22 +0200 Subject: [PATCH] Don't persist the view as doc --- packages/server/src/api/routes/tests/viewV2.spec.ts | 6 ------ packages/server/src/sdk/app/views/index.ts | 4 ---- packages/types/src/api/web/app/view.ts | 5 +---- packages/types/src/documents/app/view.ts | 2 +- 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/packages/server/src/api/routes/tests/viewV2.spec.ts b/packages/server/src/api/routes/tests/viewV2.spec.ts index 7dc4fc1bad..d4c81db55c 100644 --- a/packages/server/src/api/routes/tests/viewV2.spec.ts +++ b/packages/server/src/api/routes/tests/viewV2.spec.ts @@ -62,9 +62,6 @@ describe("/v2/views", () => { ...newView, id: expect.any(String), version: 2, - _id: expect.any(String), - createdAt: expect.any(String), - updatedAt: expect.any(String), }) }) @@ -81,9 +78,6 @@ describe("/v2/views", () => { ...viewFilters, id: expect.any(String), version: 2, - _id: expect.any(String), - createdAt: expect.any(String), - updatedAt: expect.any(String), }) }) }) diff --git a/packages/server/src/sdk/app/views/index.ts b/packages/server/src/sdk/app/views/index.ts index b4bb382bb3..f8798d4947 100644 --- a/packages/server/src/sdk/app/views/index.ts +++ b/packages/server/src/sdk/app/views/index.ts @@ -13,12 +13,8 @@ export async function create( id: coreUtils.newid(), version: 2, } - view._id = view.id const db = context.getAppDB() - - await db.put(view, {}) - const table = await sdk.tables.getTable(tableId) table.views ??= {} diff --git a/packages/types/src/api/web/app/view.ts b/packages/types/src/api/web/app/view.ts index fe95a83483..2cd371a025 100644 --- a/packages/types/src/api/web/app/view.ts +++ b/packages/types/src/api/web/app/view.ts @@ -4,7 +4,4 @@ export interface ViewResponse { data: ViewV2 } -export type CreateViewRequest = Omit< - ViewV2, - "_id" | "_rev" | "createdAt" | "updatedAt" | "version" | "id" -> +export type CreateViewRequest = Omit diff --git a/packages/types/src/documents/app/view.ts b/packages/types/src/documents/app/view.ts index a60fb2a798..238cc69c45 100644 --- a/packages/types/src/documents/app/view.ts +++ b/packages/types/src/documents/app/view.ts @@ -14,7 +14,7 @@ export interface View { meta?: Record } -export interface ViewV2 extends Document { +export interface ViewV2 { version: 2 id: string name: string