Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: PR(1) added centralized helper function for minio-upload using pre-signed url #3762

Merged
merged 2 commits into from
Mar 1, 2025

Conversation

iamanishx
Copy link

@iamanishx iamanishx commented Feb 28, 2025

What kind of change does this PR introduce?

Issue Number: #3729

Fixes #

Snapshots/Videos:
N/A

If relevant, did you update the documentation?

Summary
1-st PR of the series of minio-client PRs
created a helper function that will get the presigned url from backend and it will PUT the
files in the minio-server

Does this PR introduce a breaking change?

Checklist

CodeRabbit AI Review

  • I have reviewed and addressed all critical issues flagged by CodeRabbit AI
  • I have implemented or provided justification for each non-critical suggestion
  • I have documented my reasoning in the PR comments where CodeRabbit AI suggestions were not implemented

Test Coverage

  • I have written tests for all new changes/features
  • I have verified that test coverage meets or exceeds 95%
  • I have run the test suite locally and all tests pass

Other information

Have you read the contributing guide?

Summary by CodeRabbit

  • New Features

    • Introduced a new API endpoint that generates presigned URLs for secure file uploads.
    • Added a file upload utility that streamlines the upload process.
  • Documentation

    • Expanded documentation for presigned URL usage and the file upload utility.
    • Updated component descriptions to better reflect available organization details and options.

Copy link
Contributor

coderabbitai bot commented Feb 28, 2025

Walkthrough

This pull request introduces a new GraphQL mutation (createPresignedUrl) and exports a variable (PRESIGNED_URL) in the mutations file. It adds auto-generated documentation for the new variable and a custom hook (useMinioUpload) that handles file uploads to MinIO via a presigned URL. Unit tests for the hook are also added. Additionally, the documentation for the LeftDrawerOrg component is updated to modify its description.

Changes

Files Change Summary
docs/.../GraphQl/Mutations/mutations/variables/PRESIGNED_URL.md, docs/.../utils/MinioUpload/functions/useMinioUpload.md New documentation added for variable PRESIGNED_URL and function useMinioUpload(), including links to their source code definitions.
src/.../mutations.ts Added GraphQL mutation createPresignedUrl (accepting MutationCreatePresignedUrlInput! and returning fileUrl, presignedUrl, objectName); exported the PRESIGNED_URL variable.
src/utils/MinioUpload.ts, src/utils/MinioUpload.spec.tsx Introduced the useMinioUpload hook with InterfaceMinioUpload and its method uploadFileToMinio; added unit tests via a new TestComponent using Apollo’s MockedProvider.
docs/.../LeftDrawerOrg/functions/default.md Updated the component documentation by refining the description, removing the explicit mention of navigation options.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant GraphQL_API
    participant MinioServer
    Client->>GraphQL_API: Call createPresignedUrl (via useMinioUpload)
    GraphQL_API-->>Client: Return presigned URL + file metadata
    Client->>MinioServer: HTTP PUT file using presigned URL
    MinioServer-->>Client: Respond with upload status
Loading

Possibly related PRs

Suggested labels

ignore-sensitive-files-pr

Suggested reviewers

  • palisadoes

Poem

I'm a bunny coding through the night,
Hopping through docs and mutations bright.
My paws create hooks that smoothly flow,
With presigned URLs ready to go.
A carrot of code, crisp and light—
Cheers to changes that make our app take flight!


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9d37ed6 and b05fa50.

📒 Files selected for processing (6)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/PRESIGNED_URL.md (1 hunks)
  • docs/docs/auto-docs/components/LeftDrawerOrg/LeftDrawerOrg/functions/default.md (1 hunks)
  • docs/docs/auto-docs/utils/MinioUpload/functions/useMinioUpload.md (1 hunks)
  • src/GraphQl/Mutations/mutations.ts (1 hunks)
  • src/utils/MinioUpload.spec.tsx (1 hunks)
  • src/utils/MinioUpload.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/docs/auto-docs/components/LeftDrawerOrg/LeftDrawerOrg/functions/default.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/docs/auto-docs/utils/MinioUpload/functions/useMinioUpload.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/PRESIGNED_URL.md
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test Application
  • GitHub Check: Analyse Code With CodeQL (javascript)
🔇 Additional comments (3)
src/GraphQl/Mutations/mutations.ts (1)

786-794: LGTM - Well-structured GraphQL mutation for presigned URLs

The PRESIGNED_URL mutation is correctly defined with proper syntax and follows the convention used throughout the file. It requests the necessary fields (fileUrl, presignedUrl, and objectName) needed for file uploads to MinIO.

src/utils/MinioUpload.ts (1)

