• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

safe-global / safe-client-gateway / 13057295372

30 Jan 2025 04:59PM UTC coverage: 90.89% (-0.05%) from 90.941%
13057295372

push

github

iamacook
fix: remove test values

2943 of 3555 branches covered (82.78%)

Branch coverage included in aggregate %.

9748 of 10408 relevant lines covered (93.66%)

504.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

73.68
/src/routes/users/users.controller.ts
1
import {
112✔
2
  ApiBadRequestResponse,
3
  ApiConflictResponse,
4
  ApiNotFoundResponse,
5
  ApiOkResponse,
6
  ApiTags,
7
} from '@nestjs/swagger';
8
import {
112✔
9
  Controller,
10
  Delete,
11
  Get,
12
  Param,
13
  Post,
14
  UseGuards,
15
} from '@nestjs/common';
16
import { AuthGuard } from '@/routes/auth/guards/auth.guard';
112✔
17
import { Auth } from '@/routes/auth/decorators/auth.decorator';
112✔
18
import { UsersService } from '@/routes/users/users.service';
112✔
19
import { ValidationPipe } from '@/validation/pipes/validation.pipe';
112✔
20
import { AddressSchema } from '@/validation/entities/schemas/address.schema';
112✔
21
import type { AuthPayload } from '@/domain/auth/entities/auth-payload.entity';
22
import { UserWithWallets } from '@/routes/users/entities/user-with-wallets.entity';
112✔
23
import { CreatedUserWithWallet } from '@/routes/users/entities/created-user-with-wallet.entity';
112✔
24

25
// TODO: Specify error responses for Swagger
26

27
@ApiTags('users')
28
@Controller({ path: 'users', version: '1' })
29
export class UsersController {
112✔
30
  public constructor(private readonly usersService: UsersService) {}
×
31

32
  @ApiOkResponse({ type: UserWithWallets })
33
  @ApiNotFoundResponse({ description: 'User not found' })
34
  @Get()
35
  @UseGuards(AuthGuard)
36
  public async getUseWithWallets(
112✔
37
    @Auth() authPayload: AuthPayload,
38
  ): Promise<UserWithWallets> {
39
    return await this.usersService.getUserWithWallets(authPayload);
×
40
  }
41

42
  @ApiConflictResponse({ description: 'Could not delete user' })
43
  @Delete()
44
  @UseGuards(AuthGuard)
45
  public async deleteUser(@Auth() authPayload: AuthPayload): Promise<void> {
112✔
46
    return await this.usersService.deleteUser(authPayload);
×
47
  }
48

49
  @ApiOkResponse({ type: CreatedUserWithWallet })
50
  @ApiConflictResponse({
51
    description: 'A wallet with the same address already exists',
52
  })
53
  @Post('/wallet')
54
  @UseGuards(AuthGuard)
55
  public async createUserWithWallet(
112✔
56
    @Auth() authPayload: AuthPayload,
57
  ): Promise<CreatedUserWithWallet> {
58
    return await this.usersService.createUserWithWallet(authPayload);
×
59
  }
60

61
  @ApiConflictResponse({
62
    description:
63
      'Cannot remove the current wallet OR User could not be remove from wallet',
64
  })
65
  @ApiNotFoundResponse({ description: 'User not found' })
66
  @ApiBadRequestResponse({
67
    description: 'Cannot delete the last wallet of a user',
68
  })
69
  @ApiOkResponse({ description: 'Wallet removed from user and deleted' })
70
  @Delete('/wallet/:walletAddress')
71
  @UseGuards(AuthGuard)
72
  public async deleteWalletFromUser(
112✔
73
    @Param('walletAddress', new ValidationPipe(AddressSchema))
74
    walletAddress: `0x${string}`,
75
    @Auth() authPayload: AuthPayload,
76
  ): Promise<void> {
77
    return await this.usersService.deleteWalletFromUser({
×
78
      authPayload,
79
      walletAddress,
80
    });
81
  }
82
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc