Conversation
|
Note Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported. |
|
Caution Review failedThe pull request is closed. WalkthroughThe "FINAL STATUS REPORT" job was removed from the GitHub Actions workflow configuration. This job previously posted automated comments on pull requests about the build pipeline's status, summarizing success or failure. The workflow will no longer provide these automated status updates as comments. Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Pull Request Overview
This PR removes the final status-report job from the CI workflow, which previously posted automated pass/fail comments on pull requests.
- Removed the
status-reportjob and its steps for commenting on PR success/failure. - Cleaned up inline GitHub Script steps and associated separators.
- Simplified the workflow by deleting unused notification logic.
Comments suppressed due to low confidence (3)
.github/workflows/ci.yml:229
- Removing the 📊 Build Status Report job eliminates automated feedback on PR build outcomes. Consider replacing it with a reusable action or alternative notification to maintain visibility for reviewers.
# =====================================
.github/workflows/ci.yml:227
- [nitpick] It would be helpful to document the reason for removing the
status-reportjob so future maintainers understand why these notification steps were deleted.
compression-level: 6
* Add localized resource files for application messages * Add Persian localization resource file for application messages * Add IMessageService interface for message retrieval * Implement MessageService for localized message retrieval * Add MultiLanguageExtensionMethod for localization support * Enable multi-language support in controllers and middleware * Add LanguageController for multi-language support and message retrieval * Refactor AuthorVM to use resource-based error messages for localization * Refactor CreateBookVM to use resource-based error messages for localization * Refactor UpdateBookVM to use resource-based error messages for localization * add Scope IMessage Service on AddServiceExtentionMethod * remove namespace * add migration for fix error * Add error messages for localization in resource files * Refactor AuthorService to use IMessageService for error messages * Refactor UserService to utilize IMessageService for error messages * Remove AuthorMessage static class and its error constants * Remove ErrorMessageAuthenticationStatic class and its error constants * Add embedded resource and designer support for Messages Added an `<ItemGroup>` to the project file to include an embedded resource for `Messages.resx` and a compile entry for `Messages.Designer.cs`. This enables processing of the resource file by the `PublicResXFileCodeGenerator` and configures properties for design-time support and auto-generation of the designer file. * Update validation messages in category view models Refactor `CreateCategoryVM` and `UpdateCategoryVM` to use resource-based error messages for validation attributes. Added `using Refhub.Resources` and replaced hardcoded strings with `ErrorMessageResourceType` and `ErrorMessageResourceName` for improved localization support and consistency in error messaging. * Refactor validation in LoginVM and RegisterVM Updated validation attributes to use resource-based error messages for better localization. Changed Email, Password, and ConfirmPassword properties to use the 'required' keyword to enforce mandatory fields. * Enhance services with IMessageService for error handling Updated `KeywordService` to inject `IMessageService` for dynamic error messages. Refactored user not found error handling in `UserService` to utilize the same service, improving localization and message management. * Update validation for keyword properties Refactor the `Word` property validation in `CreateKeywordVM` and `EditKeywordVM` to use resource localization. Replace hardcoded Persian error messages with references to the `Messages` class for improved internationalization and maintainability. * Add localized strings for user input validation This commit introduces new localized string resources in the `Messages.Designer.cs` file, along with corresponding entries in the `Messages.fa.resx` and `Messages.resx` files. The added properties provide error messages and prompts for user input, including password confirmation, email validation, and category descriptions, improving user feedback in both Persian and English. * Remove obsolete migration files for fix-mig * Add migration to create unique index on Book Slug and modify column type * Add localized strings for book validation and fix typos in existing messages * Refactor namespace and remove unused using directives in MultiLanguageExtentionMethod * Remove unused using directive for Refhub_Ir.Tools.ExtentionMethod in Program.cs * Remove unused TestMessage action from LanguageController * Improve error handling in AddToRoleForUserInAdminPanelAsync and update validation message for duplicate email in Register * Fix error message for existing keyword check in AddKeywordAsync * Fix typo in error message for undefined author in GetAllAuthorsBooksAsync * Update password validation regex to allow special characters and extend length to 6-64 characters * Update password regex to allow special characters and extend length to 6-64 characters * Refactor UpdateBookVM validation attributes for Slug and AnotherId properties * Enhance CreateBookVM validation attributes for Slug and AnotherId properties * Fix method name casing for Persian and English actions in LanguageController * Fix MinLength validation for AnotherId property in CreateBookVM * Fix MinLength validation for AnotherId property in UpdateBookVM * Make Slug column nullable in Books table migration * Add IsDelete property to Book model for soft delete functionality * Add filter for Slug index to support soft delete functionality * Add IsDelete column to Books table for soft delete functionality * Fix typo in filter condition for Slug index in BookConfiguration * Add filter to Slug index in Books table to support soft delete functionality * Add IsDelete property to Book entity and update Slug index filter for soft delete functionality * Remove migration files for IsDelete column and Slug index filter updates * Add IsDeleted column and update Slug index filter for soft delete functionality in Books table * Fix IsDelete property name to IsDeleted in Book model and update Slug index filter accordingly * Rename IsDelete property to IsDeleted and update Slug index filter accordingly * Rename Book_Title_CategoryRequired to Category_NameRequired in resource files for consistency * Fix LanguageController class declaration syntax * Remove unused System.Configuration namespace from BookConfiguration.cs * Initialize AnotherId list in UpdateBookVM to prevent null reference issues * Rename error message resource for Name property in CreateCategoryVM for consistency * Rename error message resource for Name property in UpdateCategoryVM for consistency * Fix typo in namespace reference for ExtensionMethod in Program.cs * Fix typo in namespace reference for ExtensionMethod in Index.cshtml * Fix typo in namespace reference for ExtensionMethod in Update.cshtml * Fix typo in namespace reference for ExtensionMethod in BestBookView.cshtml * Fix typo in namespace reference for ExtensionMethod in LastBookView.cshtml * Refactor cookie options in LanguageController to improve security settings * Initialize AnotherId list in CreateBookVM to prevent null reference issues * Add MaxLength validation to Name and Slug properties in CreateCategoryVM * Add MaxLength validation to Name and Slug properties in UpdateCategoryVM * Fix password regex to ensure no whitespace is allowed * Fix typos in localized string resource names and add new strings for slug validation * Fix localization string names and add max length validation messages for Name and Slug * Fix localization string names and add max length validation messages for Name and Slug * Refactor AuthorService to improve error handling and author name formatting * Improve keyword existence check by using collation and fix error message casing * Refactor error handling in Register method to simplify duplicate user validation * Add DuplicateSlugException and EntityNotFoundException classes for improved error handling * Fix namespace spelling in AddServiceExtentionMethod to ensure consistency * Fix namespace spelling in ContextConfigureExtentionMethod for consistency * Fix namespace spelling in CookieConfigureExtentionMethod for consistency * Fix namespace spelling in IdentityConfigureExtentionMethod for consistency * Fix namespace spelling in MultiLanguageExtensionMethod for consistency * Fix namespace spelling in PathExtionMethod for consistency * Fix namespace spelling in BookDetails for consistency * Fix namespace spelling in List.cshtml for consistency * Fix generator name in Refhub.csproj for consistency * Fix regular expression for password validation in RegisterVM.cs * Change access modifiers of Messages class members to internal for encapsulation * Update Persian resource strings for clarity and consistency * Rename "Keyword_Found" to "Keyword_AlreadyExists" for clarity in Messages.resx * Refactor AuthorFullName assignment to handle empty names and improve error handling * Rename exception message from "Keyword_Found" to "Keyword_AlreadyExists" for clarity * Add AcceptLanguageHeaderRequestCultureProvider for browser language support * Update ci.yml (#100) (#102) * Remove unused service references from LanguageController * Refactor AuthorService: clean up using directives and enhance book view model with title and image path * Throw DuplicateKeywordException instead of generic Exception in AddKeywordAsync * Add DuplicateKeywordException for handling duplicate keyword errors * Remove unused EntityNotFoundException from DuplicateSlugException.cs * Add EntityNotFoundException class for handling entity not found errors --------- Co-authored-by: mohammad mehdi khodabande <mmahdikhodabande@gmail.com> Co-authored-by: Hootan Hemmati <hootanhemmati@outlook.com>
* add model s3Configure
* bind appsetting to model s3
* add configure s3 to appsetting
* use bind model to appsetting
* add migration to update Slug column type and create unique index on Books table
* add duplicate PackageReference for AWSSDK.S3 in project file
* add DirectoryTypes enum to define file categories
* refactor FolderNameStatic to use GetDirectoryName method for directory name retrieval
* fix: correct method name and parameter in IFileUploaderService interface
* fix: correct method name from UpdloadFile to UploadFile in LocalFileUploaderService
* feat: implement S3FileUploaderService for file upload and deletion using AWS S3
* fix: simplify ConvertForBookPathImage and ConvertForBookPathFile methods to return input directly
* fix: update IFileUploaderService to use S3FileUploaderService instead of LocalFileUploaderService
* fix: correct method name from UpdloadFile to UploadFile and simplify file deletion logic in BookService
* Fix formatting in Refhub.csproj
Updated the `<Project Sdk="Microsoft.NET.Sdk.Web">` line to include a leading space for consistency. No functional changes were made to the project structure.
* Enhance BookController for S3 file downloads
- Added IFileUploaderService dependency to BookController.
- Updated DownloadFile method to use file name in route.
- Implemented error handling for file download failures.
- Added [Authorize] attribute to DownloadFile method.
- Removed unused local file path handling code.
* Remove associated BookAuthors on Book deletion
Updated the `BookService` class to remove related `BookAuthors` when a `Book` is deleted. This change ensures referential integrity by preventing orphaned `BookAuthors` in the database.
* Add DownloadFileAsync method to S3FileUploaderService
This commit introduces a new asynchronous method `DownloadFileAsync` in the `S3FileUploaderService` class. The method allows for downloading files from an S3 bucket using a specified `fileName`. It handles the creation of a `GetObjectRequest`, retrieves the file, and returns it as a `MemoryStream`. Additionally, it includes error handling for potential `AmazonS3Exception` cases, providing a clear error message if the file is not found or the key is incorrect.
* Add DownloadFileAsync method to IFileUploaderService
Introduced a new method `DownloadFileAsync` in the
`IFileUploaderService` interface for asynchronous file
download functionality, accepting a `string fileName`
parameter and returning a `Task<Stream>`.
* Add UserSecretsId and secure AWS credentials
- Added `<UserSecretsId>` to `Refhub.csproj` for user secrets management.
- Updated `appsettings.Development.json` to remove hardcoded AWS `AccessKey` and `SecretKey`, replacing them with empty strings for improved security.
* Add cascade delete to BookAuthor foreign keys
Implement cascade delete behavior for BookId and AuthorId
in BookAuthorConfiguration to ensure related entries are
automatically removed when a Book or Author is deleted.
* Enhance BookService with file uploads and deletion logic
Updated the `BookService` class to support file uploads for both book files and images using `IFileUploaderService`. Added validation for upload paths.
Improved the book deletion method to load and remove related `BookAuthors` and `BookRelations`, ensuring all associated entities are handled correctly during deletion.
* Update S3 URL generation logic in S3FileUploaderService
Modified the `GenerateS3Url` method to change the URL format from `https://{_bucketName}.{_region}/{key}` to `https://{_region}/{_bucketName}.{_region}/{key}`. This adjustment accommodates a new URL structure for accessing resources, likely due to a change in cloud provider or service configuration.
* Add S3 support and improve error handling in BookController
- Updated using directives to include Amazon.S3 for S3 interactions.
- Modified BookController constructor to include ILogger for logging.
- Simplified content type assignment in DownloadFile method.
- Added specific catch block for AmazonS3Exception with logging.
- Enhanced generic exception handling for better user feedback.
* Comment out Book entity configuration in BookAuthor
This commit removes the configuration for the `Book` entity's relationship with the `BookAuthor` entity in `BookAuthorConfiguration.cs`. The foreign key relationship and delete behavior for the `Book` entity have been commented out, while the configuration for the `Author` entity remains intact.
* Refactor S3FileUploaderService URL handling
Updated S3FileUploaderService to improve URL generation and key extraction.
- Adjusted class definition formatting for consistency.
- Modified GenerateS3Url to use ServiceURL from _s3Options.
- Added GetKey method for extracting keys from URLs.
- Reformatted UploadFile key generation for clarity.
- Updated DeleteFile to utilize the new GetKey method.
* Enhance file download handling in BookController
- Added Microsoft.AspNetCore.StaticFiles namespace for content type handling.
- Updated DownloadFile method to include CancellationToken for better async control.
- Implemented content type determination based on file extension, defaulting to "application/octet-stream" if unknown.
- Maintained existing error logging for S3 download exceptions.
* Enhance LocalFileUploaderService functionality
- Added `_rootPath` for improved file path management.
- Updated `UploadFile` to use `_rootPath` and generate unique file names.
- Implemented asynchronous file saving with `CopyToAsync`.
- Refactored `DeleteFile` to accept a `realUrl` parameter.
- Introduced `DownloadFileAsync` for asynchronous file downloads with error handling.
Enhance LocalFileUploaderService functionality
- Added `_rootPath` for improved file path management.
- Updated `UploadFile` to use `_rootPath` and generate unique file names.
- Implemented asynchronous file saving with `CopyToAsync`.
- Simplified `DeleteFile` method to accept a single `realUrl` parameter.
- Introduced `DownloadFileAsync` for handling file downloads.
- Added comments in Persian for clarity on directory creation and file handling.
* Update IFileUploaderService: Modify DownloadFileAsync
The `DownloadFileAsync` method now includes a `CancellationToken ct` parameter, updating its signature to `Task<Stream> DownloadFileAsync(string fileName, CancellationToken ct)`. The previous version of the method has been removed from the interface.
* Remove default case for unsupported directory types
The switch expression in FolderNameStatic.cs has been updated to remove the default case that returned the string "Order" for unsupported directory types. It now throws an `ArgumentOutOfRangeException` with a descriptive message when an unsupported type is encountered.
* Update S3Configuration for immutability and validation
Refactor the `S3Configuration` class to use C# 9.0's `init` accessor for properties, ensuring immutability after initialization. Add `[Required]` attributes to enforce mandatory fields, and change the `ServiceURL` property to be nullable. Include comments for clarity on the class's purpose related to AWS S3 configuration.
* Remove DownloadFileAsync method from IFileUploaderService
The `DownloadFileAsync` method has been removed from the `IFileUploaderService` interface in `IFileUploaderService.cs`. This method previously facilitated asynchronous file downloads using a file name and a cancellation token.
* Add cancellation support to DownloadFileAsync method
- Introduced `using System.Threading;` for cancellation tokens.
- Modified `DownloadFileAsync` to accept a `CancellationToken`.
- Updated S3 file download and stream copy operations to support cancellation.
* Enhance DownloadFileAsync with CancellationToken support
Updated the DownloadFileAsync method in LocalFileUploaderService to include a CancellationToken parameter, enabling cancellation of file download operations. The method now returns a Task<Stream> to provide the downloaded file stream.
* Fix CI (#103)
* Remove final report generation step from CI workflow
* Update ci.yml (#100)
* update confilict Migration IX_Books_Slug on Add UniqueIndexToBookSlugAndModifyType
* add namespace ExtensionMethod
* remove namespace ExtensionMethod
* move to secret.josn
* remove unuse namespace
* convert internal to public message resource
* add SaveChangesAsync on CreateAnotherAsync
* merg namespace
* PublicResXFileCodeGenerator
* remove unuse namepace
* fix PublicResXFileCodeGeneratorTargets
* add BucketNameStatic.GetName
* add enum BucketNames
* update namespace
* update IFileUploaderService
* add BucketNameStatic
* use BucketNameStatic.GetName on bookService
* use bucketName by paramtr
* add ILogger<BookController>
* add AnyAsync book Service
* update RegionEndpoint for s3
* change name BindAppSettingToModelExtensionMethod
* remove pathExtensionMethod
* use _messageService
* remove comment code
* refactor GetKey code on S3
* add FileDownloadException
* add message DownloadError,InvalidFileName,FileNotFound
* rename parameter
* add resource for ImagePath on updateBookvm
* add message Book_ImagePathMustBeUrl
* fix name action DownloadFile
* update resource message for ImagePath updatebookVm
* Update Refhub/Tools/Static/BucketNameStatic.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* use condition for imagePath
* update AWSSDK.S3 4.0.4.2
* use FileDownloadException
* update BookAuthorConfiguration
* add sqlQuery
* convert englishMessage
* update S3FileUploaderService for download by MemoryStream
* update
* update
* 🐛 fix(book): resolve file download issues and improve error handling
- fix invalid file name check for download functionality
- enhance file download process with url parameter
- improve error handling and logging during file downloads
* 🐛 fix(book): prevent duplicate author creation
- check for existing author slug before creating a new author
- return false if the slug already exists
* 🐛 fix(file): handle file not found exception correctly
- change exception from FileNotFoundException to FileDownloadException with inner exception
- improve error handling when file does not exist during download
* 🐛 fix(file): correct parameter name in DownloadFileAsync
- correct the parameter name from fileName to fileUrl in the DownloadFileAsync method
* 🐛 fix(book): fix download file url parameter
- fix the parameter name in the download url from fileName to fileUrl
* 🐛 fix(uploader): correct file path for local uploader
- fix the file path returned by the local file uploader service
- the path was only returning the file name, not the full path
- now returns the full path, combining directory and filename
* ♻️ refactor(upload): remove local file uploader service
- remove local file uploader service and related files
* 🐛 fix(s3): correct file download logic
- fix the DownloadFileAsync method to correctly retrieve files from S3
- use the GetKey method to extract the key from the file URL
- ensure bucket name is not null or empty
* ⚡️ perf(book): optimize book retrieval query
- remove unnecessary inclusion of BookAuthors navigation property
- improve query performance by fetching only required data
* 🐛 fix(data): cascade delete behavior in BookAuthorConfiguration
- configure cascade delete behavior for BookAuthor entity
- prevent orphaned records when deleting books or authors
* 🐛 fix(data): cascade delete related books
- fix issue where related books were not being deleted when a book was deleted
- configure cascade delete behavior for both RelatedTo and RelatedFrom relationships
* 🐛 fix(s3): enforce non-nullable bucket name for s3 operations
- ensure bucketName parameter is not nullable in DeleteFile and DownloadFileAsync methods
- throw ArgumentException if bucketName is null or empty
* ♻️ refactor(fileUploader): standardize parameter naming for file storage
- rename directoryName parameter to bucketName for clarity
- ensure consistency in file storage parameter naming
* 🐛 fix(book): resolve download link issue in book details view
- correct parameter name from 'filePath' to 'fileUrl' in DownloadFile action link
- ensure proper file download functionality for related books
* 🐛 fix(book): remove duplicate download endpoint
- removed duplicate HttpGet attribute for the download endpoint
* 🐛 fix(s3): set uploaded file ACL to private
- set uploaded file ACL to private to prevent unauthorized access
* 🐛 fix(data): prevent cascade delete for related books
- prevent cascade delete when deleting a book to avoid unintended data loss
- restrict delete behavior for both RelatedTo and RelatedFrom relationships
* ♻️ refactor(s3): remove unused bucket name assignment
- remove commented-out line assigning bucket name
- this line was unnecessary and did not affect functionality
* ♻️ refactor(s3): remove bucket name validation
- remove bucket name validation from DeleteFile and DownloadFileAsync methods
- simplify the logic
* 💄 style(managebook): improve image display logic in update view
- refine conditional statement for image display
- ensure consistent code style for better readability
* ♻️ refactor(upload): simplify s3 file upload method
- remove directoryName parameter and use bucketName directly
- improve code readability and maintainability
* 🔥 chore(static): remove FolderNameStatic class
- remove FolderNameStatic class
- the class is no longer needed
* 🐛 fix(book): validate file URL before download
- add IsValidFileUrl method to check file URL validity
- return NotFound if file URL is invalid
* ✨ feat(validation): add validation scripts partial view
- enable client-side validation in admin area
- include jquery, jquery-validation, and jquery-validation-unobtrusive libraries
* 🐛 fix(BookService): handle exceptions during author creation
- add a try-catch block around SaveChangesAsync to catch and log exceptions
- rethrow the exception to ensure it's handled upstream
* ✨ feat(managebook): add validation scripts partial
- implement client-side validation for manage book form
* 🐛 fix(book): correct file URL validation logic
- fix the condition in IsValidFileUrl to properly validate file URLs
- ensure that the file URL is not null or whitespace and is a valid absolute URI
* 🐛 fix(S3FileUploader): add validation for fileUrl and bucketName
- add validation for fileUrl and bucketName to prevent empty values
- throw ArgumentException if fileUrl or bucketName is null or empty
---------
Co-authored-by: abolfazlshs80 <abolfazlshs80@gmail.com>
Co-authored-by: Hootan Hemmati <hootanhemmati@outlook.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* add AuthorData.xlsx to SeedData Foulder * Move Seed Data foulder to main root project * create foulder to write class * create ExcelSeeder class * design and write ExcelSeeder class * create and design Seed Data Configuration in Program File * Apply changes * add migration * add migration * snapahot updated * apply changes * apply changes and install Package EPPlus version 5.8.3 * Add Book Data Excel file * add comment to ReadAuthorsFromExcel Method * add comment to ReadBooksFromExcel Method * create ReadBooksFromExcel Method * This class is designed to separate configurations in the program. * Rename * Rename class * add Authors and Books Configuration * add SeedInitialData to Program * add AuthorBook Data in excel file * seed log * add Book Keyword wxcel file * add book relation excel file * add category excel file * add keyword excel file * add ReadKeywordFromExcel method * add ReadCategoryFromExcel Method * add ReadBookRelationFromExcel method * add ReadBookKeywordFromExcel Method * Apply changes * Updata solution * update class * add comment for authors * add comment for Book * add AuthorBook Initial * add BookKeyword initial * book relational initial * add All Initialize * Update ci.yml (#100) (#104) * Fix Bug File DataSeeder And ExcelSeeder * Update Namespace * Enhance data seeding with error handling and logging - Added error handling in `DataSeeder.cs` to log exceptions and prevent duplicate entries during seeding. - Improved data reading methods in `ExcelSeeder.cs` with file existence checks and better error handling. - Created new `Authors` and `BookAuthors` tables in the migration file `20250616145440_AddAuthorTable.cs`. - Updated `Program.cs` to include error handling for initial data seeding. - Added `EPPlus` package reference in `Refhub.csproj` for Excel file operations. - Revised `seed-log.txt` to improve logging format and detail. --------- Co-authored-by: Hootan Hemmati <hootanhemmati@outlook.com> Co-authored-by: Mohammad Faraji <m.faraji9841@gmail.com>
Summary by CodeRabbit