auth-service/src/modules/auth/auth.controller.ts

33 lines
881 B
TypeScript

import { Controller } from '@nestjs/common'
import { GrpcMethod } from '@nestjs/microservices'
import type {
RefreshRequest,
RefreshResponse,
SendOtpRequest,
SendOtpResponse,
VerifyOtpRequest,
VerifyOtpResponse
} from '@teacinema/contracts/gen/ts/auth'
import { AuthService } from './auth.service'
@Controller()
export class AuthController {
constructor(private readonly authService: AuthService) {}
@GrpcMethod('AuthService', 'SendOtp')
public sendOtp(data: SendOtpRequest): Promise<SendOtpResponse> {
return this.authService.sendOtp(data)
}
@GrpcMethod('AuthService', 'VerifyOtp')
public VerifyOtp(data: VerifyOtpRequest): Promise<VerifyOtpResponse> {
return this.authService.verifyOtp(data)
}
@GrpcMethod('AuthService', 'Refresh')
public refresh(data: RefreshRequest): RefreshResponse {
return this.authService.refresh(data)
}
}