1- import {
2- Controller ,
3- Get ,
4- UseGuards ,
5- Post ,
6- Body ,
7- Param ,
8- ParseUUIDPipe ,
9- Delete ,
10- Query ,
11- } from '@nestjs/common' ;
1+ import { Controller , Get , UseGuards , Post , Body , Param , ParseUUIDPipe , Delete , Query } from '@nestjs/common' ;
122import { BuildsService } from './builds.service' ;
133import { JwtAuthGuard } from '../auth/guards/auth.guard' ;
14- import { ApiBearerAuth , ApiTags , ApiParam , ApiSecurity , ApiQuery } from '@nestjs/swagger' ;
4+ import { ApiBearerAuth , ApiTags , ApiParam , ApiSecurity , ApiQuery , ApiResponse } from '@nestjs/swagger' ;
155import { CreateBuildDto } from './dto/build-create.dto' ;
166import { ApiGuard } from '../auth/guards/api.guard' ;
177import { Build } from '@prisma/client' ;
8+ import { BuildDto } from './dto/build.dto' ;
189
1910@Controller ( 'builds' )
2011@ApiTags ( 'builds' )
2112export class BuildsController {
22- constructor ( private buildsService : BuildsService ) { }
13+ constructor ( private buildsService : BuildsService ) { }
2314
2415 @Get ( )
2516 @ApiQuery ( { name : 'projectId' , required : true } )
17+ @ApiResponse ( { type : [ BuildDto ] } )
2618 @ApiBearerAuth ( )
2719 @UseGuards ( JwtAuthGuard )
28- get ( @Query ( 'projectId' , new ParseUUIDPipe ( ) ) projectId : string ) : Promise < Build [ ] > {
20+ get ( @Query ( 'projectId' , new ParseUUIDPipe ( ) ) projectId : string ) : Promise < BuildDto [ ] > {
2921 return this . buildsService . findMany ( projectId ) ;
3022 }
3123
@@ -38,9 +30,10 @@ export class BuildsController {
3830 }
3931
4032 @Post ( )
33+ @ApiResponse ( { type : BuildDto } )
4134 @ApiSecurity ( 'api_key' )
4235 @UseGuards ( ApiGuard )
43- create ( @Body ( ) createBuildDto : CreateBuildDto ) : Promise < Build > {
36+ create ( @Body ( ) createBuildDto : CreateBuildDto ) : Promise < BuildDto > {
4437 return this . buildsService . create ( createBuildDto ) ;
4538 }
4639}
0 commit comments