diff --git a/packages/hoppscotch-backend/src/team/guards/gql-team-member.guard.ts b/packages/hoppscotch-backend/src/team/guards/gql-team-member.guard.ts index afbff4b6c..d4a34ae56 100644 --- a/packages/hoppscotch-backend/src/team/guards/gql-team-member.guard.ts +++ b/packages/hoppscotch-backend/src/team/guards/gql-team-member.guard.ts @@ -27,8 +27,9 @@ export class GqlTeamMemberGuard implements CanActivate { if (!requireRoles) throw new Error(BUG_TEAM_NO_REQUIRE_TEAM_ROLE); const gqlExecCtx = GqlExecutionContext.create(context); + const { req, headers } = gqlExecCtx.getContext(); + const user = headers ? headers.user : req.user; - const { user } = gqlExecCtx.getContext().req; if (user == undefined) throw new Error(BUG_AUTH_NO_USER_CTX); const { teamID } = gqlExecCtx.getArgs<{ teamID: string }>(); diff --git a/packages/hoppscotch-backend/src/team/team.resolver.ts b/packages/hoppscotch-backend/src/team/team.resolver.ts index 8fad4b339..f9ffe2f9e 100644 --- a/packages/hoppscotch-backend/src/team/team.resolver.ts +++ b/packages/hoppscotch-backend/src/team/team.resolver.ts @@ -226,41 +226,6 @@ export class TeamResolver { return isDeleted.right; } - @Mutation(() => TeamMember, { - description: 'Adds a team member to the team via email', - deprecationReason: - 'This is only present for backwards compatibility and will be removed soon use team invitations instead', - }) - @RequiresTeamRole(TeamMemberRole.OWNER) - @UseGuards(GqlAuthGuard, GqlTeamMemberGuard) - async addTeamMemberByEmail( - @Args({ - name: 'teamID', - description: 'ID of the team to add to', - type: () => ID, - }) - teamID: string, - @Args({ - name: 'userEmail', - description: 'Email of the user to add to team', - }) - userEmail: string, - @Args({ - name: 'userRole', - description: 'The role of the user to add in the team', - type: () => TeamMemberRole, - }) - role: TeamMemberRole, - ): Promise { - const teamMember = await this.teamService.addMemberToTeamWithEmail( - teamID, - userEmail, - role, - ); - if (E.isLeft(teamMember)) throwErr(teamMember.left); - return teamMember.right; - } - @Mutation(() => TeamMember, { description: 'Update role of a team member the executing user owns', })