mirror of
https://github.com/hcengineering/platform.git
synced 2025-05-30 20:28:20 +00:00
Fix main product ws update (#2381)
* Fix main product ws update Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com> * Fix list workspaces Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com> * Fix formatting Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com> Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
074eabbce6
commit
55e3cbea59
@ -340,7 +340,7 @@ export async function listWorkspaces (db: Db, productId: string): Promise<Worksp
|
||||
if (productId === '') {
|
||||
return await db
|
||||
.collection<Workspace>(WORKSPACE_COLLECTION)
|
||||
.find({ productId: { $exists: false } })
|
||||
.find({ $or: [{ productId: { $exists: false } }, { productId: '' }] })
|
||||
.toArray()
|
||||
}
|
||||
return await db.collection<Workspace>(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 },
|
||||
|
Loading…
Reference in New Issue
Block a user