first commit

This commit is contained in:
lendry
2026-06-24 14:37:15 +03:00
commit 995adeedd4
188 changed files with 28810 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
import { Body, Controller, Post } from '@nestjs/common';
import { ApiBody, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { CoreGrpcService } from '../core-grpc.service';
import { SendOtpDto, VerifyOtpDto } from '../dto/identity.dto';
@ApiTags('OTP и 2FA')
@Controller('auth/otp')
export class OtpController {
constructor(private readonly core: CoreGrpcService) {}
@Post('send')
@ApiOperation({ summary: 'Отправить OTP код', description: 'Создает одноразовый код в AuthCode. Fallback-доставка пишет код в console.log.' })
@ApiBody({ type: SendOtpDto })
@ApiResponse({ status: 201, description: 'Код создан и отправлен' })
send(@Body() dto: SendOtpDto) {
return this.core.otp.SendOtp(dto);
}
@Post('verify')
@ApiOperation({ summary: 'Проверить OTP код', description: 'Проверяет одноразовый код, срок жизни и помечает его использованным.' })
@ApiBody({ type: VerifyOtpDto })
@ApiResponse({ status: 201, description: 'Код подтвержден' })
verify(@Body() dto: VerifyOtpDto) {
return this.core.otp.VerifyOtp(dto);
}
}