From 55e3cbea59d5d7f345b7c7e937432aa86f6e309b Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Tue, 15 Nov 2022 18:03:27 +0600 Subject: [PATCH] Fix main product ws update (#2381) * Fix main product ws update Signed-off-by: Denis Bykhov * Fix list workspaces Signed-off-by: Denis Bykhov * Fix formatting Signed-off-by: Denis Bykhov Signed-off-by: Denis Bykhov --- server/account/src/index.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/account/src/index.ts b/server/account/src/index.ts index eb7b614ec1..4599b01a7f 100644 --- a/server/account/src/index.ts +++ b/server/account/src/index.ts @@ -340,7 +340,7 @@ export async function listWorkspaces (db: Db, productId: string): Promise(WORKSPACE_COLLECTION) - .find({ productId: { $exists: false } }) + .find({ $or: [{ productId: { $exists: false } }, { productId: '' }] }) .toArray() } return await db.collection(WORKSPACE_COLLECTION).find({ productId }).toArray() @@ -397,7 +397,9 @@ export async function upgradeWorkspace ( throw new PlatformError(new Status(Severity.ERROR, accountPlugin.status.WorkspaceNotFound, { workspace })) } if (ws.productId !== productId) { - throw new PlatformError(new Status(Severity.ERROR, accountPlugin.status.ProductIdMismatch, { productId })) + if (productId !== '' || ws.productId !== undefined) { + throw new PlatformError(new Status(Severity.ERROR, accountPlugin.status.ProductIdMismatch, { productId })) + } } await db.collection(WORKSPACE_COLLECTION).updateOne( { workspace },