From de04a6f76debf3a10bd2cd7ae05a99346c8c1ab6 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 11 Jul 2024 15:34:48 +0200 Subject: [PATCH] Change id --- packages/server/src/api/routes/tests/rowAction.spec.ts | 8 ++++---- packages/server/src/db/utils.ts | 2 +- packages/types/src/documents/document.ts | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/server/src/api/routes/tests/rowAction.spec.ts b/packages/server/src/api/routes/tests/rowAction.spec.ts index e459c45185..a241a23c6b 100644 --- a/packages/server/src/api/routes/tests/rowAction.spec.ts +++ b/packages/server/src/api/routes/tests/rowAction.spec.ts @@ -88,7 +88,7 @@ describe("/rowsActions", () => { const res = await createRowAction(tableId, rowAction, { status: 201 }) expect(res).toEqual({ - _id: `${tableId}_row_actions`, + _id: `ra_${tableId}`, _rev: expect.stringMatching(/^1-\w+/), actions: [ { @@ -110,7 +110,7 @@ describe("/rowsActions", () => { const res = await createRowAction(tableId, rowActions[2]) expect(res).toEqual({ - _id: `${tableId}_row_actions`, + _id: `ra_${tableId}`, _rev: expect.stringMatching(/^3-\w+/), actions: rowActions.map(a => ({ id: expect.any(String), @@ -135,7 +135,7 @@ describe("/rowsActions", () => { const res2 = await createRowAction(otherTableId, rowAction2) expect(res1).toEqual({ - _id: `${tableId}_row_actions`, + _id: `ra_${tableId}`, _rev: expect.stringMatching(/^1-\w+/), actions: [ { @@ -149,7 +149,7 @@ describe("/rowsActions", () => { }) expect(res2).toEqual({ - _id: `${otherTableId}_row_actions`, + _id: `ra_${otherTableId}`, _rev: expect.stringMatching(/^1-\w+/), actions: [ { diff --git a/packages/server/src/db/utils.ts b/packages/server/src/db/utils.ts index 3ee787b50d..e3fe945863 100644 --- a/packages/server/src/db/utils.ts +++ b/packages/server/src/db/utils.ts @@ -355,5 +355,5 @@ export function isRelationshipColumn( * @returns The new row actions ID which the row actions doc can be stored under. */ export function generateRowActionsID(tableId: string) { - return `${tableId}${SEPARATOR}row_actions` + return `${DocumentType.ROW_ACTIONS}${SEPARATOR}${tableId}` } diff --git a/packages/types/src/documents/document.ts b/packages/types/src/documents/document.ts index 0de4337f4b..23aec05ee5 100644 --- a/packages/types/src/documents/document.ts +++ b/packages/types/src/documents/document.ts @@ -39,6 +39,7 @@ export enum DocumentType { AUDIT_LOG = "al", APP_MIGRATION_METADATA = "_design/migrations", SCIM_LOG = "scimlog", + ROW_ACTIONS = "ra", } // these are the core documents that make up the data, design