Skip to content

Commit a9bb510

Browse files
committed
1 parent ab6ba56 commit a9bb510

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

src/builds/builds.controller.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Controller, Get, UseGuards, Post, Body, Param, ParseUUIDPipe, Delete, Query, Patch } from '@nestjs/common';
22
import { BuildsService } from './builds.service';
33
import { JwtAuthGuard } from '../auth/guards/auth.guard';
4-
import { ApiBearerAuth, ApiTags, ApiSecurity, ApiResponse } from '@nestjs/swagger';
4+
import { ApiBearerAuth, ApiTags, ApiSecurity, ApiOkResponse } from '@nestjs/swagger';
55
import { CreateBuildDto } from './dto/build-create.dto';
66
import { ApiGuard } from '../auth/guards/api.guard';
77
import { Build } from '@prisma/client';
@@ -14,7 +14,7 @@ export class BuildsController {
1414
constructor(private buildsService: BuildsService) {}
1515

1616
@Get()
17-
@ApiResponse({ type: [BuildDto] })
17+
@ApiOkResponse({ type: [BuildDto] })
1818
@ApiBearerAuth()
1919
@UseGuards(JwtAuthGuard)
2020
get(@Query('projectId', new ParseUUIDPipe()) projectId: string): Promise<BuildDto[]> {
@@ -29,15 +29,15 @@ export class BuildsController {
2929
}
3030

3131
@Post()
32-
@ApiResponse({ type: BuildDto })
32+
@ApiOkResponse({ type: BuildDto })
3333
@ApiSecurity('api_key')
3434
@UseGuards(ApiGuard)
3535
create(@Body() createBuildDto: CreateBuildDto): Promise<BuildDto> {
3636
return this.buildsService.create(createBuildDto);
3737
}
3838

3939
@Patch(':id')
40-
@ApiResponse({ type: BuildDto })
40+
@ApiOkResponse({ type: BuildDto })
4141
@ApiSecurity('api_key')
4242
@ApiBearerAuth()
4343
@UseGuards(MixedGuard)

src/builds/dto/build-create.dto.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { ApiProperty } from '@nestjs/swagger';
1+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
22
import { IsString, IsOptional, IsNotEmpty } from 'class-validator';
33

44
export class CreateBuildDto {
5-
@ApiProperty()
5+
@ApiPropertyOptional()
66
@IsOptional()
77
@IsString()
88
@IsNotEmpty()

src/shared/dto/baseline-data.dto.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
import { ApiProperty } from '@nestjs/swagger';
1+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
22
import { IsString, IsOptional } from 'class-validator';
33

44
export class BaselineDataDto {
55
@ApiProperty()
66
@IsString()
77
name: string;
88

9-
@ApiProperty()
9+
@ApiPropertyOptional()
1010
@IsOptional()
1111
@IsString()
1212
os?: string;
1313

14-
@ApiProperty()
14+
@ApiPropertyOptional()
1515
@IsOptional()
1616
@IsString()
1717
browser?: string;
1818

19-
@ApiProperty()
19+
@ApiPropertyOptional()
2020
@IsOptional()
2121
@IsString()
2222
viewport?: string;
2323

24-
@ApiProperty()
24+
@ApiPropertyOptional()
2525
@IsOptional()
2626
@IsString()
2727
device?: string;

src/swagger.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { INestApplication } from '@nestjs/common';
22
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
33

44
export function setupSwagger(app: INestApplication) {
5-
const options = new DocumentBuilder()
6-
.setTitle('Nest.js example API')
5+
const options = new DocumentBuilder()
6+
.setTitle('Visual Regression Tracker')
77
.setDescription('API Documentation')
88
.setVersion('1.0')
99
.addBearerAuth()
1010
.addApiKey({ type: 'apiKey', name: 'apiKey', in: 'header', description: 'API Key For External calls' })
1111
.build();
1212
const document = SwaggerModule.createDocument(app, options);
1313
SwaggerModule.setup('api', app, document);
14-
}
14+
}

src/test-runs/dto/create-test-request.dto.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ApiProperty } from '@nestjs/swagger';
1+
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
22
import { Transform } from 'class-transformer';
33
import { IsOptional, IsUUID, IsNumber, IsBoolean, IsBase64 } from 'class-validator';
44
import { BaselineDataDto } from '../../shared/dto/baseline-data.dto';
@@ -18,17 +18,17 @@ export class CreateTestRequestDto extends BaselineDataDto {
1818
@IsUUID()
1919
projectId: string;
2020

21-
@ApiProperty()
21+
@ApiPropertyOptional()
2222
@IsOptional()
2323
@IsNumber()
2424
diffTollerancePercent?: number;
2525

26-
@ApiProperty()
26+
@ApiPropertyOptional()
2727
@IsBoolean()
2828
@IsOptional()
2929
merge?: boolean;
3030

31-
@ApiProperty({ type: [IgnoreAreaDto] })
31+
@ApiPropertyOptional({ type: [IgnoreAreaDto] })
3232
@IsOptional()
3333
ignoreAreas?: IgnoreAreaDto[];
3434
}

src/test-variations/test-variations.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class TestVariationsController {
2424
}
2525

2626
@Get('details/:id')
27-
@ApiQuery({ name: 'id', required: true })
27+
@ApiParam({ name: 'id', required: true })
2828
@ApiBearerAuth()
2929
@UseGuards(JwtAuthGuard)
3030
getDetails(@Param('id', new ParseUUIDPipe()) id: string): Promise<TestVariation & { baselines: Baseline[] }> {

0 commit comments

Comments
 (0)