feat(opportunities): add opportunities.controller
This commit is contained in:
parent
80fd3e0b4e
commit
5caa233bea
1 changed files with 34 additions and 0 deletions
34
src/opportunities/opportunities.controller.ts
Normal file
34
src/opportunities/opportunities.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 { CreateOpportunityDto, UpdateOpportunityDto } from './dto';
|
||||
import { OpportunitiesService } from './opportunities.service';
|
||||
|
||||
@Controller('opportunities')
|
||||
export class OpportunitiesController {
|
||||
constructor(private readonly opportunitiesService: OpportunitiesService) {}
|
||||
|
||||
@Get()
|
||||
list(@CurrentSession() session: AuthenticatedSession) {
|
||||
return this.opportunitiesService.list(session);
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
getById(@CurrentSession() session: AuthenticatedSession, @Param('id', ParseUUIDPipe) id: string) {
|
||||
return this.opportunitiesService.getById(session, id);
|
||||
}
|
||||
|
||||
@Post()
|
||||
create(@CurrentSession() session: AuthenticatedSession, @Body() dto: CreateOpportunityDto) {
|
||||
return this.opportunitiesService.create(session, dto);
|
||||
}
|
||||
|
||||
@Patch(':id')
|
||||
update(
|
||||
@CurrentSession() session: AuthenticatedSession,
|
||||
@Param('id', ParseUUIDPipe) id: string,
|
||||
@Body() dto: UpdateOpportunityDto,
|
||||
) {
|
||||
return this.opportunitiesService.update(session, id, dto);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue