Remove graphql upload and add graphql upload ts#1093
Merged
danielailie merged 11 commits intomainfrom Jun 16, 2025
Merged
Conversation
andreibancioiu
approved these changes
Jun 16, 2025
| async uploadFile(file: any): Promise<UploadToIpfsResult> { | ||
| const url = `${process.env.PINATA_API_URL}/v3/files`; | ||
| const readStream = await file.createReadStream(); | ||
| const { createReadStream, filename /*, fieldName, mimetype, encoding */ } = await file; |
There was a problem hiding this comment.
Commented out - all right, by convention?
cfaur09
reviewed
Jun 16, 2025
| }); | ||
|
|
||
| return this.mapReturnType(response.data.cid); | ||
| return this.mapReturnType(response.data.data.cid); |
Collaborator
Author
There was a problem hiding this comment.
yes, this is the way it returns
There was a problem hiding this comment.
Pull Request Overview
This PR migrates file-upload handling from graphql-upload to graphql-upload-ts, adjusts Pinata response mapping, reorders imports, and bumps related dependencies.
- Swap all
graphql-uploadimports tographql-upload-tsand simplify upload code - Update
PinataServiceto extract CID fromresponse.data.data - Reorder and group imports across modules and bump
axios/@types
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/modules/rabbitmq/blockchain-events/handlers/startAuction-event.handler.ts | Tweak import order and add forwardRef for AssetByIdentifierService |
| src/modules/rabbitmq/blockchain-events/feed-events.service.ts | Reorder imports and inject AssetByIdentifierService via forwardRef |
| src/modules/ipfs/pinata.service.ts | Destructure FileUpload, append file correctly, map response.data.data.cid |
| src/modules/assets/models/requests/CreateNftRequest.ts | Change FileUpload import to graphql-upload-ts |
| src/modules/assets/assets-transaction.service.ts | Use graphql-upload-ts and simplify uploadFileToPinata |
| src/modules/assets/assets-mutations.resolver.ts | Switch to graphql-upload-ts and reorder resolver imports |
| src/main.ts | Import graphqlUploadExpress from graphql-upload-ts and reorder bootstrap imports |
| src/app.module.ts | Reorder module imports and add common extensions |
| package.json | Bump axios, replace graphql-upload with graphql-upload-ts, adjust @types/express |
Comments suppressed due to low confidence (1)
src/main.ts:5
- You imported
graphqlUploadExpressbut didn't apply it as middleware inbootstrap(). You should addapp.use(graphqlUploadExpress({ maxFileSize: ..., maxFiles: ... }));before setting up the GraphQL server to enable uploads.
import { graphqlUploadExpress } from 'graphql-upload-ts';
Comment on lines
+144
to
+145
| const fileData = await this.pinataService.uploadFile(fileUpload); | ||
| await this.s3Service.upload(fileUpload, fileData.hash); |
There was a problem hiding this comment.
You're passing the fileUpload promise directly to s3Service.upload. Await the upload promise (e.g. const file = await fileUpload) or destructure it first so the object with createReadStream and filename is passed.
Suggested change
| const fileData = await this.pinataService.uploadFile(fileUpload); | |
| await this.s3Service.upload(fileUpload, fileData.hash); | |
| const resolvedFileUpload = await fileUpload; | |
| const fileData = await this.pinataService.uploadFile(resolvedFileUpload); | |
| await this.s3Service.upload(resolvedFileUpload, fileData.hash); |
cfaur09
approved these changes
Jun 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.