From 2a667a74f0b36a75ba6b8cce78798ac4d9ae9581 Mon Sep 17 00:00:00 2001 From: mirarifhasan Date: Mon, 29 Jan 2024 18:37:48 +0600 Subject: [PATCH] feat: removed deprecated resolvefields --- .../src/admin/admin.resolver.ts | 188 ------------------ 1 file changed, 188 deletions(-) diff --git a/packages/hoppscotch-backend/src/admin/admin.resolver.ts b/packages/hoppscotch-backend/src/admin/admin.resolver.ts index 84a63ebd2..5f1308898 100644 --- a/packages/hoppscotch-backend/src/admin/admin.resolver.ts +++ b/packages/hoppscotch-backend/src/admin/admin.resolver.ts @@ -49,194 +49,6 @@ export class AdminResolver { return admin; } - @ResolveField(() => [User], { - description: 'Returns a list of all admin users in infra', - deprecationReason: 'Use `infra` query instead', - }) - @UseGuards(GqlAuthGuard, GqlAdminGuard) - async admins() { - const admins = await this.adminService.fetchAdmins(); - return admins; - } - @ResolveField(() => User, { - description: 'Returns a user info by UID', - deprecationReason: 'Use `infra` query instead', - }) - @UseGuards(GqlAuthGuard, GqlAdminGuard) - async userInfo( - @Args({ - name: 'userUid', - type: () => ID, - description: 'The user UID', - }) - userUid: string, - ): Promise { - const user = await this.adminService.fetchUserInfo(userUid); - if (E.isLeft(user)) throwErr(user.left); - return user.right; - } - - @ResolveField(() => [User], { - description: 'Returns a list of all the users in infra', - deprecationReason: 'Use `infra` query instead', - }) - @UseGuards(GqlAuthGuard, GqlAdminGuard) - async allUsers( - @Parent() admin: Admin, - @Args() args: PaginationArgs, - ): Promise { - const users = await this.adminService.fetchUsers(args.cursor, args.take); - return users; - } - - @ResolveField(() => [Team], { - description: 'Returns a list of all the teams in the infra', - deprecationReason: 'Use `infra` query instead', - }) - async allTeams( - @Parent() admin: Admin, - @Args() args: PaginationArgs, - ): Promise { - const teams = await this.adminService.fetchAllTeams(args.cursor, args.take); - return teams; - } - @ResolveField(() => Team, { - description: 'Returns a team info by ID when requested by Admin', - deprecationReason: 'Use `infra` query instead', - }) - async teamInfo( - @Parent() admin: Admin, - @Args({ - name: 'teamID', - type: () => ID, - description: 'Team ID for which info to fetch', - }) - teamID: string, - ): Promise { - const team = await this.adminService.getTeamInfo(teamID); - if (E.isLeft(team)) throwErr(team.left); - return team.right; - } - - @ResolveField(() => Number, { - description: 'Return count of all the members in a team', - deprecationReason: 'Use `infra` query instead', - }) - async membersCountInTeam( - @Parent() admin: Admin, - @Args({ - name: 'teamID', - type: () => ID, - description: 'Team ID for which team members to fetch', - nullable: false, - }) - teamID: string, - ): Promise { - const teamMembersCount = await this.adminService.membersCountInTeam(teamID); - return teamMembersCount; - } - - @ResolveField(() => Number, { - description: 'Return count of all the stored collections in a team', - deprecationReason: 'Use `infra` query instead', - }) - async collectionCountInTeam( - @Parent() admin: Admin, - @Args({ - name: 'teamID', - type: () => ID, - description: 'Team ID for which team members to fetch', - }) - teamID: string, - ): Promise { - const teamCollCount = await this.adminService.collectionCountInTeam(teamID); - return teamCollCount; - } - @ResolveField(() => Number, { - description: 'Return count of all the stored requests in a team', - deprecationReason: 'Use `infra` query instead', - }) - async requestCountInTeam( - @Parent() admin: Admin, - @Args({ - name: 'teamID', - type: () => ID, - description: 'Team ID for which team members to fetch', - }) - teamID: string, - ): Promise { - const teamReqCount = await this.adminService.requestCountInTeam(teamID); - return teamReqCount; - } - - @ResolveField(() => Number, { - description: 'Return count of all the stored environments in a team', - deprecationReason: 'Use `infra` query instead', - }) - async environmentCountInTeam( - @Parent() admin: Admin, - @Args({ - name: 'teamID', - type: () => ID, - description: 'Team ID for which team members to fetch', - }) - teamID: string, - ): Promise { - const envsCount = await this.adminService.environmentCountInTeam(teamID); - return envsCount; - } - - @ResolveField(() => [TeamInvitation], { - description: 'Return all the pending invitations in a team', - deprecationReason: 'Use `infra` query instead', - }) - async pendingInvitationCountInTeam( - @Parent() admin: Admin, - @Args({ - name: 'teamID', - type: () => ID, - description: 'Team ID for which team members to fetch', - }) - teamID: string, - ) { - const invitations = await this.adminService.pendingInvitationCountInTeam( - teamID, - ); - return invitations; - } - - @ResolveField(() => Number, { - description: 'Return total number of Users in organization', - deprecationReason: 'Use `infra` query instead', - }) - async usersCount() { - return this.adminService.getUsersCount(); - } - - @ResolveField(() => Number, { - description: 'Return total number of Teams in organization', - deprecationReason: 'Use `infra` query instead', - }) - async teamsCount() { - return this.adminService.getTeamsCount(); - } - - @ResolveField(() => Number, { - description: 'Return total number of Team Collections in organization', - deprecationReason: 'Use `infra` query instead', - }) - async teamCollectionsCount() { - return this.adminService.getTeamCollectionsCount(); - } - - @ResolveField(() => Number, { - description: 'Return total number of Team Requests in organization', - deprecationReason: 'Use `infra` query instead', - }) - async teamRequestsCount() { - return this.adminService.getTeamRequestsCount(); - } - /* Mutations */ @Mutation(() => InvitedUser, {