Skip to content

Commit 0f0ae60

Browse files
authored
bugfix: graphql-upload error handling (#67)
1 parent 57f9208 commit 0f0ae60

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

apps/api/src/main.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ async function bootstrap(): Promise<void> {
3939
next();
4040
}
4141
});
42-
app.useGlobalPipes(new ValidationPipe());
42+
app.useGlobalPipes(
43+
new ValidationPipe({
44+
transform: true,
45+
}),
46+
);
4347
app.useGlobalFilters(new HttpExceptionFilter(new JsendFormatter()));
4448
// TODO: Update origin as needed
4549
app.enableCors({ origin: '*', credentials: true });

apps/api/src/modules/summary/dto/create-summary.dto.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { InputType, Field } from '@nestjs/graphql';
2-
import { IsOptional } from 'class-validator';
32
import { Stream } from 'stream';
43
import GraphQLUpload = require('graphql-upload/GraphQLUpload.js');
54
export interface FileUpload {
@@ -12,6 +11,5 @@ export interface FileUpload {
1211
@InputType()
1312
export class CreateSummaryDTO {
1413
@Field(() => GraphQLUpload)
15-
@IsOptional()
16-
inputFile?: Promise<FileUpload>;
14+
inputFile: Promise<FileUpload>;
1715
}

0 commit comments

Comments
 (0)