1-50: Well-implemented MinIO upload hook with proper error handling

This hook nicely encapsulates the two-step process for MinIO uploads: first retrieving a presigned URL via GraphQL mutation, then using that URL to upload the file directly. The error handling is thorough, checking both the GraphQL response and the upload request's success status.

src/utils/MinioUpload.spec.tsx (1)

1-185: Comprehensive test coverage for the MinIO upload functionality

The tests cover the critical paths: successful uploads, GraphQL errors, and upload failures. The use of a test component that simulates real usage is an excellent approach. The setup with MockedProvider and proper mocking of the fetch API shows good understanding of testing React hooks with external dependencies.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Our Pull Request Approval Process

Thanks for contributing!

Testing Your Code

Remember, your PRs won't be reviewed until these criteria are met:

  1. We don't merge PRs with poor code quality.
    1. Follow coding best practices such that CodeRabbit.ai approves your PR.
  2. We don't merge PRs with failed tests.
    1. When tests fail, click on the Details link to learn more.
    2. Write sufficient tests for your changes (CodeCov Patch Test). Your testing level must be better than the target threshold of the repository
    3. Tests may fail if you edit sensitive files. Ask to add the ignore-sensitive-files-pr label if the edits are necessary.
  3. We cannot merge PRs with conflicting files. These must be fixed.

Our policies make our code better.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Congratulations on making your first PR! 🎊 If you haven't already, check out our Contributing Guidelines and PR Reporting Guidelines to ensure that you are following our guidelines for contributing and creating PR.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (7)
docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/SEND_MEMBERSHIP_REQUEST.md (2)

11-11: Clarify Mutation Functionality Relative to Variable Name.
The description now states that the mutation “removes a custom field from an organization,” which may seem inconsistent with the variable name SEND_MEMBERSHIP_REQUEST. If this repurposing is intentional, consider adding a brief explanatory note in the documentation to clarify this behavior for future readers.


17-20: Consider Consolidating Parameter Sections.
There are two separate ## Param headers for the two parameters. Merging them into a single section with distinct labels for each parameter (e.g., "Organization ID" and "Custom Field ID") could enhance readability and maintain consistency in the documentation style.

src/utils/MinioUpload.spec.tsx (1)

157-184: Improve mock implementation for fetch failure test

The type casting for global.fetch is unnecessarily complex and could be simplified.

-  (
-    global.fetch as unknown as {
-      mockImplementationOnce: (fn: () => Promise<Response>) => void;
-    }
-  ).mockImplementationOnce(() => Promise.resolve({ ok: false } as Response));
+  (global.fetch as jest.Mock).mockImplementationOnce(() => 
+    Promise.resolve({ ok: false } as Response)
+  );
src/utils/MinioUpload.ts (3)

11-50: Consider enhancing the MinIO upload implementation

The implementation works well but could be improved with better error handling, progress tracking, and additional headers.

Consider these enhancements:

  1. Add Content-Length header for more reliable uploads
  2. Include more descriptive error messages with original error details
  3. Add timeout handling for the fetch request
  4. Consider adding a progress tracking callback option for larger files

Example implementation for Content-Length header:

   const response = await fetch(presignedUrl, {
     method: 'PUT',
     body: file,
     headers: {
       'Content-Type': file.type,
+      'Content-Length': file.size.toString(),
     },
   });

28-30: Improve error handling for missing presigned URL

Error handling could be more descriptive to help diagnose issues.

   if (!data || !data.createPresignedUrl) {
-     throw new Error('Failed to get presigned URL');
+     throw new Error('Failed to get presigned URL: The server did not return the expected data');
   }

42-44: Enhance error handling for upload failures

The current error handling doesn't include any details about the failed response, making debugging difficult.

   if (!response.ok) {
-     throw new Error('File upload failed');
+     throw new Error(`File upload failed with status: ${response.status} - ${response.statusText}`);
   }
docs/docs/auto-docs/screens/OrgSettings/OrgSettings.mocks/variables/MOCKS.md (1)

7-7: Enhanced MOCKS Constant Definition.
The updated inline type definition for the MOCKS constant now omits the customFieldsByOrganizationId variable, streamlining the mock configuration. Please verify that all references depending on the removed field are updated accordingly. For readability and long-term maintainability, consider extracting these extensive union type definitions into a dedicated TypeScript type or interface if feasible.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ca1f067 and 339624f.

