From 2d75bc750be6230ae066221df34baf924357ab76 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 25 Feb 2021 12:21:24 +0000 Subject: [PATCH] relationship type constant --- packages/server/src/constants/index.js | 4 ++++ packages/server/src/db/linkedRows/LinkController.js | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/server/src/constants/index.js b/packages/server/src/constants/index.js index ff2e6f19f0..c71e43d1fa 100644 --- a/packages/server/src/constants/index.js +++ b/packages/server/src/constants/index.js @@ -12,6 +12,10 @@ exports.FieldTypes = { AUTO: "auto", } +exports.RelationshipTypes = { + ONE_TO_MANY: "one-to-many", +} + exports.AuthTypes = { APP: "app", BUILDER: "builder", diff --git a/packages/server/src/db/linkedRows/LinkController.js b/packages/server/src/db/linkedRows/LinkController.js index 9230c62e73..a02c9946ef 100644 --- a/packages/server/src/db/linkedRows/LinkController.js +++ b/packages/server/src/db/linkedRows/LinkController.js @@ -2,7 +2,7 @@ const CouchDB = require("../index") const { IncludeDocs, getLinkDocuments } = require("./linkUtils") const { generateLinkID } = require("../utils") const Sentry = require("@sentry/node") -const { FieldTypes } = require("../../constants") +const { FieldTypes, RelationshipTypes } = require("../../constants") /** * Creates a new link document structure which can be put to the database. It is important to @@ -150,7 +150,7 @@ class LinkController { // iterate through the link IDs in the row field, see if any don't exist already for (let linkId of rowField) { - if (linkedSchema.relationshipType === "one-to-many") { + if (linkedSchema.relationshipType === RelationshipTypes.ONE_TO_MANY) { const links = await getLinkDocuments({ appId: this._appId, tableId: field.tableId,