fix(user/ai-service): fix GET /users/kyc route conflict + add passport-jwt to ai-service
This commit is contained in:
parent
8fdc4e9365
commit
e9e875ac07
|
|
@ -17,6 +17,9 @@
|
||||||
"@nestjs/config": "^3.1.0",
|
"@nestjs/config": "^3.1.0",
|
||||||
"@nestjs/passport": "^10.0.3",
|
"@nestjs/passport": "^10.0.3",
|
||||||
"@nestjs/jwt": "^10.2.0",
|
"@nestjs/jwt": "^10.2.0",
|
||||||
|
"passport": "^0.7.0",
|
||||||
|
"passport-jwt": "^4.0.1",
|
||||||
|
"@types/passport-jwt": "^4.0.1",
|
||||||
"@nestjs/swagger": "^7.2.0",
|
"@nestjs/swagger": "^7.2.0",
|
||||||
"@nestjs/throttler": "^5.1.0",
|
"@nestjs/throttler": "^5.1.0",
|
||||||
"typeorm": "^0.3.19",
|
"typeorm": "^0.3.19",
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,17 @@ import { Controller, Get, Put, Body, Param, Query, UseGuards, Req } from '@nestj
|
||||||
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
|
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
|
||||||
import { AuthGuard } from '@nestjs/passport';
|
import { AuthGuard } from '@nestjs/passport';
|
||||||
import { UserProfileService } from '../../../application/services/user-profile.service';
|
import { UserProfileService } from '../../../application/services/user-profile.service';
|
||||||
|
import { KycService } from '../../../application/services/kyc.service';
|
||||||
import { UpdateProfileDto } from '../dto/update-profile.dto';
|
import { UpdateProfileDto } from '../dto/update-profile.dto';
|
||||||
import { UpdateSettingsDto } from '../dto/update-settings.dto';
|
import { UpdateSettingsDto } from '../dto/update-settings.dto';
|
||||||
|
|
||||||
@ApiTags('Users')
|
@ApiTags('Users')
|
||||||
@Controller('users')
|
@Controller('users')
|
||||||
export class UserController {
|
export class UserController {
|
||||||
constructor(private readonly profileService: UserProfileService) {}
|
constructor(
|
||||||
|
private readonly profileService: UserProfileService,
|
||||||
|
private readonly kycService: KycService,
|
||||||
|
) {}
|
||||||
|
|
||||||
@Get('me')
|
@Get('me')
|
||||||
@UseGuards(AuthGuard('jwt'))
|
@UseGuards(AuthGuard('jwt'))
|
||||||
|
|
@ -46,6 +50,15 @@ export class UserController {
|
||||||
return { code: 0, data: settings };
|
return { code: 0, data: settings };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get('kyc')
|
||||||
|
@UseGuards(AuthGuard('jwt'))
|
||||||
|
@ApiBearerAuth()
|
||||||
|
@ApiOperation({ summary: 'Get KYC status (alias to avoid :id route conflict)' })
|
||||||
|
async getKycStatus(@Req() req: any) {
|
||||||
|
const result = await this.kycService.getKycStatus(req.user.id);
|
||||||
|
return { code: 0, data: result };
|
||||||
|
}
|
||||||
|
|
||||||
@Get('payment-methods')
|
@Get('payment-methods')
|
||||||
@UseGuards(AuthGuard('jwt'))
|
@UseGuards(AuthGuard('jwt'))
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue