Skip to content

Remove graphql upload and add graphql upload ts#1093

Merged
danielailie merged 11 commits intomainfrom
TOOL-610-remove-graphql-upload-and-add-graphql-upload-ts
Jun 16, 2025
Merged

Remove graphql upload and add graphql upload ts#1093
danielailie merged 11 commits intomainfrom
TOOL-610-remove-graphql-upload-and-add-graphql-upload-ts

Conversation

@danielailie
Copy link
Collaborator

No description provided.

@danielailie danielailie self-assigned this Jun 12, 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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented out - all right, by convention?

@andreibancioiu andreibancioiu requested a review from Copilot June 16, 2025 12:45
});

return this.mapReturnType(response.data.cid);
return this.mapReturnType(response.data.data.cid);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intended data.data?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this is the way it returns

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-upload imports to graphql-upload-ts and simplify upload code
  • Update PinataService to extract CID from response.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 graphqlUploadExpress but didn't apply it as middleware in bootstrap(). You should add app.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);
Copy link

Copilot AI Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copilot uses AI. Check for mistakes.
@danielailie danielailie merged commit f19c96e into main Jun 16, 2025
1 check passed
@danielailie danielailie deleted the TOOL-610-remove-graphql-upload-and-add-graphql-upload-ts branch June 16, 2025 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants