keyshade-xyz / keyshade

Realtime secret and configuration management tool, with the best in class security and seamless integration support
https://keyshade.xyz
Mozilla Public License 2.0
196 stars 96 forks source link

feat(api): Added controller to fetch all revisions of a variable #288

Closed yogesh1801 closed 3 months ago

yogesh1801 commented 3 months ago

User description

Description

Give a summary of the change that you have made

Fixes #271

Dependencies

Mention any dependencies/packages used

Future Improvements

Mention any improvements to be done in future related to any file/feature

Mentions

Mention and tag the people

Screenshots of relevant screens

Add screenshots of relevant screens

Developer's checklist

If changes are made in the code:

Documentation Update


PR Type

Enhancement


Description


Changes walkthrough 📝

Relevant files
Enhancement
variable.controller.ts
Add endpoint to fetch revisions of a variable                       

apps/api/src/variable/controller/variable.controller.ts
  • Added a new endpoint getRevisionsOfVariable to fetch variable
    revisions.
  • Implemented route parameters for variableId and environmentId.
  • Applied RequiredApiKeyAuthorities decorator for authorization.
  • +14/-0   
    variable.service.ts
    Implement service method to get variable revisions             

    apps/api/src/variable/service/variable.service.ts
  • Added getRevisionsOfVariable method to fetch revisions from the
    database.
  • Included authority check for reading variable revisions.
  • Queried variableVersion table for revisions based on variableId and
    environmentId.
  • +22/-0   

    💡 PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    codiumai-pr-agent-free[bot] commented 3 months ago

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review [1-5] 2
    🧪 Relevant tests No
    🔒 Security concerns No
    ⚡ Key issues to review Possible Bug:
    The method getRevisionsOfVariable in variable.service.ts does not handle the case where no revisions are found for the given variableId and environmentId. It would be beneficial to add error handling or a response indicating that no revisions were found.
    Data Validation:
    Ensure that the parameters variableId and environmentId are properly validated before they are used in the database query to prevent any potential issues with malformed or malicious data.
    codiumai-pr-agent-free[bot] commented 3 months ago

    Failed to generate code suggestions for PR