Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { Controller, Post, Body, UseGuards, Req, Param, ParseIntPipe, Get } from '@nestjs/common';
import { ProjectsService } from '@app/modules/projects/projects.service';
import { CreateProjectDto } from '@app/modules/projects/dto/create-project.dto';
import { JwtAuthGuard } from '@app/common/guards/jwt-auth.guard';
import { RolesGuard } from '@app/common/guards/roles.guard';
import { Roles } from '@app/common/decorators/roles.decorator';
import { AddUnitsDto } from '@app/modules/projects/dto/add-units.dto';
import { User } from '@prisma/client';
@Controller('projects')
export class ProjectsController {
constructor(private readonly projectsService: ProjectsService) {}
@Post()
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles('DEVELOPER')
create(@Body() dto: CreateProjectDto, @Req() req: { user: User }) {
return this.projectsService.createProject(dto, req.user.id);
}
@Post(':id/units')
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles('DEVELOPER')
addUnits(
@Param('id', ParseIntPipe) id: number,
@Body() dto: AddUnitsDto,
@Req() req: { user: User },
) {
return this.projectsService.addUnits(id, dto, req.user.id);
}
@Get(':id')
getPublic(@Param('id', ParseIntPipe) id: number) {
return this.projectsService.getPublic(id);
}
} |