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.
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
Adding Api for Plugin using smaple_data in api #3294
Adding Api for Plugin using smaple_data in api #3294
Changes from 5 commits
365a783
57f0f51
1284926
5a86586
5a1253d
ee66ac0
825fbb2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Fix incorrect file path in the comment.
The comment references
src/graphql/types/Plugin/Plugin.ts
(singular) but the actual path uses the plural formPlugins
.📝 Committable suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Imports look fine, but please address formatting issues.
All imports appear valid and necessary. However, according to the pipeline failures, the codebase's formatting checks are failing on this file. Please ensure you run the project's formatter to resolve any style inconsistencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you format it and i do change in my code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Length of output: 4501
🏁 Script executed:
Length of output: 2107
🏁 Script executed:
Length of output: 432
@MayankJha014 I ran the project's formatter command (
pnpm fix_code_quality
) on your file, but it reported "No fixes applied", which suggests the file is already correctly formatted according to the project's standards.The code looks well-structured with consistent indentation and proper spacing. If you're still experiencing pipeline failures, it might be related to:
You can try running the full project formatter with
pnpm fix_code_quality
without specifying files to fix all formatting issues across the codebase.Check warning on line 12 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L12
Check warning on line 20 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L14-L20
Check warning on line 33 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L22-L33
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Implement pagination for the getPlugins query.
Currently, the query returns all plugins without pagination, which could be problematic as the number of plugins grows. Consider implementing pagination for better scalability.
📝 Committable suggestion
Check warning on line 57 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L57
Check warning on line 65 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L59-L65
Check warning on line 81 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L68-L81
Check warning on line 88 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L84-L88
Check warning on line 101 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L90-L101
Check warning on line 114 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L103-L114
Check warning on line 127 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L127
Check warning on line 135 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L129-L135
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add authorization checks for the updatePluginStatus mutation.
Currently, the mutation only checks if the user is authenticated but doesn't verify if they have permission to update the plugin status for a specific organization. Consider adding role-based authorization checks.
📝 Committable suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in ctx dataSource is not available
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Length of output: 9359
🏁 Script executed:
Length of output: 75586
@MayankJha014 You're right, the
dataSource
property isn't available in the context. Let me provide a correct implementation that follows the codebase's patterns for authorization checks:This follows the authentication pattern used throughout the codebase, checking if the user is either a global admin or an admin of the specific organization.
Check warning on line 150 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L138-L150
Check warning on line 153 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L153
Check warning on line 155 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L155
Check warning on line 160 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L157-L160
Check warning on line 163 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L162-L163
Check warning on line 166 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L166
Check warning on line 179 in src/graphql/types/Query/plugin.ts
src/graphql/types/Query/plugin.ts#L168-L179
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Add persistence mechanism for plugin changes.
The current implementation modifies in-memory data with the updatePluginStatus mutation. These changes will be lost on server restart since they're not persisted to a database or file system.
Consider implementing a persistence mechanism to save plugin installation status changes:
🏁 Script executed:
Length of output: 654
Ensure persistent storage for plugin status changes
The mutation implemented in
src/graphql/types/Query/plugin.ts
(lines 118-181) currently updates the plugin's installation status solely in-memory. Our repository search did not reveal any database connection configurations (e.g., mongoose, prisma, typeorm, sequelize, knex) that could be used for persistence, aside from sample data handling in./scripts/dbManagement/helpers.ts
. This means that any changes made via theupdatePluginStatus
mutation will be lost upon server restart.To address this, please consider one of the following actions: