fix(pay-slip)[backend]: delete file from storage on record deletion#39
fix(pay-slip)[backend]: delete file from storage on record deletion#39MohamadNazik wants to merge 1 commit intoLSFLK:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue where deleting pay slip records from the database would leave their corresponding files orphaned in Firebase Storage. The changes introduce a more robust deletion process that ensures both the database record and the associated storage file are removed. This improves data consistency and prevents unnecessary storage consumption, while also enhancing the API documentation for the delete endpoint. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request implements a two-phase deletion process for pay slips, first removing the associated file from Firebase Storage and then deleting the record from the database. This involved adding a DeleteFile method to the FirebaseStorage service and updating the OpenAPI specification to reflect the new deletion logic and include additional error responses. The review comments highlight that the error handling for storage deletion in payslip_handlers.go is fragile due to its reliance on string-matching error messages and should be refactored to use the specific storage.ErrObjectNotExist error type for robustness. Additionally, the review suggests replacing fmt.Printf with log.Printf for consistent logging and removing development-related comments for improved code clarity.
e9bd3ff to
ee66717
Compare
ee66717 to
d26d7b3
Compare
Summary
This PR fixes the issue where deleting a pay slip left orphaned files in Firebase Storage. The deletion process now cleans up both the storage object and the database record.
Changes
Closes #31