📒 Files selected for processing (86)
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/ADD_CUSTOM_FIELD.md (0 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/CANCEL_MEMBERSHIP_REQUEST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/JOIN_PUBLIC_ORGANIZATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/REMOVE_CUSTOM_FIELD.md (0 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/SEND_MEMBERSHIP_REQUEST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ACCEPT_ORGANIZATION_REQUEST_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADDRESS_DETAILS_FRAGMENT.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_ADMIN_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_ADVERTISEMENT_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_MEMBER_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_PLUGIN_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/BLOCK_USER_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_EVENT_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_ORGANIZATION_MEMBERSHIP_MUTATION_PG.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_ORGANIZATION_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_ORGANIZATION_MUTATION_PG.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_POST_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_ADVERTISEMENT_BY_ID.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_EVENT_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_ORGANIZATION_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_POST_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DONATE_TO_ORGANIZATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/FORGOT_PASSWORD_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/GENERATE_OTP_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/LIKE_POST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/PRESIGNED_URL.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/RECAPTCHA_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REFRESH_TOKEN_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REGISTER_EVENT.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REJECT_ORGANIZATION_REQUEST_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REMOVE_ADMIN_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REMOVE_MEMBER_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/RESET_COMMUNITY.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REVOKE_REFRESH_TOKEN.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/SIGNUP_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UNLIKE_POST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ADVERTISEMENT_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_COMMUNITY_PG.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_CURRENT_USER_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_EVENT_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_INSTALL_STATUS_PLUGIN_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ORGANIZATION_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ORG_STATUS_PLUGIN_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_POST_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_SESSION_TIMEOUT_PG.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_USER_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_USER_PASSWORD_MUTATION.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/PlugInQueries/variables/IS_SAMPLE_ORGANIZATION_QUERY.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/PlugInQueries/variables/ORGANIZATION_CUSTOM_FIELDS.md (0 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ADMIN_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/BLOCK_PAGE_MEMBER_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_DATA.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_DATA_PG.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_SESSION_TIMEOUT_DATA_PG.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_EVENTS.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/MEMBERSHIP_REQUEST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/MEMBERS_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATIONS_MEMBER_CONNECTION_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_DONATION_CONNECTION_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_EVENT_CONNECTION_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_EVENT_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/SIGNIN_QUERY.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USERS_CONNECTION_LIST.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_DETAILS.md (1 hunks)
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_ORGANIZATION_LIST.md (1 hunks)
  • docs/docs/auto-docs/components/LeftDrawer/LeftDrawer/functions/default.md (1 hunks)
  • docs/docs/auto-docs/components/LeftDrawer/LeftDrawer/interfaces/InterfaceLeftDrawerProps.md (1 hunks)
  • docs/docs/auto-docs/components/OrgSettings/General/GeneralSettings/functions/default.md (1 hunks)
  • docs/docs/auto-docs/components/OrgSettings/General/OrgProfileFieldSettings/OrgProfileFieldSettings/functions/default.md (0 hunks)
  • docs/docs/auto-docs/components/OrgSettings/General/OrgUpdate/OrgUpdate/functions/default.md (1 hunks)
  • docs/docs/auto-docs/screens/OrgSettings/OrgSettings.mocks/variables/MOCKS.md (1 hunks)
  • docs/docs/auto-docs/screens/UserPortal/LeaveOrganization/LeaveOrganization/variables/userEmail.md (1 hunks)
  • docs/docs/auto-docs/screens/UserPortal/LeaveOrganization/LeaveOrganization/variables/userId.md (1 hunks)
  • docs/docs/auto-docs/utils/MinioUpload/functions/useMinioUpload.md (1 hunks)
  • docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceCreateVolunteerGroup.md (1 hunks)
  • docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceCustomFieldData.md (2 hunks)
  • docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceEventVolunteerInfo.md (3 hunks)
  • docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceUserEvents.md (3 hunks)
  • docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceVolunteerGroupInfo.md (4 hunks)
  • docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceVolunteerMembership.md (3 hunks)
  • docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceVolunteerRank.md (1 hunks)
  • docs/docs/auto-docs/utils/useLocalstorage/functions/getItem.md (2 hunks)
  • docs/docs/auto-docs/utils/useLocalstorage/functions/setItem.md (1 hunks)
  • src/GraphQl/Mutations/mutations.ts (1 hunks)
  • src/utils/MinioUpload.spec.tsx (1 hunks)
  • src/utils/MinioUpload.ts (1 hunks)
💤 Files with no reviewable changes (4)
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/ADD_CUSTOM_FIELD.md
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/REMOVE_CUSTOM_FIELD.md
  • docs/docs/auto-docs/GraphQl/Queries/PlugInQueries/variables/ORGANIZATION_CUSTOM_FIELDS.md
  • docs/docs/auto-docs/components/OrgSettings/General/OrgProfileFieldSettings/OrgProfileFieldSettings/functions/default.md
✅ Files skipped from review due to trivial changes (71)
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_POST_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/MEMBERS_LIST.md
  • docs/docs/auto-docs/utils/MinioUpload/functions/useMinioUpload.md
  • docs/docs/auto-docs/components/OrgSettings/General/GeneralSettings/functions/default.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ACCEPT_ORGANIZATION_REQUEST_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/BLOCK_USER_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REMOVE_MEMBER_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_USER_PASSWORD_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/PRESIGNED_URL.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADDRESS_DETAILS_FRAGMENT.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_POST_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_EVENT_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/GENERATE_OTP_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_ORGANIZATION_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/RESET_COMMUNITY.md
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/CANCEL_MEMBERSHIP_REQUEST.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_DATA_PG.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ADVERTISEMENT_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_ADVERTISEMENT_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/MEMBERSHIP_REQUEST.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_ADMIN_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/LIKE_POST.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_SESSION_TIMEOUT_DATA_PG.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ORGANIZATION_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_ORGANIZATION_EVENTS.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_ORGANIZATION_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REGISTER_EVENT.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_EVENT_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/RECAPTCHA_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/SIGNUP_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ADMIN_LIST.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_USER_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_POST_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_EVENT_CONNECTION_LIST.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DONATE_TO_ORGANIZATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_COMMUNITY_PG.md
  • docs/docs/auto-docs/components/OrgSettings/General/OrgUpdate/OrgUpdate/functions/default.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_INSTALL_STATUS_PLUGIN_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UNLIKE_POST.md
  • docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/JOIN_PUBLIC_ORGANIZATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_SESSION_TIMEOUT_PG.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USERS_CONNECTION_LIST.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_ORGANIZATION_MUTATION_PG.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_PLUGIN_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/DELETE_ADVERTISEMENT_BY_ID.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_ORG_STATUS_PLUGIN_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_ORGANIZATION_LIST.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REVOKE_REFRESH_TOKEN.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_EVENT_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_EVENT_LIST.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/SIGNIN_QUERY.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/BLOCK_PAGE_MEMBER_LIST.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATION_DONATION_CONNECTION_LIST.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/UPDATE_CURRENT_USER_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/GET_COMMUNITY_DATA.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/ORGANIZATIONS_MEMBER_CONNECTION_LIST.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REMOVE_ADMIN_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/CREATE_ORGANIZATION_MEMBERSHIP_MUTATION_PG.md
  • docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceUserEvents.md
  • docs/docs/auto-docs/GraphQl/Queries/Queries/variables/USER_DETAILS.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/ADD_MEMBER_MUTATION.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/FORGOT_PASSWORD_MUTATION.md
  • docs/docs/auto-docs/components/LeftDrawer/LeftDrawer/interfaces/InterfaceLeftDrawerProps.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REFRESH_TOKEN_MUTATION.md
  • docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceCreateVolunteerGroup.md
  • docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceVolunteerRank.md
  • docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceEventVolunteerInfo.md
  • docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceVolunteerGroupInfo.md
  • docs/docs/auto-docs/GraphQl/Queries/PlugInQueries/variables/IS_SAMPLE_ORGANIZATION_QUERY.md
  • docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceVolunteerMembership.md
  • docs/docs/auto-docs/GraphQl/Mutations/mutations/variables/REJECT_ORGANIZATION_REQUEST_MUTATION.md
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Test Application
🔇 Additional comments (19)
docs/docs/auto-docs/GraphQl/Mutations/OrganizationMutations/variables/SEND_MEMBERSHIP_REQUEST.md (3)

9-10: Verify the Updated Source Link.
The new definition location link now points to src/GraphQl/Mutations/OrganizationMutations.ts:241. Please confirm that this is the correct and intended source location for the mutation definition.


13-16: Clear Documentation of the Organization ID Parameter.
The parameter section clearly indicates that the ID of the organization (from which the custom field is to be removed) is required. This update improves clarity in the documentation.


21-23: Clear Return Value Description.
The return section succinctly explains that the mutation returns the removed organization custom field object, which is clear and sufficiently descriptive.

docs/docs/auto-docs/screens/UserPortal/LeaveOrganization/LeaveOrganization/variables/userId.md (1)

7-7: Enhanced Type Safety for userId

Changing the type from any to unknown improves type safety and clearly communicates the restricted usage of this variable.

docs/docs/auto-docs/screens/UserPortal/LeaveOrganization/LeaveOrganization/variables/userEmail.md (1)

7-7: Enhanced Type Safety for userEmail

Updating the type from any to unknown increases precision and consistency with other related documentation changes.

docs/docs/auto-docs/utils/useLocalstorage/functions/setItem.md (1)

29-31: Refined Parameter Type for value in setItem Documentation

Changing the parameter type from any to unknown clarifies that explicit type handling is expected before usage, thereby improving overall type safety.

docs/docs/auto-docs/utils/useLocalstorage/functions/getItem.md (2)

7-17: Introduce Generic Type Parameter in getItem Function

Updating the function signature to include a generic <T> enhances type safety by allowing callers to specify the expected type of the stored value. The addition of a dedicated "Type Parameters" section further clarifies this usage.


31-33: Clarify Return Type Description in getItem

Updating the return documentation to state that the stored value is parsed as type T (or null) reinforces type correctness and informs proper utilization of the function.

docs/docs/auto-docs/components/LeftDrawer/LeftDrawer/functions/default.md (3)

7-11: Refactor Function Signature for default Component

Changing the signature to use props instead of the generic __namedParameters aligns the documentation with best practices for React components and improves readability.


15-19: Clarify Documentation for Component Props

Using the [InterfaceLeftDrawerProps](../interfaces/InterfaceLeftDrawerProps.md) link along with a clear description for props improves understanding of the expected inputs for the component.


25-25: Update Return Description

The revised return description "The rendered LeftDrawer component" succinctly communicates the expected output of the function.

docs/docs/auto-docs/utils/interfaces/interfaces/InterfaceCustomFieldData.md (3)

11-15: LGTM: Added id property

The new optional id property is correctly documented with proper formatting and reference to the implementation file.


27-33: LGTM: Added organizationId property

The new optional organizationId property is correctly documented with proper formatting and reference to the implementation file.


39-39: LGTM: Updated reference for type property

The reference line for the type property has been correctly updated to point to line 1279.

src/utils/MinioUpload.spec.tsx (3)

8-40: LGTM: Well-structured TestComponent for testing useMinioUpload hook

The TestComponent is well-implemented with proper state management and error handling. It correctly uses the hook and provides appropriate feedback through status updates.


42-110: LGTM: Comprehensive test for successful file upload

This test thoroughly checks the successful upload flow, including:

  • Initial status updates
  • Proper mock setup
  • Verification of the onUploadComplete callback with correct data

The test setup with MockedProvider and file mocking is well-executed.


112-155: LGTM: Proper error testing for mutation failure

The test correctly verifies error handling when the GraphQL mutation returns null data.

src/utils/MinioUpload.ts (1)

4-9: LGTM: Clean interface definition

The InterfaceMinioUpload interface clearly defines the contract with appropriate types and return values.

docs/docs/auto-docs/screens/OrgSettings/OrgSettings.mocks/variables/MOCKS.md (1)

9-9: Source Reference Link Confirmation.
The documentation now includes a clear reference to the source file (src/screens/OrgSettings/OrgSettings.mocks.ts:8), which improves traceability. This update is consistent with the change in the mock definition and aids future maintenance.

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 28, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 28, 2025
Copy link

codecov bot commented Feb 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.09%. Comparing base (8688f5b) to head (b05fa50).
Report is 1 commits behind head on develop-postgres.

Additional details and impacted files
@@                 Coverage Diff                  @@
##           develop-postgres    #3762      +/-   ##
====================================================
+ Coverage             86.06%   86.09%   +0.03%     
====================================================
  Files                   372      373       +1     
  Lines                  9219     9232      +13     
  Branches               1951     1953       +2     
====================================================
+ Hits                   7934     7948      +14     
  Misses                  903      903              
+ Partials                382      381       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@iamanishx
Copy link
Author

@palisadoes please review .

Now others can start working on this base64 to minio-client as they will be using this helper function to generate and upload the files to minio-server

The biggest drawback is the issue regarding the users joining organisations has not been solved
That's why the upcoming PRs on this base64 to minio-client may face issues cause they won't be able to test the code thru browser itself properly .

@Cioppolo14
Copy link
Contributor

@noman2002 @beingnoble03 Can you review this PR?

@palisadoes palisadoes requested review from duplixx and Dante291 March 1, 2025 01:56
@palisadoes
Copy link
Contributor

Please fix the conflicting files

@iamanishx
Copy link
Author

Please fix the conflicting files

On it

@iamanishx
Copy link
Author

https://docs.google.com/document/d/18nFPcaui_jEdYUq_mJ06mcJos7rglwFpG_irggeTj6Y/edit?tab=t.0

Architecture for direct upload from frontend using presignedUrl (minio-client) method :

@palisadoes palisadoes merged commit 9eeb840 into PalisadoesFoundation:develop-postgres Mar 1, 2025
19 checks passed
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.

4 participants