Initial commit after migration to gitea

This commit is contained in:
2026-01-18 11:27:43 +03:30
parent a21039410c
commit ea4b8eb543
196 changed files with 45567 additions and 9 deletions

View File

@@ -0,0 +1,45 @@
import {
Body,
Controller,
HttpException,
HttpStatus,
Post,
Req,
UseGuards,
} from "@nestjs/common";
import { ApiAcceptedResponse, ApiBody, ApiTags } from "@nestjs/swagger";
import { UserAuthService } from "src/auth/auth-services/user.auth.service";
import { UserLoginDto } from "src/auth/dto/user/login.dto";
import { UserVerifyOtp } from "src/auth/dto/user/verify.dto";
import { LocalUserAuthGuard } from "src/auth/guards/user-local.guard";
import { CurrentUser } from "src/decorators/user.decorator";
@Controller("user")
@ApiTags("user")
export class UserAuthController {
constructor(private readonly userAuthService: UserAuthService) {}
@Post("/send-otp")
@ApiBody({
type: UserLoginDto,
description: "user login api -- call this api and send otp",
})
@ApiAcceptedResponse()
async sendOtpRq(@Body() body: UserLoginDto) {
const res = await this.userAuthService.sendOtpRequest(body.mobile);
if (res) {
throw new HttpException(res, HttpStatus.ACCEPTED);
}
}
@Post("/login")
@UseGuards(LocalUserAuthGuard)
@ApiBody({
type: UserVerifyOtp,
description: "user verify otp -- call this api and get a tokens",
})
@ApiAcceptedResponse()
async login(@Body() body, @Req() req, @CurrentUser() user) {
return await this.userAuthService.login(req.user);
}
}