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); } }