Skip to content

Commit 2a9cd13

Browse files
committed
Update reports dto
1 parent 4f41d05 commit 2a9cd13

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/app.controller.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,6 @@ export class AppController {
199199
throw new BadRequestException('No token or user address provided')
200200
}
201201

202-
if(!dto.type) {
203-
throw new BadRequestException('No type provided')
204-
}
205-
206202
const existedReports = await this.appService.getReports(dto)
207203
if(existedReports.length > 0) {
208204
throw new BadRequestException('Report already exists')

src/dto/report.dto.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { ApiProperty } from '@nestjs/swagger';
2-
import {IsNumber, IsOptional, IsString, Max} from 'class-validator';
2+
import {IsNumber, IsOptional, IsString, Max, Min} from 'class-validator';
33
import {Transform, Type} from "class-transformer";
44

55
export class AddReportDto {
66
@ApiProperty({ type: Number, required: true })
77
@Type(() => Number)
88
@IsNumber()
9+
@Min(-1)
10+
@Max(3)
911
type: number;
1012

1113
@ApiProperty({ type: String, required: false })
@@ -28,6 +30,12 @@ export class AddReportDto {
2830
@IsString()
2931
@IsOptional()
3032
reporterUserAddress?: string;
33+
34+
@ApiProperty({ type: String, required: false })
35+
@Type(() => String)
36+
@IsString()
37+
@IsOptional()
38+
details?: string;
3139
}
3240

3341
export class GetReportsDto {

src/entities/report.entity.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class ReportEntity {
2828
@Column({ nullable: true })
2929
reporterUserAddress: string;
3030

31-
@ApiProperty()
31+
@ApiProperty({ required: false })
3232
@Column({ nullable: true })
3333
details: string;
3434

0 commit comments

Comments
 (0)