feat(server): team quota (#8955)

This commit is contained in:
DarkSky
2024-12-09 17:51:54 +08:00
committed by GitHub
parent 8fe188e773
commit 9365958a02
51 changed files with 1997 additions and 218 deletions
@@ -3,6 +3,7 @@ import request from 'supertest';
import type { WorkspaceType } from '../../src/core/workspaces';
import { gql } from './common';
import { PermissionEnum } from './utils';
export async function createWorkspace(
app: INestApplication,
@@ -150,3 +151,32 @@ export async function revokePublicPage(
.expect(200);
return res.body.errors?.[0]?.message || res.body.data?.revokePublicPage;
}
export async function grantMember(
app: INestApplication,
token: string,
workspaceId: string,
userId: string,
permission: PermissionEnum
) {
const res = await request(app.getHttpServer())
.post(gql)
.auth(token, { type: 'bearer' })
.set({ 'x-request-id': 'test', 'x-operation-name': 'test' })
.send({
query: `
mutation {
grantMember(
workspaceId: "${workspaceId}"
userId: "${userId}"
permission: ${permission}
)
}
`,
})
.expect(200);
if (res.body.errors) {
throw new Error(res.body.errors[0].message);
}
return res.body.data?.grantMember;
}