pos-be/src/modules/configuration/auth/infrastructure/auth.controller.ts

25 lines
667 B
TypeScript

import { Body, Controller, Delete, Post } from '@nestjs/common';
import { ExcludePrivilege, Public } from 'src/core/guards';
import { AuthOrchestrator } from '../domain/auth.orchestrator';
import { ApiBearerAuth } from '@nestjs/swagger';
import { LoginDto } from './dto/login.dto';
@Controller('v1/auth')
export class AuthController {
constructor(private orchestrator: AuthOrchestrator) {}
@Post()
@Public(true)
async login(@Body() body: LoginDto) {
return await this.orchestrator.login(body);
}
@ApiBearerAuth('JWT')
@Public(false)
@ExcludePrivilege()
@Delete('logout')
async logoout() {
return await this.orchestrator.logout();
}
}