forked from MergeFi/backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusers.controller.ts
More file actions
36 lines (31 loc) · 911 Bytes
/
Copy pathusers.controller.ts
File metadata and controls
36 lines (31 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { Body, Controller, Get, Param, Patch, UseGuards } from '@nestjs/common';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { IsString } from 'class-validator';
import { UsersService } from './users.service';
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
class SetStellarAddressDto {
@IsString()
stellarAddress: string;
}
@ApiTags('users')
@Controller('users')
export class UsersController {
constructor(private readonly usersService: UsersService) {}
@Get()
list() {
return this.usersService.list();
}
@Get(':id')
findOne(@Param('id') id: string) {
return this.usersService.findById(id);
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Patch(':id/stellar-address')
setStellarAddress(
@Param('id') id: string,
@Body() dto: SetStellarAddressDto,
) {
return this.usersService.setStellarAddress(id, dto.stellarAddress);
}
}