-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an InviteTeam onboarding step #5623
Comments
Disclaimer: This comment was automatically generated with AI. It can give some useful hints as to where to look for, but sometimes it can also give very inaccurate answers so takes this with a pinch of salt :). To add an InviteTeam onboarding step:
// Path: /packages/twenty-server/src/core/auth/dto/sign-up.input.ts
import { Field, InputType } from '@nestjs/graphql';
import { IsEmail, IsNotEmpty, IsOptional, IsString } from 'class-validator';
@InputType()
export class InviteTeamInput {
@Field()
@IsEmail()
@IsNotEmpty()
email: string;
@Field()
@IsString()
@IsNotEmpty()
teamName: string;
@Field({ nullable: true })
@IsOptional()
@IsString()
workspaceInviteHash?: string;
}
// Path: /packages/twenty-server/src/core/auth/resolvers/auth.resolver.ts
import { Args, Mutation, Resolver } from '@nestjs/graphql';
import { InviteTeamInput } from '../dto/invite-team.input';
import { AuthService } from '../services/auth.service';
@Resolver()
export class AuthResolver {
constructor(private readonly authService: AuthService) {}
@Mutation(() => Boolean)
async inviteTeam(@Args('inviteTeamInput') inviteTeamInput: InviteTeamInput): Promise<boolean> {
return this.authService.inviteTeam(inviteTeamInput);
}
}
// Path: /packages/twenty-server/src/core/auth/services/auth.service.ts
import { Injectable } from '@nestjs/common';
import { InviteTeamInput } from '../dto/invite-team.input';
@Injectable()
export class AuthService {
async inviteTeam(inviteTeamInput: InviteTeamInput): Promise<boolean> {
// Logic to invite team
return true;
}
}
// Path: /packages/twenty-front/src/pages/auth/Invite.tsx
import { useInviteTeamMutation } from '~/generated/graphql';
const Invite = () => {
const [inviteTeam] = useInviteTeamMutation();
const handleInviteTeam = async () => {
await inviteTeam({ variables: { inviteTeamInput: { email: 'team@example.com', teamName: 'TeamName' } } });
};
return (
<>
{/* Existing code */}
<MainButton
variant="secondary"
title="Invite Team"
type="button"
onClick={handleInviteTeam}
fullWidth
/>
</>
);
};
// Path: /packages/twenty-front/src/modules/workspace-member/graphql/mutations/inviteTeam.ts
import { gql } from '@apollo/client';
export const INVITE_TEAM = gql`
mutation InviteTeam($inviteTeamInput: InviteTeamInput!) {
inviteTeam(inviteTeamInput: $inviteTeamInput)
}
`;
// Path: /packages/twenty-front/codegen.yml
schema: "http://localhost:4000/graphql"
documents: "src/**/*.graphql"
generates:
src/generated/graphql.tsx:
plugins:
- "typescript"
- "typescript-operations"
- "typescript-react-apollo" Run References/packages/twenty-front/src/pages/auth/Invite.tsx |
The text was updated successfully, but these errors were encountered: