feat: add user level blob quota (#4114)

This commit is contained in:
DarkSky
2023-09-01 20:56:27 +08:00
committed by GitHub
parent e76cdf4d71
commit 7d3b1ad2b9
8 changed files with 99 additions and 20 deletions

View File

@@ -339,7 +339,6 @@ async function collectBlobSizes(
const res = await request(app.getHttpServer())
.post(gql)
.auth(token, { type: 'bearer' })
.set({ 'x-request-id': 'test', 'x-operation-name': 'test' })
.send({
query: `
query {
@@ -353,6 +352,26 @@ async function collectBlobSizes(
return res.body.data.collectBlobSizes.size;
}
async function collectAllBlobSizes(
app: INestApplication,
token: string
): Promise<number> {
const res = await request(app.getHttpServer())
.post(gql)
.auth(token, { type: 'bearer' })
.send({
query: `
query {
collectAllBlobSizes {
size
}
}
`,
})
.expect(200);
return res.body.data.collectAllBlobSizes.size;
}
async function setBlob(
app: INestApplication,
token: string,
@@ -447,6 +466,7 @@ async function getInviteInfo(
export {
acceptInvite,
acceptInviteById,
collectAllBlobSizes,
collectBlobSizes,
createTestApp,
createWorkspace,