feat(server): improve team invite (#9092)
This commit is contained in:
@@ -2,11 +2,11 @@ import type { WorkspaceServerService } from '@affine/core/modules/cloud';
|
||||
import {
|
||||
acceptInviteByInviteIdMutation,
|
||||
approveWorkspaceTeamMemberMutation,
|
||||
createInviteLinkMutation,
|
||||
getWorkspaceInfoQuery,
|
||||
grantWorkspaceTeamMemberMutation,
|
||||
inviteByEmailMutation,
|
||||
inviteByEmailsMutation,
|
||||
inviteLinkMutation,
|
||||
leaveWorkspaceMutation,
|
||||
type Permission,
|
||||
revokeInviteLinkMutation,
|
||||
@@ -83,13 +83,13 @@ export class WorkspacePermissionStore extends Store {
|
||||
throw new Error('No Server');
|
||||
}
|
||||
const inviteLink = await this.workspaceServerService.server.gql({
|
||||
query: inviteLinkMutation,
|
||||
query: createInviteLinkMutation,
|
||||
variables: {
|
||||
workspaceId,
|
||||
expireTime,
|
||||
},
|
||||
});
|
||||
return inviteLink.inviteLink;
|
||||
return inviteLink.createInviteLink;
|
||||
}
|
||||
|
||||
async revokeInviteLink(workspaceId: string, signal?: AbortSignal) {
|
||||
|
||||
@@ -1249,6 +1249,10 @@ query getWorkspaceConfig($id: String!) {
|
||||
workspace(id: $id) {
|
||||
enableAi
|
||||
enableUrlPreview
|
||||
inviteLink {
|
||||
link
|
||||
expireTime
|
||||
}
|
||||
}
|
||||
}`,
|
||||
};
|
||||
@@ -1431,14 +1435,14 @@ mutation inviteBatch($workspaceId: String!, $emails: [String!]!, $sendInviteMail
|
||||
}`,
|
||||
};
|
||||
|
||||
export const inviteLinkMutation = {
|
||||
id: 'inviteLinkMutation' as const,
|
||||
operationName: 'inviteLink',
|
||||
definitionName: 'inviteLink',
|
||||
export const createInviteLinkMutation = {
|
||||
id: 'createInviteLinkMutation' as const,
|
||||
operationName: 'createInviteLink',
|
||||
definitionName: 'createInviteLink',
|
||||
containsFile: false,
|
||||
query: `
|
||||
mutation inviteLink($workspaceId: String!, $expireTime: WorkspaceInviteLinkExpireTime!) {
|
||||
inviteLink(workspaceId: $workspaceId, expireTime: $expireTime)
|
||||
mutation createInviteLink($workspaceId: String!, $expireTime: WorkspaceInviteLinkExpireTime!) {
|
||||
createInviteLink(workspaceId: $workspaceId, expireTime: $expireTime)
|
||||
}`,
|
||||
};
|
||||
|
||||
|
||||
@@ -2,5 +2,9 @@ query getWorkspaceConfig($id: String!) {
|
||||
workspace(id: $id) {
|
||||
enableAi
|
||||
enableUrlPreview
|
||||
inviteLink {
|
||||
link
|
||||
expireTime
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
mutation inviteLink(
|
||||
mutation createInviteLink(
|
||||
$workspaceId: String!
|
||||
$expireTime: WorkspaceInviteLinkExpireTime!
|
||||
) {
|
||||
inviteLink(workspaceId: $workspaceId, expireTime: $expireTime)
|
||||
createInviteLink(workspaceId: $workspaceId, expireTime: $expireTime)
|
||||
}
|
||||
|
||||
@@ -438,6 +438,14 @@ export interface InvitationWorkspaceType {
|
||||
name: Scalars['String']['output'];
|
||||
}
|
||||
|
||||
export interface InviteLink {
|
||||
__typename?: 'InviteLink';
|
||||
/** Invite link expire time */
|
||||
expireTime: Scalars['DateTime']['output'];
|
||||
/** Invite link */
|
||||
link: Scalars['String']['output'];
|
||||
}
|
||||
|
||||
export interface InviteResult {
|
||||
__typename?: 'InviteResult';
|
||||
email: Scalars['String']['output'];
|
||||
@@ -559,6 +567,7 @@ export interface Mutation {
|
||||
createCopilotSession: Scalars['String']['output'];
|
||||
/** Create a stripe customer portal to manage payment methods */
|
||||
createCustomerPortal: Scalars['String']['output'];
|
||||
createInviteLink: Scalars['String']['output'];
|
||||
/** Create a new user */
|
||||
createUser: UserType;
|
||||
/** Create a new workspace */
|
||||
@@ -573,7 +582,6 @@ export interface Mutation {
|
||||
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'];
|
||||
@@ -673,6 +681,11 @@ export interface MutationCreateCopilotSessionArgs {
|
||||
options: CreateChatSessionInput;
|
||||
}
|
||||
|
||||
export interface MutationCreateInviteLinkArgs {
|
||||
expireTime: WorkspaceInviteLinkExpireTime;
|
||||
workspaceId: Scalars['String']['input'];
|
||||
}
|
||||
|
||||
export interface MutationCreateUserArgs {
|
||||
input: CreateUserInput;
|
||||
}
|
||||
@@ -719,11 +732,6 @@ export interface MutationInviteBatchArgs {
|
||||
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'];
|
||||
@@ -1342,6 +1350,8 @@ export interface WorkspaceType {
|
||||
id: Scalars['ID']['output'];
|
||||
/** is current workspace initialized */
|
||||
initialized: Scalars['Boolean']['output'];
|
||||
/** invite link for workspace */
|
||||
inviteLink: Maybe<InviteLink>;
|
||||
/** Get user invoice count */
|
||||
invoiceCount: Scalars['Int']['output'];
|
||||
invoices: Array<InvoiceType>;
|
||||
@@ -2526,6 +2536,11 @@ export type GetWorkspaceConfigQuery = {
|
||||
__typename?: 'WorkspaceType';
|
||||
enableAi: boolean;
|
||||
enableUrlPreview: boolean;
|
||||
inviteLink: {
|
||||
__typename?: 'InviteLink';
|
||||
link: string;
|
||||
expireTime: string;
|
||||
} | null;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2670,14 +2685,14 @@ export type InviteBatchMutation = {
|
||||
}>;
|
||||
};
|
||||
|
||||
export type InviteLinkMutationVariables = Exact<{
|
||||
export type CreateInviteLinkMutationVariables = Exact<{
|
||||
workspaceId: Scalars['String']['input'];
|
||||
expireTime: WorkspaceInviteLinkExpireTime;
|
||||
}>;
|
||||
|
||||
export type InviteLinkMutation = {
|
||||
export type CreateInviteLinkMutation = {
|
||||
__typename?: 'Mutation';
|
||||
inviteLink: string;
|
||||
createInviteLink: string;
|
||||
};
|
||||
|
||||
export type RevokeInviteLinkMutationVariables = Exact<{
|
||||
@@ -3228,9 +3243,9 @@ export type Mutations =
|
||||
response: InviteBatchMutation;
|
||||
}
|
||||
| {
|
||||
name: 'inviteLinkMutation';
|
||||
variables: InviteLinkMutationVariables;
|
||||
response: InviteLinkMutation;
|
||||
name: 'createInviteLinkMutation';
|
||||
variables: CreateInviteLinkMutationVariables;
|
||||
response: CreateInviteLinkMutation;
|
||||
}
|
||||
| {
|
||||
name: 'revokeInviteLinkMutation';
|
||||
|
||||
Reference in New Issue
Block a user