feat: add storage panel in setting (#4069)

This commit is contained in:
Qi
2023-08-31 20:36:05 +08:00
committed by GitHub
parent 4ef1425299
commit 260c25acf3
10 changed files with 221 additions and 6 deletions

View File

@@ -613,6 +613,17 @@ export class WorkspaceResolver {
return this.storage.blobsSize(workspaceId).then(size => ({ size }));
}
@Query(() => WorkspaceBlobSizes)
async collectAllBlobSizes(@CurrentUser() user: User) {
const workspaces = await this.workspaces(user);
const size = (
await Promise.all(workspaces.map(({ id }) => this.storage.blobsSize(id)))
).reduce((prev, curr) => prev + curr, 0);
return { size };
}
@Mutation(() => String)
async setBlob(
@CurrentUser() user: UserType,

View File

@@ -154,6 +154,7 @@ type Query {
"""List blobs of workspace"""
listBlobs(workspaceId: String!): [String!]!
collectBlobSizes(workspaceId: String!): WorkspaceBlobSizes!
collectAllBlobSizes: WorkspaceBlobSizes!
"""Get current user"""
currentUser: UserType!