feat(decisions): add decisions.controller
This commit is contained in:
parent
b60c255080
commit
e1fc7eb0b7
1 changed files with 34 additions and 0 deletions
34
src/decisions/decisions.controller.ts
Normal file
34
src/decisions/decisions.controller.ts
Normal file
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue