Update codebase
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { Controller, Post, Body, Headers, UnauthorizedException } from '@nestjs/common';
|
||||
import { AuthService } from './auth.service';
|
||||
|
||||
@Controller('auth')
|
||||
export class AuthController {
|
||||
constructor(private readonly authService: AuthService) {}
|
||||
|
||||
@Post('send-otp')
|
||||
async sendOtp(
|
||||
@Headers('x-tenant-id') tenantId: string,
|
||||
@Body('phone') phone: string,
|
||||
) {
|
||||
if (!tenantId) throw new UnauthorizedException('Tenant ID (x-tenant-id) is required');
|
||||
return this.authService.sendOtp(tenantId, phone);
|
||||
}
|
||||
|
||||
@Post('verify-otp')
|
||||
async verifyOtp(
|
||||
@Headers('x-tenant-id') tenantId: string,
|
||||
@Body('phone') phone: string,
|
||||
@Body('code') code: string,
|
||||
) {
|
||||
if (!tenantId) throw new UnauthorizedException('Tenant ID (x-tenant-id) is required');
|
||||
return this.authService.verifyOtp(tenantId, phone, code);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user