From ce3d7df39de7f224aa3ef25b9dee01979f5478c1 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 10 Dec 2021 15:17:18 +0000 Subject: [PATCH] Allowing start end key syntax to be used outside of tenancy if we need to. --- packages/auth/src/db/utils.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/auth/src/db/utils.js b/packages/auth/src/db/utils.js index 7ced405c82..a091896342 100644 --- a/packages/auth/src/db/utils.js +++ b/packages/auth/src/db/utils.js @@ -199,8 +199,9 @@ exports.getCouchUrl = () => { return `${protocol}://${env.COUCH_DB_USERNAME}:${env.COUCH_DB_PASSWORD}@${rest}` } -exports.getStartEndKeyURL = (base, baseKey, tenantId = "") => { - return `${base}?startkey="${baseKey}${SEPARATOR}${tenantId}"&endkey="${baseKey}${SEPARATOR}${tenantId}${UNICODE_MAX}"` +exports.getStartEndKeyURL = (base, baseKey, tenantId = null) => { + const tenancy = tenantId ? `${SEPARATOR}${tenantId}` : "" + return `${base}?startkey="${baseKey}${tenancy}"&endkey="${baseKey}${tenancy}${UNICODE_MAX}"` } /**