From 3f8497ee3529f4db18c8a4212dd9393e38dc43df Mon Sep 17 00:00:00 2001 From: Alexander Onnikov Date: Thu, 30 Oct 2025 15:42:10 +0700 Subject: [PATCH] add workspace usage info Signed-off-by: Alexander Onnikov --- .../account-client/main_2025-10-30-08-40.json | 10 ++++++++++ .../@hcengineering/core/main_2025-10-30-08-40.json | 10 ++++++++++ packages/account-client/src/client.ts | 13 ++++++++++++- packages/core/src/classes.ts | 9 ++++++++- 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 common/changes/@hcengineering/account-client/main_2025-10-30-08-40.json create mode 100644 common/changes/@hcengineering/core/main_2025-10-30-08-40.json diff --git a/common/changes/@hcengineering/account-client/main_2025-10-30-08-40.json b/common/changes/@hcengineering/account-client/main_2025-10-30-08-40.json new file mode 100644 index 0000000000..f042c07b72 --- /dev/null +++ b/common/changes/@hcengineering/account-client/main_2025-10-30-08-40.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@hcengineering/account-client", + "comment": "add workspace usage info", + "type": "patch" + } + ], + "packageName": "@hcengineering/account-client" +} \ No newline at end of file diff --git a/common/changes/@hcengineering/core/main_2025-10-30-08-40.json b/common/changes/@hcengineering/core/main_2025-10-30-08-40.json new file mode 100644 index 0000000000..967e7a80c3 --- /dev/null +++ b/common/changes/@hcengineering/core/main_2025-10-30-08-40.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@hcengineering/core", + "comment": "add workspace usae info", + "type": "patch" + } + ], + "packageName": "@hcengineering/core" +} \ No newline at end of file diff --git a/packages/account-client/src/client.ts b/packages/account-client/src/client.ts index 22f7a54502..92b7c5f7a5 100644 --- a/packages/account-client/src/client.ts +++ b/packages/account-client/src/client.ts @@ -16,7 +16,7 @@ import { type AccountInfo, type AccountRole, type AccountUuid, - BackupStatus, + type BackupStatus, concatLink, Data, type Person, @@ -25,6 +25,7 @@ import { type PersonUuid, type SocialIdType, Version, + type UsageStatus, type WorkspaceInfoWithStatus, type WorkspaceMemberInfo, WorkspaceMode, @@ -182,6 +183,7 @@ export interface AccountClient { ) => Promise assignWorkspace: (email: string, workspaceUuid: string, role: AccountRole) => Promise updateBackupInfo: (info: BackupStatus) => Promise + updateUsageInfo: (info: UsageStatus) => Promise updateWorkspaceRoleBySocialKey: (socialKey: string, targetRole: AccountRole) => Promise ensurePerson: ( socialType: SocialIdType, @@ -846,6 +848,15 @@ class AccountClientImpl implements AccountClient { await this.rpc(request) } + async updateUsageInfo (usageInfo: UsageStatus): Promise { + const request = { + method: 'updateUsageInfo' as const, + params: { usageInfo } + } + + await this.rpc(request) + } + async assignWorkspace (email: string, workspaceUuid: string, role: AccountRole): Promise { const request = { method: 'assignWorkspace' as const, diff --git a/packages/core/src/classes.ts b/packages/core/src/classes.ts index d1da844c83..b57c4c7b1b 100644 --- a/packages/core/src/classes.ts +++ b/packages/core/src/classes.ts @@ -1,6 +1,6 @@ // // Copyright © 2020, 2021 Anticrm Platform Contributors. -// Copyright © 2021 Hardcore Engineering Inc. +// Copyright © 2021, 2025 Hardcore Engineering Inc. // // Licensed under the Eclipse Public License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. You may @@ -873,6 +873,12 @@ export interface BackupStatus { backups: number } +export interface UsageStatus { + usage: Record + startTime: Timestamp + updateTime: Timestamp +} + export interface WorkspaceInfoWithStatus extends WorkspaceInfo { isDisabled?: boolean versionMajor: number @@ -882,6 +888,7 @@ export interface WorkspaceInfoWithStatus extends WorkspaceInfo { mode: WorkspaceMode processingProgress?: number backupInfo?: BackupStatus + usageInfo?: UsageStatus processingAttemps: number }