feat: blob size api (#4060)

This commit is contained in:
DarkSky
2023-08-31 16:39:19 +08:00
committed by GitHub
parent cc00da9325
commit 0add43f8db
9 changed files with 335 additions and 295 deletions

View File

@@ -330,6 +330,28 @@ async function listBlobs(
return res.body.data.listBlobs;
}
async function collectBlobSizes(
app: INestApplication,
token: string,
workspaceId: string
): Promise<number> {
const res = await request(app.getHttpServer())
.post(gql)
.auth(token, { type: 'bearer' })
.set({ 'x-request-id': 'test', 'x-operation-name': 'test' })
.send({
query: `
query {
collectBlobSizes(workspaceId: "${workspaceId}") {
size
}
}
`,
})
.expect(200);
return res.body.data.collectBlobSizes.size;
}
async function setBlob(
app: INestApplication,
token: string,
@@ -424,6 +446,7 @@ async function getInviteInfo(
export {
acceptInvite,
acceptInviteById,
collectBlobSizes,
createTestApp,
createWorkspace,
currentUser,