Skip to content

Commit

Permalink
Comment incomplete interceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
neos1803 committed Aug 17, 2021
1 parent 0d5947d commit ceb6a4b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/app.resolver.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
import { Args, Mutation, Query, Resolver } from "@nestjs/graphql";
import { FileUpload, GraphQLUpload } from "graphql-upload";
import { createWriteStream } from "fs";
// import { UseInterceptors } from "@nestjs/common";
// import { SingleFileInterceptor } from "src/interceptors/request.inteceptors";

@Resolver()
export class AppResolver {

@Mutation(returns => Boolean)
// @UseInterceptors(SingleFileInterceptor('file'))
async uploadFile(
@Args('file', { type: () => GraphQLUpload }) file: FileUpload
) {
console.log(file)
const file_name = await this.uploadFileHelper(file);
return true;
try {
// console.log(file)
// const file_name = await this.uploadFileHelper(file);
console.log(1)
return true;
} catch (error) {
throw new Error(error.message);
}
}

private uploadFileHelper({ createReadStream, encoding, filename, mimetype }: FileUpload): Promise<string> {
Expand Down

0 comments on commit ceb6a4b

Please sign in to comment.