diff --git a/src/decisions/decisions.controller.ts b/src/decisions/decisions.controller.ts new file mode 100644 index 0000000..a86e9f6 --- /dev/null +++ b/src/decisions/decisions.controller.ts @@ -0,0 +1,34 @@ +import { Body, Controller, Get, Param, ParseUUIDPipe, Patch, Post } from '@nestjs/common'; +import { CurrentSession } from '../auth/session.decorator'; +import type { AuthenticatedSession } from '../auth/tenant.guard'; +import { CreateDecisionDto, UpdateDecisionDto } from './dto'; +import { DecisionsService } from './decisions.service'; + +@Controller('decisions') +export class DecisionsController { + constructor(private readonly decisionsService: DecisionsService) {} + + @Get() + list(@CurrentSession() session: AuthenticatedSession) { + return this.decisionsService.list(session); + } + + @Get(':id') + getById(@CurrentSession() session: AuthenticatedSession, @Param('id', ParseUUIDPipe) id: string) { + return this.decisionsService.getById(session, id); + } + + @Post() + create(@CurrentSession() session: AuthenticatedSession, @Body() dto: CreateDecisionDto) { + return this.decisionsService.create(session, dto); + } + + @Patch(':id') + update( + @CurrentSession() session: AuthenticatedSession, + @Param('id', ParseUUIDPipe) id: string, + @Body() dto: UpdateDecisionDto, + ) { + return this.decisionsService.update(session, id, dto); + } +}