mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 10:22:55 +08:00
feat(server): team quota (#8955)
This commit is contained in:
@@ -10,6 +10,7 @@ query getMembersByWorkspaceId($workspaceId: String!, $skip: Int!, $take: Int!) {
|
||||
inviteId
|
||||
accepted
|
||||
emailVerified
|
||||
status
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ query getWorkspaces {
|
||||
workspaces {
|
||||
id
|
||||
initialized
|
||||
team
|
||||
owner {
|
||||
id
|
||||
}
|
||||
|
||||
@@ -442,6 +442,7 @@ query getMembersByWorkspaceId($workspaceId: String!, $skip: Int!, $take: Int!) {
|
||||
inviteId
|
||||
accepted
|
||||
emailVerified
|
||||
status
|
||||
}
|
||||
}
|
||||
}`,
|
||||
@@ -702,6 +703,7 @@ query getWorkspaces {
|
||||
workspaces {
|
||||
id
|
||||
initialized
|
||||
team
|
||||
owner {
|
||||
id
|
||||
}
|
||||
@@ -1166,19 +1168,33 @@ mutation verifyEmail($token: String!) {
|
||||
}`,
|
||||
};
|
||||
|
||||
export const getEnableUrlPreviewQuery = {
|
||||
id: 'getEnableUrlPreviewQuery' as const,
|
||||
operationName: 'getEnableUrlPreview',
|
||||
export const getWorkspaceConfigQuery = {
|
||||
id: 'getWorkspaceConfigQuery' as const,
|
||||
operationName: 'getWorkspaceConfig',
|
||||
definitionName: 'workspace',
|
||||
containsFile: false,
|
||||
query: `
|
||||
query getEnableUrlPreview($id: String!) {
|
||||
query getWorkspaceConfig($id: String!) {
|
||||
workspace(id: $id) {
|
||||
enableAi
|
||||
enableUrlPreview
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const setEnableAiMutation = {
|
||||
id: 'setEnableAiMutation' as const,
|
||||
operationName: 'setEnableAi',
|
||||
definitionName: 'updateWorkspace',
|
||||
containsFile: false,
|
||||
query: `
|
||||
mutation setEnableAi($id: ID!, $enableAi: Boolean!) {
|
||||
updateWorkspace(input: {id: $id, enableAi: $enableAi}) {
|
||||
id
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const setEnableUrlPreviewMutation = {
|
||||
id: 'setEnableUrlPreviewMutation' as const,
|
||||
operationName: 'setEnableUrlPreview',
|
||||
@@ -1306,6 +1322,47 @@ mutation acceptInviteByInviteId($workspaceId: String!, $inviteId: String!, $send
|
||||
}`,
|
||||
};
|
||||
|
||||
export const inviteBatchMutation = {
|
||||
id: 'inviteBatchMutation' as const,
|
||||
operationName: 'inviteBatch',
|
||||
definitionName: 'inviteBatch',
|
||||
containsFile: false,
|
||||
query: `
|
||||
mutation inviteBatch($workspaceId: String!, $emails: [String!]!, $sendInviteMail: Boolean) {
|
||||
inviteBatch(
|
||||
workspaceId: $workspaceId
|
||||
emails: $emails
|
||||
sendInviteMail: $sendInviteMail
|
||||
) {
|
||||
email
|
||||
inviteId
|
||||
sentSuccess
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const inviteLinkMutation = {
|
||||
id: 'inviteLinkMutation' as const,
|
||||
operationName: 'inviteLink',
|
||||
definitionName: 'inviteLink',
|
||||
containsFile: false,
|
||||
query: `
|
||||
mutation inviteLink($workspaceId: String!, $expireTime: WorkspaceInviteLinkExpireTime!) {
|
||||
inviteLink(workspaceId: $workspaceId, expireTime: $expireTime)
|
||||
}`,
|
||||
};
|
||||
|
||||
export const revokeInviteLinkMutation = {
|
||||
id: 'revokeInviteLinkMutation' as const,
|
||||
operationName: 'revokeInviteLink',
|
||||
definitionName: 'revokeInviteLink',
|
||||
containsFile: false,
|
||||
query: `
|
||||
mutation revokeInviteLink($workspaceId: String!) {
|
||||
revokeInviteLink(workspaceId: $workspaceId)
|
||||
}`,
|
||||
};
|
||||
|
||||
export const workspaceQuotaQuery = {
|
||||
id: 'workspaceQuotaQuery' as const,
|
||||
operationName: 'workspaceQuota',
|
||||
@@ -1333,3 +1390,25 @@ query workspaceQuota($id: String!) {
|
||||
}
|
||||
}`,
|
||||
};
|
||||
|
||||
export const approveWorkspaceTeamMemberMutation = {
|
||||
id: 'approveWorkspaceTeamMemberMutation' as const,
|
||||
operationName: 'approveWorkspaceTeamMember',
|
||||
definitionName: 'approveMember',
|
||||
containsFile: false,
|
||||
query: `
|
||||
mutation approveWorkspaceTeamMember($workspaceId: String!, $userId: String!) {
|
||||
approveMember(workspaceId: $workspaceId, userId: $userId)
|
||||
}`,
|
||||
};
|
||||
|
||||
export const grantWorkspaceTeamMemberMutation = {
|
||||
id: 'grantWorkspaceTeamMemberMutation' as const,
|
||||
operationName: 'grantWorkspaceTeamMember',
|
||||
definitionName: 'grantMember',
|
||||
containsFile: false,
|
||||
query: `
|
||||
mutation grantWorkspaceTeamMember($workspaceId: String!, $userId: String!, $permission: Permission!) {
|
||||
grantMember(workspaceId: $workspaceId, userId: $userId, permission: $permission)
|
||||
}`,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
query getWorkspaceConfig($id: String!) {
|
||||
workspace(id: $id) {
|
||||
enableAi
|
||||
enableUrlPreview
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
mutation setEnableAi($id: ID!, $enableAi: Boolean!) {
|
||||
updateWorkspace(input: { id: $id, enableAi: $enableAi }) {
|
||||
id
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
query getEnableUrlPreview($id: String!) {
|
||||
workspace(id: $id) {
|
||||
enableUrlPreview
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
mutation inviteBatch(
|
||||
$workspaceId: String!
|
||||
$emails: [String!]!
|
||||
$sendInviteMail: Boolean
|
||||
) {
|
||||
inviteBatch(
|
||||
workspaceId: $workspaceId
|
||||
emails: $emails
|
||||
sendInviteMail: $sendInviteMail
|
||||
) {
|
||||
email
|
||||
inviteId
|
||||
sentSuccess
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
mutation inviteLink(
|
||||
$workspaceId: String!
|
||||
$expireTime: WorkspaceInviteLinkExpireTime!
|
||||
) {
|
||||
inviteLink(workspaceId: $workspaceId, expireTime: $expireTime)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
mutation revokeInviteLink($workspaceId: String!) {
|
||||
revokeInviteLink(workspaceId: $workspaceId)
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
mutation approveWorkspaceTeamMember($workspaceId: String!, $userId: String!) {
|
||||
approveMember(workspaceId: $workspaceId, userId: $userId)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
mutation grantWorkspaceTeamMember(
|
||||
$workspaceId: String!
|
||||
$userId: String!
|
||||
$permission: Permission!
|
||||
) {
|
||||
grantMember(
|
||||
workspaceId: $workspaceId
|
||||
userId: $userId
|
||||
permission: $permission
|
||||
)
|
||||
}
|
||||
@@ -438,9 +438,21 @@ export interface InvitationWorkspaceType {
|
||||
name: Scalars['String']['output'];
|
||||
}
|
||||
|
||||
export interface InviteResult {
|
||||
__typename?: 'InviteResult';
|
||||
email: Scalars['String']['output'];
|
||||
/** Invite id, null if invite record create failed */
|
||||
inviteId: Maybe<Scalars['String']['output']>;
|
||||
/** Invite email sent success */
|
||||
sentSuccess: Scalars['Boolean']['output'];
|
||||
}
|
||||
|
||||
export interface InviteUserType {
|
||||
__typename?: 'InviteUserType';
|
||||
/** User accepted */
|
||||
/**
|
||||
* User accepted
|
||||
* @deprecated Use `status` instead
|
||||
*/
|
||||
accepted: Scalars['Boolean']['output'];
|
||||
/** User avatar url */
|
||||
avatarUrl: Maybe<Scalars['String']['output']>;
|
||||
@@ -462,6 +474,8 @@ export interface InviteUserType {
|
||||
name: Maybe<Scalars['String']['output']>;
|
||||
/** User permission in workspace */
|
||||
permission: Permission;
|
||||
/** Member invite status in workspace */
|
||||
status: WorkspaceMemberStatus;
|
||||
}
|
||||
|
||||
export enum InvoiceStatus {
|
||||
@@ -519,6 +533,7 @@ export interface Mutation {
|
||||
__typename?: 'Mutation';
|
||||
acceptInviteById: Scalars['Boolean']['output'];
|
||||
addWorkspaceFeature: Scalars['Int']['output'];
|
||||
approveMember: Scalars['String']['output'];
|
||||
cancelSubscription: SubscriptionType;
|
||||
changeEmail: UserType;
|
||||
changePassword: Scalars['Boolean']['output'];
|
||||
@@ -547,7 +562,10 @@ export interface Mutation {
|
||||
deleteWorkspace: Scalars['Boolean']['output'];
|
||||
/** Create a chat session */
|
||||
forkCopilotSession: Scalars['String']['output'];
|
||||
grantMember: Scalars['String']['output'];
|
||||
invite: Scalars['String']['output'];
|
||||
inviteBatch: Array<InviteResult>;
|
||||
inviteLink: Scalars['String']['output'];
|
||||
leaveWorkspace: Scalars['Boolean']['output'];
|
||||
publishPage: WorkspacePage;
|
||||
recoverDoc: Scalars['DateTime']['output'];
|
||||
@@ -556,6 +574,7 @@ export interface Mutation {
|
||||
removeWorkspaceFeature: Scalars['Int']['output'];
|
||||
resumeSubscription: SubscriptionType;
|
||||
revoke: Scalars['Boolean']['output'];
|
||||
revokeInviteLink: Scalars['Boolean']['output'];
|
||||
/** @deprecated use revokePublicPage */
|
||||
revokePage: Scalars['Boolean']['output'];
|
||||
revokePublicPage: WorkspacePage;
|
||||
@@ -598,6 +617,11 @@ export interface MutationAddWorkspaceFeatureArgs {
|
||||
workspaceId: Scalars['String']['input'];
|
||||
}
|
||||
|
||||
export interface MutationApproveMemberArgs {
|
||||
userId: Scalars['String']['input'];
|
||||
workspaceId: Scalars['String']['input'];
|
||||
}
|
||||
|
||||
export interface MutationCancelSubscriptionArgs {
|
||||
idempotencyKey?: InputMaybe<Scalars['String']['input']>;
|
||||
plan?: InputMaybe<SubscriptionPlan>;
|
||||
@@ -665,6 +689,12 @@ export interface MutationForkCopilotSessionArgs {
|
||||
options: ForkChatSessionInput;
|
||||
}
|
||||
|
||||
export interface MutationGrantMemberArgs {
|
||||
permission: Permission;
|
||||
userId: Scalars['String']['input'];
|
||||
workspaceId: Scalars['String']['input'];
|
||||
}
|
||||
|
||||
export interface MutationInviteArgs {
|
||||
email: Scalars['String']['input'];
|
||||
permission: Permission;
|
||||
@@ -672,6 +702,17 @@ export interface MutationInviteArgs {
|
||||
workspaceId: Scalars['String']['input'];
|
||||
}
|
||||
|
||||
export interface MutationInviteBatchArgs {
|
||||
emails: Array<Scalars['String']['input']>;
|
||||
sendInviteMail?: InputMaybe<Scalars['Boolean']['input']>;
|
||||
workspaceId: Scalars['String']['input'];
|
||||
}
|
||||
|
||||
export interface MutationInviteLinkArgs {
|
||||
expireTime: WorkspaceInviteLinkExpireTime;
|
||||
workspaceId: Scalars['String']['input'];
|
||||
}
|
||||
|
||||
export interface MutationLeaveWorkspaceArgs {
|
||||
sendLeaveMail?: InputMaybe<Scalars['Boolean']['input']>;
|
||||
workspaceId: Scalars['String']['input'];
|
||||
@@ -706,6 +747,10 @@ export interface MutationRevokeArgs {
|
||||
workspaceId: Scalars['String']['input'];
|
||||
}
|
||||
|
||||
export interface MutationRevokeInviteLinkArgs {
|
||||
workspaceId: Scalars['String']['input'];
|
||||
}
|
||||
|
||||
export interface MutationRevokePageArgs {
|
||||
pageId: Scalars['String']['input'];
|
||||
workspaceId: Scalars['String']['input'];
|
||||
@@ -1144,6 +1189,8 @@ export interface UpdateUserInput {
|
||||
}
|
||||
|
||||
export interface UpdateWorkspaceInput {
|
||||
/** Enable AI */
|
||||
enableAi?: InputMaybe<Scalars['Boolean']['input']>;
|
||||
/** Enable url previous when sharing */
|
||||
enableUrlPreview?: InputMaybe<Scalars['Boolean']['input']>;
|
||||
id: Scalars['ID']['input'];
|
||||
@@ -1222,6 +1269,22 @@ export interface WorkspaceBlobSizes {
|
||||
size: Scalars['SafeInt']['output'];
|
||||
}
|
||||
|
||||
/** Workspace invite link expire time */
|
||||
export enum WorkspaceInviteLinkExpireTime {
|
||||
OneDay = 'OneDay',
|
||||
OneMonth = 'OneMonth',
|
||||
OneWeek = 'OneWeek',
|
||||
ThreeDays = 'ThreeDays',
|
||||
}
|
||||
|
||||
/** Member invite status in workspace */
|
||||
export enum WorkspaceMemberStatus {
|
||||
Accepted = 'Accepted',
|
||||
NeedMoreSeat = 'NeedMoreSeat',
|
||||
Pending = 'Pending',
|
||||
UnderReview = 'UnderReview',
|
||||
}
|
||||
|
||||
export interface WorkspacePage {
|
||||
__typename?: 'WorkspacePage';
|
||||
id: Scalars['String']['output'];
|
||||
@@ -1248,6 +1311,8 @@ export interface WorkspaceType {
|
||||
blobsSize: Scalars['Int']['output'];
|
||||
/** Workspace created date */
|
||||
createdAt: Scalars['DateTime']['output'];
|
||||
/** Enable AI */
|
||||
enableAi: Scalars['Boolean']['output'];
|
||||
/** Enable url previous when sharing */
|
||||
enableUrlPreview: Scalars['Boolean']['output'];
|
||||
/** Enabled features of workspace */
|
||||
@@ -1284,6 +1349,8 @@ export interface WorkspaceType {
|
||||
sharedPages: Array<Scalars['String']['output']>;
|
||||
/** The team subscription of the workspace, if exists. */
|
||||
subscription: Maybe<SubscriptionType>;
|
||||
/** if workspace is team workspace */
|
||||
team: Scalars['Boolean']['output'];
|
||||
}
|
||||
|
||||
export interface WorkspaceTypeHistoriesArgs {
|
||||
@@ -1706,6 +1773,7 @@ export type GetMembersByWorkspaceIdQuery = {
|
||||
inviteId: string;
|
||||
accepted: boolean;
|
||||
emailVerified: boolean | null;
|
||||
status: WorkspaceMemberStatus;
|
||||
}>;
|
||||
};
|
||||
};
|
||||
@@ -1939,6 +2007,7 @@ export type GetWorkspacesQuery = {
|
||||
__typename?: 'WorkspaceType';
|
||||
id: string;
|
||||
initialized: boolean;
|
||||
team: boolean;
|
||||
owner: { __typename?: 'UserType'; id: string };
|
||||
}>;
|
||||
};
|
||||
@@ -2361,13 +2430,27 @@ export type VerifyEmailMutation = {
|
||||
verifyEmail: boolean;
|
||||
};
|
||||
|
||||
export type GetEnableUrlPreviewQueryVariables = Exact<{
|
||||
export type GetWorkspaceConfigQueryVariables = Exact<{
|
||||
id: Scalars['String']['input'];
|
||||
}>;
|
||||
|
||||
export type GetEnableUrlPreviewQuery = {
|
||||
export type GetWorkspaceConfigQuery = {
|
||||
__typename?: 'Query';
|
||||
workspace: { __typename?: 'WorkspaceType'; enableUrlPreview: boolean };
|
||||
workspace: {
|
||||
__typename?: 'WorkspaceType';
|
||||
enableAi: boolean;
|
||||
enableUrlPreview: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
export type SetEnableAiMutationVariables = Exact<{
|
||||
id: Scalars['ID']['input'];
|
||||
enableAi: Scalars['Boolean']['input'];
|
||||
}>;
|
||||
|
||||
export type SetEnableAiMutation = {
|
||||
__typename?: 'Mutation';
|
||||
updateWorkspace: { __typename?: 'WorkspaceType'; id: string };
|
||||
};
|
||||
|
||||
export type SetEnableUrlPreviewMutationVariables = Exact<{
|
||||
@@ -2469,6 +2552,41 @@ export type AcceptInviteByInviteIdMutation = {
|
||||
acceptInviteById: boolean;
|
||||
};
|
||||
|
||||
export type InviteBatchMutationVariables = Exact<{
|
||||
workspaceId: Scalars['String']['input'];
|
||||
emails: Array<Scalars['String']['input']> | Scalars['String']['input'];
|
||||
sendInviteMail?: InputMaybe<Scalars['Boolean']['input']>;
|
||||
}>;
|
||||
|
||||
export type InviteBatchMutation = {
|
||||
__typename?: 'Mutation';
|
||||
inviteBatch: Array<{
|
||||
__typename?: 'InviteResult';
|
||||
email: string;
|
||||
inviteId: string | null;
|
||||
sentSuccess: boolean;
|
||||
}>;
|
||||
};
|
||||
|
||||
export type InviteLinkMutationVariables = Exact<{
|
||||
workspaceId: Scalars['String']['input'];
|
||||
expireTime: WorkspaceInviteLinkExpireTime;
|
||||
}>;
|
||||
|
||||
export type InviteLinkMutation = {
|
||||
__typename?: 'Mutation';
|
||||
inviteLink: string;
|
||||
};
|
||||
|
||||
export type RevokeInviteLinkMutationVariables = Exact<{
|
||||
workspaceId: Scalars['String']['input'];
|
||||
}>;
|
||||
|
||||
export type RevokeInviteLinkMutation = {
|
||||
__typename?: 'Mutation';
|
||||
revokeInviteLink: boolean;
|
||||
};
|
||||
|
||||
export type WorkspaceQuotaQueryVariables = Exact<{
|
||||
id: Scalars['String']['input'];
|
||||
}>;
|
||||
@@ -2498,6 +2616,27 @@ export type WorkspaceQuotaQuery = {
|
||||
};
|
||||
};
|
||||
|
||||
export type ApproveWorkspaceTeamMemberMutationVariables = Exact<{
|
||||
workspaceId: Scalars['String']['input'];
|
||||
userId: Scalars['String']['input'];
|
||||
}>;
|
||||
|
||||
export type ApproveWorkspaceTeamMemberMutation = {
|
||||
__typename?: 'Mutation';
|
||||
approveMember: string;
|
||||
};
|
||||
|
||||
export type GrantWorkspaceTeamMemberMutationVariables = Exact<{
|
||||
workspaceId: Scalars['String']['input'];
|
||||
userId: Scalars['String']['input'];
|
||||
permission: Permission;
|
||||
}>;
|
||||
|
||||
export type GrantWorkspaceTeamMemberMutation = {
|
||||
__typename?: 'Mutation';
|
||||
grantMember: string;
|
||||
};
|
||||
|
||||
export type Queries =
|
||||
| {
|
||||
name: 'adminServerConfigQuery';
|
||||
@@ -2675,9 +2814,9 @@ export type Queries =
|
||||
response: SubscriptionQuery;
|
||||
}
|
||||
| {
|
||||
name: 'getEnableUrlPreviewQuery';
|
||||
variables: GetEnableUrlPreviewQueryVariables;
|
||||
response: GetEnableUrlPreviewQuery;
|
||||
name: 'getWorkspaceConfigQuery';
|
||||
variables: GetWorkspaceConfigQueryVariables;
|
||||
response: GetWorkspaceConfigQuery;
|
||||
}
|
||||
| {
|
||||
name: 'enabledFeaturesQuery';
|
||||
@@ -2891,6 +3030,11 @@ export type Mutations =
|
||||
variables: VerifyEmailMutationVariables;
|
||||
response: VerifyEmailMutation;
|
||||
}
|
||||
| {
|
||||
name: 'setEnableAiMutation';
|
||||
variables: SetEnableAiMutationVariables;
|
||||
response: SetEnableAiMutation;
|
||||
}
|
||||
| {
|
||||
name: 'setEnableUrlPreviewMutation';
|
||||
variables: SetEnableUrlPreviewMutationVariables;
|
||||
@@ -2920,4 +3064,29 @@ export type Mutations =
|
||||
name: 'acceptInviteByInviteIdMutation';
|
||||
variables: AcceptInviteByInviteIdMutationVariables;
|
||||
response: AcceptInviteByInviteIdMutation;
|
||||
}
|
||||
| {
|
||||
name: 'inviteBatchMutation';
|
||||
variables: InviteBatchMutationVariables;
|
||||
response: InviteBatchMutation;
|
||||
}
|
||||
| {
|
||||
name: 'inviteLinkMutation';
|
||||
variables: InviteLinkMutationVariables;
|
||||
response: InviteLinkMutation;
|
||||
}
|
||||
| {
|
||||
name: 'revokeInviteLinkMutation';
|
||||
variables: RevokeInviteLinkMutationVariables;
|
||||
response: RevokeInviteLinkMutation;
|
||||
}
|
||||
| {
|
||||
name: 'approveWorkspaceTeamMemberMutation';
|
||||
variables: ApproveWorkspaceTeamMemberMutationVariables;
|
||||
response: ApproveWorkspaceTeamMemberMutation;
|
||||
}
|
||||
| {
|
||||
name: 'grantWorkspaceTeamMemberMutation';
|
||||
variables: GrantWorkspaceTeamMemberMutationVariables;
|
||||
response: GrantWorkspaceTeamMemberMutation;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user