@koalarx/nest-cli
Version:
Biblioteca de CLI para criação de projetos utilizando Koala Nest
23 lines (19 loc) • 868 B
text/typescript
import { DeletePersonHandler } from '@/application/person/delete/delete-person.handler'
import { IController } from '@koalarx/nest/core/controllers/base.controller'
import { Controller } from '@koalarx/nest/core/controllers/controller.decorator'
import { Delete, HttpCode, HttpStatus, Param } from '@nestjs/common'
import { ApiNoContentResponse } from '@nestjs/swagger'
import { PERSON_ROUTER_CONFIG } from './router.config'
(PERSON_ROUTER_CONFIG)
export class DeletePersonController implements IController<null, void, string> {
constructor(private readonly handler: DeletePersonHandler) {}
(':id')
()
(HttpStatus.NO_CONTENT)
async handle(_, ('id') id: string): Promise<void> {
const response = await this.handler.handle(+id)
if (response.isFailure()) {
throw response.value
}
}
}