mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
feat(server): support query overcapacity member count of workspace (#12050)
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
- **New Features**
- Workspace quota information now includes a new metric: the count of members exceeding seat capacity ("overcapacityMemberCount"), available in both numeric and human-readable formats.
- The workspace quota display and related queries have been updated to show this new overcapacity member count alongside existing quota metrics.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -142,12 +142,16 @@ export class QuotaService {
|
||||
const usedStorageQuota = quota.ownerQuota
|
||||
? await this.getUserStorageUsage(quota.ownerQuota)
|
||||
: await this.getWorkspaceStorageUsage(workspaceId);
|
||||
const memberCount = await this.models.workspaceUser.count(workspaceId);
|
||||
const memberCount =
|
||||
await this.models.workspaceUser.chargedCount(workspaceId);
|
||||
const overcapacityMemberCount =
|
||||
await this.models.workspaceUser.insufficientSeatMemberCount(workspaceId);
|
||||
|
||||
return {
|
||||
...quota,
|
||||
usedStorageQuota,
|
||||
memberCount,
|
||||
overcapacityMemberCount,
|
||||
usedSize: usedStorageQuota,
|
||||
};
|
||||
}
|
||||
@@ -203,6 +207,7 @@ export class QuotaService {
|
||||
historyPeriod: formatDate(quota.historyPeriod),
|
||||
memberLimit: quota.memberLimit.toString(),
|
||||
memberCount: quota.memberCount.toString(),
|
||||
overcapacityMemberCount: quota.overcapacityMemberCount.toString(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,9 @@ export class WorkspaceQuotaHumanReadableType {
|
||||
|
||||
@Field()
|
||||
memberCount!: string;
|
||||
|
||||
@Field()
|
||||
overcapacityMemberCount!: string;
|
||||
}
|
||||
|
||||
@ObjectType()
|
||||
@@ -110,6 +113,9 @@ export class WorkspaceQuotaType implements Partial<WorkspaceQuota> {
|
||||
@Field()
|
||||
memberCount!: number;
|
||||
|
||||
@Field()
|
||||
overcapacityMemberCount!: number;
|
||||
|
||||
@Field()
|
||||
humanReadable!: WorkspaceQuotaHumanReadableType;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user