A bunch of different tasks related to the admin page#2556
A bunch of different tasks related to the admin page#2556Michael-Kolpakov wants to merge 8 commits into
Conversation
…handlers so that they can support pagination
|
Note Reviews pausedUse the following commands to manage reviews:
WalkthroughThis pull request standardizes the naming conventions by renaming DTO types (e.g., from PartnerDTO to PartnerDto, StreetcodeShortDTO to StreetcodeShortDto, and TermDTO to TermDto) and removes obsolete classes. New DTOs supporting paginated responses have been introduced for partners, streetcodes, and terms. In addition, mapping configurations, MediatR handlers/queries, and controller endpoints were updated to use these new types. The GetAllPartnersHandler now integrates a blob service to fetch base64 logo images, and corresponding tests and mocks were updated throughout the solution. Changes
Sequence Diagram(s)sequenceDiagram
participant C as Client
participant PC as PartnersController
participant GH as GetAllPartnersHandler
participant PR as PartnerRepository
participant BS as BlobService
participant M as Mapper
C->>PC: GET /partners
PC->>GH: Forward request
GH->>PR: Query partners (with pagination)
PR-->>GH: Return partner entities
loop For each partner with logo
GH->>BS: Retrieve base64 logo
BS-->>GH: Return logo data
end
GH->>M: Map entities to PartnerDto
M-->>GH: Mapped PartnerDto list
GH-->>PC: Return GetAllPartnersDto
PC-->>C: Response with partners and logos
Poem
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
Documentation and Community
|
|
@coderabbitai ignore |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (17)
Streetcode/Streetcode.BLL/MediatR/Partners/Update/UpdatePartnerQuery.cs (1)
8-9: Consider adding XML documentation.Adding XML documentation comments to this record would improve code maintainability and make it easier for other developers to understand the purpose of this query and its parameters:
/// <summary> /// Query to update an existing partner. /// </summary> /// <param name="Partner">The partner data to update.</param> public record UpdatePartnerQuery(UpdatePartnerDTO Partner) : IRequest<Result<PartnerDto>>;Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetShortById/GetStreetcodeShortByIdHandler.cs (1)
38-38: Consider updating the localization key for consistency.While the DTO class name has been updated throughout the code, the localization key
"CannotMapStreetcodeToShortDTO"still uses the old "DTO" suffix. For complete consistency, consider updating this key to"CannotMapStreetcodeToShortDto"as well.Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllShort/GetAllStreetcodesShortQuery.cs (1)
7-8: Good implementation of pagination support and standardized namingThe addition of optional pagination parameters (
pageandpageSize) to the query is a solid enhancement that improves scalability for retrieving streetcodes. The updated return type toGetAllStreetcodesShortDtoproperly supports paginated responses by providing both the collection of streetcodes and the total count in a single response.I'd recommend adding XML documentation comments to describe the purpose and constraints of these parameters. For example:
/// <summary> /// Query to retrieve streetcodes in a short format, with optional pagination support. /// </summary> /// <param name="page">The page number to retrieve (1-based). If null, pagination is not applied.</param> /// <param name="pageSize">The number of items per page. If null, pagination is not applied.</param> public record GetAllStreetcodesShortQuery(ushort? page = null, ushort? pageSize = null) : IRequest<Result<GetAllStreetcodesShortDto>>;Streetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Streetcode/GetAllPublishedHandlerTests.cs (1)
37-37: Consider updating test method name for complete consistency.While the code itself has been updated to use
StreetcodeShortDto, the test method name still contains "DTOs" inHandle_WhenPublishedStreetcodesExist_ReturnsStreetcodeShortDTOs. For absolute consistency, you might want to update this toHandle_WhenPublishedStreetcodesExist_ReturnsStreetcodeShortDtos.Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllPublished/GetAllPublishedHandler.cs (4)
13-15: DTO Naming and Consistency Check
The method signature now returnsResult<IEnumerable<StreetcodeShortDto>>, which aligns with the standardized naming conventions (e.g., fromStreetcodeShortDTOtoStreetcodeShortDto). Ensure that all related mapping configurations and references throughout the project have been updated consistently.
33-34: Updated Handle Method Signature
TheHandlemethod's signature correctly reflects the new DTO type. However, note that thecancellationTokenparameter provided to this method is not utilized later. Consider passing it to any asynchronous operations (if supported by the repository) to enable proper cancellation handling.
35-36: Consider Propagating Cancellation Tokens
The asynchronous call to retrieve streetcodes (GetAllAsync) does not receive the providedcancellationToken. If your repository supports cancellation, updating the call to pass the token can help with more graceful shutdowns during long-running operations. For example:-var streetcodes = await _repositoryWrapper.StreetcodeRepository.GetAllAsync( - predicate: sc => sc.Status == DAL.Enums.StreetcodeStatus.Published); +var streetcodes = await _repositoryWrapper.StreetcodeRepository.GetAllAsync( + predicate: sc => sc.Status == DAL.Enums.StreetcodeStatus.Published, + cancellationToken);
45-45: Consistent Mapping Configuration
The mapping operation_mapper.Map<IEnumerable<StreetcodeShortDto>>(streetcodes)properly converts the retrieved entities into the new DTO type. Double-check that the AutoMapper profile forStreetcodeShortDtois fully configured to handle all necessary property transformations.Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllShort/GetAllStreetcodesShortHandler.cs (4)
36-36: Consider validating pagination parameters.The code now properly implements pagination by calling
GetAllPaginated, but there's no validation for thepageandpageSizeparameters from the request. Consider adding validation to ensure these values are positive numbers if provided.+ if (request.page.HasValue && request.page.Value <= 0) + { + var errorMsg = "Page number must be positive"; + _logger.LogError(request, errorMsg); + return Task.FromResult(Result.Fail<GetAllStreetcodesShortDto>(errorMsg)); + } + + if (request.pageSize.HasValue && request.pageSize.Value <= 0) + { + var errorMsg = "Page size must be positive"; + _logger.LogError(request, errorMsg); + return Task.FromResult(Result.Fail<GetAllStreetcodesShortDto>(errorMsg)); + } + var paginatedStreetcodesShort = _repositoryWrapper.StreetcodeRepository.GetAllPaginated(request.page, request.pageSize);
51-51: Consider making the handler method async.While
Task.FromResultis suitable for synchronous code, if the repository method is or could potentially be async in the future, consider making this handler method async as well for better performance and scalability.- public Task<Result<GetAllStreetcodesShortDto>> Handle( + public async Task<Result<GetAllStreetcodesShortDto>> Handle( GetAllStreetcodesShortQuery request, CancellationToken cancellationToken) { var paginatedStreetcodesShort = _repositoryWrapper.StreetcodeRepository.GetAllPaginated(request.page, request.pageSize); if (!paginatedStreetcodesShort.Entities.Any()) { var errorMsg = _stringLocalizerNo["NoStreetcodesExistNow"].Value; _logger.LogError(request, errorMsg); - return Task.FromResult(Result.Fail<GetAllStreetcodesShortDto>(errorMsg)); + return Result.Fail<GetAllStreetcodesShortDto>(errorMsg); } var getAllStreetcodeShortDto = new GetAllStreetcodesShortDto() { TotalAmount = paginatedStreetcodesShort.TotalItems, StreetcodesShort = _mapper.Map<IEnumerable<StreetcodeShortDto>>(paginatedStreetcodesShort.Entities), }; - return Task.FromResult(Result.Ok(getAllStreetcodeShortDto)); + return Result.Ok(getAllStreetcodeShortDto); }
38-38: Add null check for repository results.Consider adding a null check before accessing
paginatedStreetcodesShort.Entitiesto prevent potential null reference exceptions if the repository method fails unexpectedly.- if (!paginatedStreetcodesShort.Entities.Any()) + if (paginatedStreetcodesShort == null || !paginatedStreetcodesShort.Entities.Any())
45-51: Consider adding success logging.The code logs errors when no entities are found, but consider also adding informational logging for successful operations to help with debugging and monitoring.
var getAllStreetcodeShortDto = new GetAllStreetcodesShortDto() { TotalAmount = paginatedStreetcodesShort.TotalItems, StreetcodesShort = _mapper.Map<IEnumerable<StreetcodeShortDto>>(paginatedStreetcodesShort.Entities), }; + _logger.LogInformation(request, $"Successfully retrieved {paginatedStreetcodesShort.Entities.Count()} streetcodes out of {paginatedStreetcodesShort.TotalItems} total"); return Task.FromResult(Result.Ok(getAllStreetcodeShortDto));Streetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Streetcode/GetStreetcodeShortByIdHandlerTests.cs (2)
36-38: Consider updating method name for consistencyThe method name still references "StreetcodeShortDTO" while the implementation now uses "StreetcodeShortDto". For better maintainability, consider updating the method name to match the new naming convention.
- public async Task Handle_WhenStreetcodeExists_ReturnsStreetcodeShortDTO() + public async Task Handle_WhenStreetcodeExists_ReturnsStreetcodeShortDto()
64-65: Update error key to match new naming conventionThe error key still uses the old "DTO" suffix. Consider updating it to maintain consistency with the new naming convention throughout the codebase.
- const string expectedErrorKey = "CannotMapStreetcodeToShortDTO"; + const string expectedErrorKey = "CannotMapStreetcodeToShortDto";Streetcode/Streetcode.BLL/Mapping/Partners/PartnerProfile.cs (1)
15-19: Consider updating remaining DTO names for complete consistencyWhile the
PartnerDtohas been updated, other DTOs in this file (likeCreatePartnerDTO,UpdatePartnerDTO, etc.) still use the uppercase "DTO" suffix. For complete consistency, consider updating these in a future PR.Streetcode/Streetcode.BLL/Mapping/Streetcode/StreetcodeProfile.cs (1)
16-66: Consider updating all DTO naming for complete consistencyWhile
StreetcodeShortDtohas been updated, other DTOs in this file still use the uppercase "DTO" suffix (StreetcodeDTO, StreetcodeMainPageDTO, StreetcodeCreateDTO, StreetcodeUpdateDTO). To achieve full consistency across the codebase, consider updating these in a follow-up PR.Streetcode/Streetcode.XUnitTest/MediatRTests/Partners/DeletePartnerTest.cs (1)
111-114: Consider updating method name for complete consistency.While the method now correctly returns
PartnerDtoinstead ofPartnerDTO, I notice the method name still uses uppercase "DTO". Consider renaming the method toGetPartnerDto()to fully align with the standardized naming convention.-private static PartnerDto GetPartnerDTO() +private static PartnerDto GetPartnerDto() { return new PartnerDto(); }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (66)
Streetcode/Streetcode.BLL/DTO/Partners/GetAllPartnersDto.cs(1 hunks)Streetcode/Streetcode.BLL/DTO/Partners/GetAllPartnersResponseDTO.cs(0 hunks)Streetcode/Streetcode.BLL/DTO/Partners/PartnerCreateUpdateDto.cs(1 hunks)Streetcode/Streetcode.BLL/DTO/Partners/PartnerDto.cs(1 hunks)Streetcode/Streetcode.BLL/DTO/Streetcode/GetAllStreetcodesShortDto.cs(1 hunks)Streetcode/Streetcode.BLL/DTO/Streetcode/StreetcodeShortDTO.cs(0 hunks)Streetcode/Streetcode.BLL/DTO/Streetcode/StreetcodeShortDto.cs(1 hunks)Streetcode/Streetcode.BLL/DTO/Streetcode/TextContent/Term/GetAllTermsDto.cs(1 hunks)Streetcode/Streetcode.BLL/DTO/Streetcode/TextContent/Term/TermCreateDto.cs(1 hunks)Streetcode/Streetcode.BLL/DTO/Streetcode/TextContent/Term/TermDto.cs(1 hunks)Streetcode/Streetcode.BLL/DTO/Streetcode/TextContent/TermCreateDTO.cs(0 hunks)Streetcode/Streetcode.BLL/Mapping/Partners/PartnerProfile.cs(1 hunks)Streetcode/Streetcode.BLL/Mapping/Streetcode/StreetcodeProfile.cs(1 hunks)Streetcode/Streetcode.BLL/Mapping/Streetcode/TextContent/TermProfile.cs(2 hunks)Streetcode/Streetcode.BLL/MediatR/Partners/Create/CreatePartnerHandler.cs(3 hunks)Streetcode/Streetcode.BLL/MediatR/Partners/Create/CreatePartnerQuery.cs(1 hunks)Streetcode/Streetcode.BLL/MediatR/Partners/Delete/DeletePartnerHandler.cs(3 hunks)Streetcode/Streetcode.BLL/MediatR/Partners/Delete/DeletePartnerQuery.cs(1 hunks)Streetcode/Streetcode.BLL/MediatR/Partners/GetAll/GetAllPartnersHandler.cs(1 hunks)Streetcode/Streetcode.BLL/MediatR/Partners/GetAll/GetAllPartnersQuery.cs(1 hunks)Streetcode/Streetcode.BLL/MediatR/Partners/GetById/GetPartnerByIdHandler.cs(3 hunks)Streetcode/Streetcode.BLL/MediatR/Partners/GetById/GetPartnerByIdQuery.cs(1 hunks)Streetcode/Streetcode.BLL/MediatR/Partners/GetByIsKeyPartner/GetPartnersByIsKeyPartnerHandler.cs(3 hunks)Streetcode/Streetcode.BLL/MediatR/Partners/GetByIsKeyPartner/GetPartnersByIsKeyPartnerQuery.cs(1 hunks)Streetcode/Streetcode.BLL/MediatR/Partners/GetByStreetcodeId/GetPartnersByStreetcodeIdHandler.cs(3 hunks)Streetcode/Streetcode.BLL/MediatR/Partners/GetByStreetcodeId/GetPartnersByStreetcodeIdQuery.cs(1 hunks)Streetcode/Streetcode.BLL/MediatR/Partners/GetToUpdateByStreetcodeId/GetPartnersToUpdateByStreetcodeIdHandler.cs(3 hunks)Streetcode/Streetcode.BLL/MediatR/Partners/GetToUpdateByStreetcodeId/GetPartnersToUpdateByStreetcodeIdQuery.cs(1 hunks)Streetcode/Streetcode.BLL/MediatR/Partners/Update/UpdatePartnerHandler.cs(3 hunks)Streetcode/Streetcode.BLL/MediatR/Partners/Update/UpdatePartnerQuery.cs(1 hunks)Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllPublished/GetAllPublishedHandler.cs(3 hunks)Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllPublished/GetAllPublishedQuery.cs(1 hunks)Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllShort/GetAllStreetcodesShortHandler.cs(2 hunks)Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllShort/GetAllStreetcodesShortQuery.cs(1 hunks)Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetShortById/GetStreetcodeShortByIdHandler.cs(2 hunks)Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetShortById/GetStreetcodeShortByIdQuery.cs(1 hunks)Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Create/CreateTermCommand.cs(1 hunks)Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Create/CreateTermHandler.cs(3 hunks)Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/GetAll/GetAllTermsHandler.cs(2 hunks)Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/GetAll/GetAllTermsQuery.cs(1 hunks)Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/GetById/GetTermByIdHandler.cs(3 hunks)Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/GetById/GetTermByIdQuery.cs(1 hunks)Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Update/UpdateTermCommand.cs(1 hunks)Streetcode/Streetcode.WebApi/Controllers/Partners/PartnersController.cs(4 hunks)Streetcode/Streetcode.WebApi/Controllers/Streetcode/StreetcodeController.cs(2 hunks)Streetcode/Streetcode.WebApi/Controllers/Streetcode/TextContent/TermController.cs(3 hunks)Streetcode/Streetcode.XIntegrationTest/ControllerTests/Partners/PartnersControllerTests.cs(3 hunks)Streetcode/Streetcode.XIntegrationTest/ControllerTests/Streetcode/StreetcodeQueriesControllerTests.cs(4 hunks)Streetcode/Streetcode.XIntegrationTest/ControllerTests/Streetcode/TextContent/TermControllerTests.cs(8 hunks)Streetcode/Streetcode.XIntegrationTest/ControllerTests/Utils/BeforeAndAfterTestAtribute/Streetcode/TextContent/Terms/ExtractCreateTestTermAttribute.cs(2 hunks)Streetcode/Streetcode.XIntegrationTest/ControllerTests/Utils/BeforeAndAfterTestAtribute/Streetcode/TextContent/Terms/ExtractUpdateTestTermAttribute.cs(2 hunks)Streetcode/Streetcode.XIntegrationTest/ControllerTests/Utils/Client/StreetCode/TextContent/TermClient.cs(2 hunks)Streetcode/Streetcode.XUnitTest/MediatRTests/Partners/CreatePartnerTest.cs(5 hunks)Streetcode/Streetcode.XUnitTest/MediatRTests/Partners/DeletePartnerTest.cs(3 hunks)Streetcode/Streetcode.XUnitTest/MediatRTests/Partners/GetAllPartnersTest.cs(3 hunks)Streetcode/Streetcode.XUnitTest/MediatRTests/Partners/GetParnerByStreetcodeIdTest.cs(5 hunks)Streetcode/Streetcode.XUnitTest/MediatRTests/Partners/GetPartnerByIdTest.cs(5 hunks)Streetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Streetcode/GetAllPublishedHandlerTests.cs(2 hunks)Streetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Streetcode/GetAllStreetcodesShortHandlerTests.cs(2 hunks)Streetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Streetcode/GetStreetcodeShortByIdHandlerTests.cs(3 hunks)Streetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Terms/CreateTermTest.cs(5 hunks)Streetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Terms/GetAllTermsTest.cs(2 hunks)Streetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Terms/GetTermByIdTest.cs(4 hunks)Streetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Terms/UpdateTermTest.cs(3 hunks)Streetcode/Streetcode.XUnitTest/Mocks/MockHelpers.cs(2 hunks)Streetcode/Streetcode.XUnitTest/Validators/Partner/BasePartnersValidatorTests.cs(1 hunks)
💤 Files with no reviewable changes (3)
- Streetcode/Streetcode.BLL/DTO/Streetcode/TextContent/TermCreateDTO.cs
- Streetcode/Streetcode.BLL/DTO/Streetcode/StreetcodeShortDTO.cs
- Streetcode/Streetcode.BLL/DTO/Partners/GetAllPartnersResponseDTO.cs
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Jenkins
🔇 Additional comments (156)
Streetcode/Streetcode.BLL/MediatR/Partners/GetById/GetPartnerByIdQuery.cs (1)
7-9: DTO Naming Convention Update VerifiedThe record now implements
IRequest<Result<PartnerDto>>, which aligns with the standardized naming conventions across the codebase. This update not only improves clarity but also maintains consistency with other handlers and DTO usages. Please ensure that all related MediatR handlers and tests have been updated to referencePartnerDtoin place of the old naming.Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetShortById/GetStreetcodeShortByIdQuery.cs (1)
7-8: Consistent Naming Update!The generic type parameter in the query record has been successfully updated from
StreetcodeShortDTOtoStreetcodeShortDto, aligning with the standardized naming conventions across the codebase. This change enhances clarity and uniformity in our DTO naming, which is essential for maintainability.Streetcode/Streetcode.BLL/MediatR/Partners/GetByStreetcodeId/GetPartnersByStreetcodeIdQuery.cs (1)
8-8: DTO Naming Convention UpdateThe updated line now uses
PartnerDtoinstead of the oldPartnerDTO, which aligns perfectly with our standardized naming conventions. This improves code clarity and consistency across the codebase. Please ensure that all related components and mappings are updated accordingly, and that corresponding tests verify the end-to-end integration.Streetcode/Streetcode.XIntegrationTest/ControllerTests/Utils/BeforeAndAfterTestAtribute/Streetcode/TextContent/Terms/ExtractCreateTestTermAttribute.cs (1)
2-2: Good job updating the naming convention from DTO to DtoThe changes to adopt a consistent naming convention from uppercase "DTO" to lowercase "Dto" align well with standard C# naming conventions. This improves code readability and maintains consistency across the codebase. All references to the type have been properly updated throughout the class.
Also applies to: 12-12, 16-16
Streetcode/Streetcode.BLL/MediatR/Partners/GetToUpdateByStreetcodeId/GetPartnersToUpdateByStreetcodeIdQuery.cs (1)
7-8: Consistent DTO Naming and Clean Record DeclarationThe update on line 8 correctly replaces the old
PartnerDTOwith the standardizedPartnerDto. This change aligns with our naming conventions across the codebase and helps ensure clarity when interacting with the MediatR pipeline. Additionally, the use of C# record classes here is a concise and effective approach for immutable query objects.Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllPublished/GetAllPublishedQuery.cs (1)
7-8: DTO Naming Convention UpdateThe change now uses
StreetcodeShortDtoin the query record instead ofStreetcodeShortDTO, aligning with our standardized naming convention. Please verify that all related handlers, mappings, and documentation reflect this update for consistency across the codebase.Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/GetById/GetTermByIdHandler.cs (1)
5-5: Clean naming convention updateThe changes correctly standardize the DTO naming from
TermDTOtoTermDtoacross import statements, class signatures, and method implementations. This consistent naming approach improves code readability and aligns with the PR's standardization objectives while preserving the handler's core functionality.Also applies to: 12-12, 31-31, 42-42
Streetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Terms/GetTermByIdTest.cs (1)
5-5: Excellent standardization of DTO naming conventions!The consistent renaming from
TermDTOtoTermDtoacross import statements, mapping verifications, type assertions, method signatures, and object instantiations aligns well with C# conventions where only the first letter of acronyms should be capitalized in PascalCase. This change enhances code consistency and readability throughout the codebase.This standardization matches the PR objective of addressing naming conventions, making the codebase more maintainable and professional.
Also applies to: 58-58, 77-77, 99-99, 105-105
Streetcode/Streetcode.BLL/MediatR/Partners/Update/UpdatePartnerQuery.cs (1)
9-9: Good naming convention update for consistency.The change from
PartnerDTOtoPartnerDtoaligns with modern C# naming conventions and creates consistency throughout the codebase. This type of standardization improves code readability and maintainability.For complete consistency, consider also updating
UpdatePartnerDTOon line 8 to follow the same pattern (UpdatePartnerDto), assuming this is part of the same standardization effort.Streetcode/Streetcode.BLL/MediatR/Partners/GetByIsKeyPartner/GetPartnersByIsKeyPartnerQuery.cs (1)
7-8: Consistent DTO Naming and Clean Query DefinitionThis change correctly updates the generic type parameter to use
PartnerDtoinstead of the obsoletePartnerDTO, which adheres to the new naming conventions across the codebase. The record-based query object is a modern and concise choice for representing immutable request data.Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetShortById/GetStreetcodeShortByIdHandler.cs (3)
12-12: Good standardization of DTO naming conventions.The renaming from
StreetcodeShortDTOtoStreetcodeShortDtoaligns with the broader effort to standardize naming conventions across the codebase, which improves consistency and readability.
31-31: Consistent return type update.The method's return type has been correctly updated to match the new DTO naming convention, maintaining consistency with the interface declaration.
34-34: Properly updated mapping operation.The mapping operation now correctly references the renamed DTO class, ensuring that the entire workflow uses the standardized naming convention.
Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/GetById/GetTermByIdQuery.cs (1)
3-3: Appropriate naming convention standardizationThe changes to the import namespace and the
TermDtotype name align with C# naming conventions where acronyms longer than two letters should be Pascal-cased rather than all uppercase. This standardization improves code readability and consistency across the project.The more specific namespace organization (
TextContent.Terminstead of justTextContent) also enhances code organization by properly grouping related DTO classes.Also applies to: 8-8
Streetcode/Streetcode.XUnitTest/MediatRTests/Partners/GetPartnerByIdTest.cs (6)
46-46: Consistent naming convention update for DTO classes.The renaming from
PartnerDTOtoPartnerDtoaligns with standard C# naming conventions for DTOs and brings consistency across the codebase. This change is part of a broader standardization effort visible throughout the PR.
86-86: Correct nullable DTO type update.The renaming from
PartnerDTO?toPartnerDto?properly maintains nullability while standardizing the DTO naming convention.
115-115: Consistent mapper configuration update.This instance of DTO renaming in the mapper configuration is consistent with the previous changes, ensuring that all mapper configurations use the standardized naming.
126-126: Updated assertion to use renamed DTO type.The assertion has been correctly updated to use the renamed
PartnerDtotype, ensuring the test verifies the correct type is returned.
142-144: Updated method return type and implementation to use standardized DTO naming.Both the method signature and implementation have been updated to use the renamed
PartnerDtoclass, maintaining consistency throughout the test class.
150-150: Updated nullable DTO return type in helper method.The helper method's return type has been properly updated to
PartnerDto?while maintaining the nullability, completing the consistent renaming across the entire class.Streetcode/Streetcode.BLL/MediatR/Partners/GetByIsKeyPartner/GetPartnersByIsKeyPartnerHandler.cs (1)
13-13: Consistent naming convention applied correctly.The change from
PartnerDTOtoPartnerDtoaligns with modern C# naming conventions where abbreviations longer than two letters should use proper casing (PascalCase for public members). This consistent renaming appears throughout the handler, including class declaration (line 13), method signature (line 28), and in the mapping operation (line 45).This standardization improves code readability and maintainability across the codebase, as it's consistent with similar changes in related handlers (e.g., GetPartnerByIdHandler, GetPartnersByStreetcodeIdHandler, etc.). The consistent naming approach helps reduce cognitive load when switching between different parts of the application.
Also applies to: 28-28, 45-45
Streetcode/Streetcode.BLL/MediatR/Partners/Update/UpdatePartnerHandler.cs (3)
11-11: Consistent DTO naming convention applied correctly.The class declaration has been updated to use the standardized
PartnerDtonaming convention instead ofPartnerDTO. This aligns with the project-wide effort to standardize DTO naming patterns.
24-24: Method signature updated to match standardized DTO naming.The return type in the method signature has been correctly updated to use
Result<PartnerDto>, maintaining consistency with the class declaration change.
68-68: Mapping operation updated to use standardized DTO type.The mapping operation has been properly updated to target the renamed
PartnerDtotype, ensuring that the object mapper will correctly create instances of the renamed class.Streetcode/Streetcode.WebApi/Controllers/Streetcode/StreetcodeController.cs (3)
48-48: Type reference update for consistent naming conventionsThe change from
StreetcodeShortDTOtoStreetcodeShortDtoaligns with modern C# conventions where acronyms with more than two letters use Pascal case. This standardization improves code readability and consistency across the codebase.
55-59: Pagination added to GetAllShort method - Good improvement!The addition of optional pagination parameters (
pageandpageSize) to theGetAllShortmethod helps address the PR objectives of eliminating duplicate requests and fixing pagination issues. Making these parameters optional ensures backward compatibility with existing code.The implementation correctly passes these parameters to the query handler, which should allow for more efficient data retrieval when only a subset of records is needed.
77-77: Consistent type reference updateThis change continues the standardization from
StreetcodeShortDTOtoStreetcodeShortDtofor theGetShortByIdmethod, ensuring consistency throughout the controller.Streetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Streetcode/GetAllPublishedHandlerTests.cs (3)
59-59: Good implementation of DTO naming convention standardization.The change from
StreetcodeShortDTOtoStreetcodeShortDtoaligns with the broader effort to standardize naming conventions across the codebase. Consistent naming improves code readability and maintainability.
100-100: Proper update to mapper mock setup.The mock setup has been correctly updated to use the new
StreetcodeShortDtotype, maintaining consistency with the renamed DTO classes.
102-102: Consistent DTO instantiation in mock return function.The instantiation of the DTO has been properly updated to use
StreetcodeShortDto, completing the renaming process throughout this test file.Streetcode/Streetcode.BLL/MediatR/Partners/GetToUpdateByStreetcodeId/GetPartnersToUpdateByStreetcodeIdHandler.cs (4)
13-13: Successful type standardization from PartnerDTO to PartnerDto.The class declaration has been updated to use the new PartnerDto type, which aligns with the project-wide standardization of DTO naming conventions.
28-28: Method signature properly updated to match new type.The Handle method signature has been correctly updated to return the standardized PartnerDto type.
40-40: Empty result collection updated to use new type.The empty enumerable result now correctly uses the standardized PartnerDto type.
43-43: Mapper usage updated to use standardized DTO type.The AutoMapper mapping operation has been properly updated to use PartnerDto instead of PartnerDTO, maintaining consistency throughout the handler.
Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllShort/GetAllStreetcodesShortHandler.cs (4)
12-13: Return type updated properly for pagination support.The handler's return type has been correctly modified to support pagination through the new
GetAllStreetcodesShortDtoclass.
32-34: Method signature correctly updated to match new return type.The handle method signature has been properly modified to align with the handler class declaration.
38-43: Proper error handling for empty results.The code correctly checks if the repository returned any entities and returns an appropriate error message if none are found.
45-49: Correctly mapping paginated results to DTO.The new DTO is appropriately constructed with both the total item count and the mapped entities, providing all necessary information for paginated responses.
Streetcode/Streetcode.XUnitTest/Validators/Partner/BasePartnersValidatorTests.cs (1)
274-278: DTO Type Name Updated for Streetcodes
The change from usingStreetcodeShortDTOtoStreetcodeShortDtoin theStreetcodesproperty initialization is consistent with the new naming conventions adopted across the project. This update ensures uniformity, and from what is visible here, the change appears correctly applied. Please double-check that all references and corresponding DTO definitions across the solution use the updated naming.Streetcode/Streetcode.WebApi/Controllers/Streetcode/TextContent/TermController.cs (4)
3-3: Updated namespace structure provides better organizationThe import statement has been updated to a more specific namespace, which helps organize DTOs more logically by grouping them by feature area. This follows best practices for maintainable code organization.
19-19: Pagination parameters correctly passed to query handlerThe implementation now properly forwards the pagination parameters to the query handler, which will help resolve the pagination issues mentioned in the PR objectives.
23-23: Consistent naming convention for DTOsThe change from
TermDTOtoTermDtofollows C# naming conventions where acronyms longer than two letters should use Pascal case rather than all uppercase. This standardization improves code readability and consistency across the codebase.Also applies to: 31-31, 44-44
34-34: Proper DTO separation following best practicesUsing a specific
TermCreateDtofor creation operations rather than reusing the same DTO for all operations follows best practices for API design. This approach allows for different validation rules and required fields during creation versus updates.Streetcode/Streetcode.BLL/DTO/Streetcode/StreetcodeShortDto.cs (1)
1-8: New DTO class follows standardization conventionThis new class properly follows the standardized naming convention (lowercase "Dto" suffix) and provides a concise implementation for transferring streetcode data. The null-forgiving operator on
Titleis appropriate for non-nullable reference types.Streetcode/Streetcode.BLL/DTO/Streetcode/TextContent/Term/TermCreateDto.cs (1)
1-8:Details
❓ Verification inconclusive
Verify requirement for Description property
While the DTO structure is clean and follows the naming convention standard, I noticed in the test snippet that only the
Titleproperty is being initialized in tests. IfDescriptionis truly required, ensure it's properly set in all tests and validation is in place. If it's optional, consider making this explicit in the property declaration.
🏁 Script executed:
#!/bin/bash # Search for usage of TermCreateDto to check if Description is consistently set rg -A 2 "new TermCreateDto\(\)" --multiline rg -A 10 "new TermCreateDto\s*\{" --multilineLength of output: 988
Action Required: Clarify and Ensure Consistent Handling of the "Description" Property
The current DTO definition in
Streetcode/Streetcode.BLL/DTO/Streetcode/TextContent/Term/TermCreateDto.csmarks theDescriptionproperty as required (using the null-forgiving operator). However, our tests—specifically in the files:
Streetcode/Streetcode.XIntegrationTest/ControllerTests/Utils/BeforeAndAfterTestAtribute/Streetcode/TextContent/Terms/ExtractCreateTestTermAttribute.csStreetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Terms/CreateTermTest.cs...only initialize the
Titleproperty when creating new instances ofTermCreateDto.Please verify the intended requirement for
Description:
- If it’s meant to be mandatory: Update the tests to also initialize the
Descriptionproperty and ensure validation logic is in place.- If it should be optional: Consider marking it as nullable or providing a default value to clearly indicate its optional nature.
Streetcode/Streetcode.BLL/DTO/Streetcode/GetAllStreetcodesShortDto.cs (1)
1-8: Well-designed pagination support DTOThis class provides a clean implementation for supporting paginated responses of streetcodes. The initialization of
StreetcodesShortto an empty list is a good practice to prevent null reference exceptions when iterating over the collection.Streetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Streetcode/GetStreetcodeShortByIdHandlerTests.cs (3)
42-42: Updated to use standardized DTO namingThe instantiation correctly uses the new
StreetcodeShortDtoclass.
68-68: Correctly updated mapping configurationThe mapping setup correctly references the new DTO class name.
92-93: Properly configured mapper setupThe mapper setup has been correctly updated to use the new DTO class name.
Streetcode/Streetcode.BLL/Mapping/Partners/PartnerProfile.cs (1)
12-12: Good standardization of DTO naming conventionThe change from
PartnerDTOtoPartnerDtoaligns with modern C# naming conventions. This standardization improves code consistency.Streetcode/Streetcode.BLL/Mapping/Streetcode/StreetcodeProfile.cs (1)
20-20: Good standardization of DTO naming conventionThe change from
StreetcodeShortDTOtoStreetcodeShortDtois consistent with the standardization effort across the codebase.Streetcode/Streetcode.BLL/DTO/Streetcode/TextContent/Term/TermDto.cs (2)
1-4: Good namespace organization and class renamingThe namespace has been properly organized to include the Term-specific path, and the class has been renamed from
TermDTOtoTermDtofollowing the standardization effort.
6-10: Property null initializers are correctly maintainedThe properties have been maintained with their null initializers, ensuring proper nullability annotation while standardizing the class name.
Streetcode/Streetcode.XIntegrationTest/ControllerTests/Utils/BeforeAndAfterTestAtribute/Streetcode/TextContent/Terms/ExtractUpdateTestTermAttribute.cs (3)
2-2: Using updated namespace correctlyThe import statement has been properly updated to reference the new namespace for the TermDto class, keeping the test utilities in sync with the implementation.
12-12: Property type updated to match renamed DTOThe static property has been properly updated to use the renamed
TermDtotype, maintaining compatibility with the renamed class.
16-21: Object instantiation updated to use new type nameThe object instantiation has been correctly updated to use the renamed
TermDtotype while maintaining the same property initialization.Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Update/UpdateTermCommand.cs (1)
3-3: Clean namespace update and DTO renamingThe changes to use the new Term-specific namespace and rename from
TermDTOtoTermDtofollow the project-wide standardization effort. This improves consistency across the codebase.Also applies to: 7-7
Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Create/CreateTermCommand.cs (1)
3-3: Consistent DTO naming standardizationBoth the parameter type (
TermCreateDto) and return type (TermDto) have been updated to follow the new naming convention. This change maintains consistency and better aligns with C# conventions.Also applies to: 7-8
Streetcode/Streetcode.BLL/Mapping/Streetcode/TextContent/TermProfile.cs (1)
2-2: Updated mapping configuration with new DTO namesThe AutoMapper configuration has been correctly updated to reflect the new DTO naming convention. Both the term-to-DTO mapping and create-DTO-to-term mapping have been updated consistently.
Also applies to: 11-12
Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Create/CreateTermHandler.cs (1)
5-5: Handler consistently updated with new DTO namingAll references to the DTO types have been systematically updated throughout the handler class - in the namespace import, interface implementation, method signature, and mapping operations. This thoroughness ensures the code remains functional while following the new naming standards.
Also applies to: 13-13, 35-35, 56-56
Streetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Terms/UpdateTermTest.cs (4)
5-5: Namespace path update for TermDto class.The import path has been updated to reflect the restructured namespace, which now includes a dedicated
Termsubdirectory. This change improves code organization by grouping related DTO classes.
84-84: Updated generic type parameter to match renamed DTO.The generic type parameter has been updated from
TermDTOtoTermDtoto maintain consistency with the standardized naming convention for DTOs throughout the project.
115-118: Updated return type and variable declarations to use standardized DTO naming.The method signature and variable declaration have been properly updated to use the
TermDtoclass name instead ofTermDTO, aligning with the project-wide DTO naming standardization effort.
123-123: Updated parameter type to use standardized DTO naming.The parameter type has been updated to
TermDtoto maintain consistency with the naming convention used throughout the project.Streetcode/Streetcode.XUnitTest/Mocks/MockHelpers.cs (3)
13-13: Added import for pagination helper classes.Added import for the
Streetcode.DAL.Helpersnamespace which contains thePaginationResponseclass used in the newly added mock setup methods.
156-170: Added mock setup method for paginated term queries.This new method properly sets up mocks for the term repository's paginated queries, supporting the updated implementation that uses pagination instead of retrieving all records at once. This change will help maintain test coverage for the updated repository methods.
172-186: Added mock setup method for paginated streetcode queries.Similar to the term repository setup, this method facilitates testing of the streetcode repository's paginated queries. The implementation correctly mocks all required parameters, including sorting and filtering expressions.
Streetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Terms/GetAllTermsTest.cs (9)
6-6: Updated imports to support new DTOs and pagination.The imports have been updated to reference the new term-specific namespace and include the pagination helpers, which is consistent with the architectural changes in the codebase.
Also applies to: 9-9
33-42: Refactored test to use paginated term results.The test setup has been updated to work with the new pagination structure. The mock repository and mapper are now properly configured to handle paginated results instead of simple lists, which matches the updated handler implementation.
47-53: Updated assertions to verify paginated response properties.The assertions now correctly verify both the content of the returned term collection and the total item count in the paginated response, ensuring the pagination mechanism works as expected.
60-68: Updated type verification test for paginated response.The test now properly verifies that the handler returns an object of type
GetAllTermsDtorather than a list of DTOs, reflecting the architectural change to use structured response objects for paginated data.
82-86: Updated empty results test to work with pagination.The test for empty results now correctly sets up and verifies an empty paginated response, ensuring that the handler behaves correctly when no terms are found.
Also applies to: 93-95
98-160: Added comprehensive tests for pagination edge cases.These new test cases cover important pagination scenarios:
- Verification of correct page size handling
- Handling of page numbers that exceed available data
- Edge cases with zero values for page number or page size
This thorough test coverage ensures the pagination implementation is robust against various inputs.
162-176: Refactored term object generation to support pagination.The method now creates both the domain entities and their DTO representations, wrapped in a pagination response structure. This implementation correctly maps the relationship between the paginated entities and their corresponding DTOs.
178-186: Updated request generation to support pagination parameters.The methods for creating empty term objects and request objects have been updated to work with pagination, allowing tests to specify page numbers and sizes when needed.
188-201: Updated verification method to check paginated repository calls.The verification method now checks that the repository's paginated methods are called with the expected parameters, ensuring that pagination is correctly implemented all the way down to the repository layer.
Streetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Terms/CreateTermTest.cs (5)
4-4: Updated import path for term DTOs.The import statement has been updated to reference the new term-specific namespace, which improves code organization by grouping related DTO classes.
57-57: Updated verification and type checking to use renamed DTOs.The verification and type assertion statements have been updated to use
TermDtoinstead ofTermDTO, maintaining consistency with the project-wide naming convention.Also applies to: 76-76
80-80: Improved test method name for clarity.The method name has been changed from
ShouldCreateSuccessfully_WhenSaveChangesAsyncFailedtoShouldCreateFailingly_WhenSaveChangesAsyncFailed, which more accurately reflects the expected outcome of the test. This improves code readability and makes the test's purpose clearer.
107-107: Updated generic type parameter to match renamed DTO.The mock mapper setup now uses
TermCreateDtoinstead ofTermCreateDTO, maintaining consistency with the standardized naming convention.
139-139: Updated method signatures and variable declarations to use standardized DTO naming.All references to
TermDTOandTermCreateDTOhave been updated to use the standardizedTermDtoandTermCreateDtonaming convention. This consistency improves code readability and maintenance.Also applies to: 143-143, 151-151, 159-159
Streetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Streetcode/GetAllStreetcodesShortHandlerTests.cs (9)
19-22: Improved naming convention for mock objectsThe renaming of mock objects from patterns like
_repositoryMockto_mockRepositoryenhances code readability by providing a consistent naming pattern across the test class. This makes it clear which objects are mocks and improves the overall maintainability of the test code.
39-40: Better test method naming improves clarityThe test method name has been improved from
Handle_WhenStreetcodesExist_ReturnsStreetcodeShortDTOstoShouldGetAllSuccessfully_WhenStreetcodesExist, which better reflects the intention of the test and follows a more descriptive naming convention. This makes the test's purpose immediately clear to anyone reading the code.
57-62: Enhanced assertions with FluentAssertionsUsing FluentAssertions library makes the test assertions more readable and expressive. The newly structured assertions clearly validate both the success state and the expected content of the response, including verification of the total amount property.
87-105: Good addition of test for empty streetcodes scenarioThis new test case properly validates the handler's behavior when no streetcodes exist, ensuring the error handling path works correctly. The test confirms both the failure state and the expected error message, which is important for comprehensive test coverage.
107-129: Well-structured pagination testThis test ensures that the handler correctly handles pagination parameters and returns the expected page size. The structured approach with clear arrangement, execution, and assertion phases makes the test easy to understand and maintain.
131-173: Thorough edge case testing for paginationThese tests effectively cover important edge cases for pagination, including too large page numbers and invalid pagination parameters (zero values). This kind of defensive testing is crucial for ensuring robust API behavior in all scenarios.
175-196: Well-designed test data helper methodsThe new helper methods
GetStreetcodeObjectsandGetEmptyStreetcodeObjectsimprove test maintainability by centralizing the creation of test data. This reduces duplication and makes tests more consistent when they need similar test objects.
198-201: Flexible request creation methodThe
GetRequestmethod with optional parameters for page and pageSize makes test setup more concise and adaptable. This approach allows tests to focus on the specific scenario being tested without repeating boilerplate code.
203-216: Improved repository verificationThe updated verification method now correctly validates that the repository's
GetAllPaginatedmethod is called with the expected parameters. This ensures that the pagination logic is properly implemented in the handler.Streetcode/Streetcode.BLL/DTO/Partners/GetAllPartnersDto.cs (1)
3-8: Well-structured pagination DTO for partnersThis new DTO class provides a clean structure for returning paginated partner data. It includes both the total count of partners and the collection itself, following standard pagination patterns. The default initialization of the
Partnersproperty to an empty list is a good practice to avoid null reference exceptions.Streetcode/Streetcode.BLL/MediatR/Partners/Delete/DeletePartnerQuery.cs (1)
8-8: Standardized DTO naming conventionThe change from
PartnerDTOtoPartnerDtoaligns with modern C# naming conventions where acronyms longer than two letters are treated as words (Pascal case for type names). This standardization improves code consistency across the project.Streetcode/Streetcode.BLL/DTO/Streetcode/TextContent/Term/GetAllTermsDto.cs (1)
3-8: Well-structured pagination DTO for termsThis new DTO follows the same pattern as the partners DTO, providing a standardized approach to pagination across different entity types in the application. This consistency is beneficial for both backend developers and API consumers.
Streetcode/Streetcode.BLL/MediatR/Partners/Create/CreatePartnerQuery.cs (1)
8-8: Consistent DTO naming convention appliedThe change from
PartnerDTOtoPartnerDtoaligns with the standardized naming convention being implemented across the codebase. This consistency improves readability and maintainability.Streetcode/Streetcode.BLL/MediatR/Partners/GetAll/GetAllPartnersQuery.cs (1)
7-8: Pagination support and DTO naming improvementsThis change fulfills two important objectives:
- Standardizes the DTO naming convention (
GetAllPartnersResponseDTO→GetAllPartnersDto)- Adds pagination parameters which should help address the pagination issues mentioned in the PR objectives
The implementation now accepts optional
pageandpageSizeparameters, which will enable paginated responses for partners.Streetcode/Streetcode.BLL/MediatR/Partners/GetById/GetPartnerByIdHandler.cs (3)
13-13: Consistent DTO naming convention applied to handler classThe handler class now properly implements
IRequestHandler<GetPartnerByIdQuery, Result<PartnerDto>>using the updated DTO naming convention.
28-28: Updated method signature with consistent DTO namingThe
Handlemethod signature now correctly returnsTask<Result<PartnerDto>>, maintaining consistency with the class declaration and the broader naming convention changes.
44-44: Updated mapping to use new DTO typeThe mapping operation now correctly maps to
PartnerDtoinstead ofPartnerDTO, completing the type renaming throughout the handler.Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/GetAll/GetAllTermsQuery.cs (2)
3-3: Updated namespace for Term DTOThe import statement now correctly references the new namespace structure for the Term-related DTOs, which helps organize related DTOs more logically.
7-8: Added pagination support to address pagination issuesThis change adds pagination parameters and updates the return type to support paginated responses, which directly addresses the pagination issues mentioned in the PR objectives. The implementation:
- Adds optional
pageandpageSizeparameters with appropriate defaults- Updates the return type to use the new
GetAllTermsDtothat supports paginated responsesThis should help fix the pagination issues that occurred after navigating past page 5 in the dictionary.
Streetcode/Streetcode.XIntegrationTest/ControllerTests/Partners/PartnersControllerTests.cs (3)
66-66: Type update consistent with project naming standards.The change from
GetAllPartnersResponseDTOtoGetAllPartnersDtoaligns with the project-wide standardization of DTO naming conventions. This helps maintain consistency throughout the codebase.
77-77: Type update consistent with project naming standards.The change from
PartnerDTOtoPartnerDtokeeps the test consistent with the renamed DTO classes in the project. Good job maintaining consistency.
107-107: Type update consistent with project naming standards.Updating from
IEnumerable<PartnerDTO>toIEnumerable<PartnerDto>ensures that the test properly deserializes to the renamed DTO type. This change aligns with the standardized naming convention.Streetcode/Streetcode.BLL/MediatR/Partners/Delete/DeletePartnerHandler.cs (3)
12-12: Updated handler return type for consistency.This change to the handler interface signature updates the return type from
Result<PartnerDTO>toResult<PartnerDto>, properly reflecting the standardized DTO naming convention.
27-27: Updated method signature for consistency.The
Handlemethod signature now returnsTask<Result<PartnerDto>>instead ofTask<Result<PartnerDTO>>, maintaining consistency with the renamed DTOs throughout the solution.
42-42: Updated mapper usage for consistency.The object mapper now targets the renamed
PartnerDtotype instead ofPartnerDTO, ensuring proper object mapping with the standardized DTO type.Streetcode/Streetcode.XUnitTest/MediatRTests/Partners/CreatePartnerTest.cs (5)
46-47: Updated mock mapper setup for renamed DTO.The mock setup now correctly references
PartnerDtoinstead ofPartnerDTO, aligning with the standardized DTO naming convention.
65-65: Updated assertion type check.The assertion now correctly verifies the result is of type
PartnerDtoinstead ofPartnerDTO, ensuring the test maintains validity with the renamed DTO type.
76-77: Updated mock mapper setup for renamed DTO.Similar to the earlier mock setup, this correctly references
PartnerDtoinstead ofPartnerDTOto maintain consistency with the standardized naming.
121-124: Updated method return type and implementation.The method now correctly returns and instantiates
PartnerDtoinstead ofPartnerDTO, reflecting the standardized naming convention.
140-145: Updated list type and item instantiation.The code now correctly uses
List<StreetcodeShortDto>and instantiatesStreetcodeShortDtoobjects instead of using the previousStreetcodeShortDTOnaming, maintaining consistency with the standardized naming convention.Streetcode/Streetcode.XUnitTest/MediatRTests/Partners/DeletePartnerTest.cs (2)
36-37: Updated mock mapper setup for renamed DTO.The mock setup now correctly maps to
PartnerDtoinstead ofPartnerDTO, aligning with the standardized DTO naming convention.
86-87: Updated mock mapper setup for renamed DTO.Similar to the earlier mock setup, this correctly maps to
PartnerDtoinstead ofPartnerDTOto maintain consistency with the standardized naming.Streetcode/Streetcode.BLL/MediatR/Partners/GetByStreetcodeId/GetPartnersByStreetcodeIdHandler.cs (4)
13-13: Good work standardizing DTO naming convention.The change from
PartnerDTOtoPartnerDtois consistent with modern C# naming conventions where acronyms over two characters should be Pascal-cased rather than all-uppercase.
28-28: Method signature updated properly.The return type has been correctly updated to match the class interface declaration.
39-39: Consistent empty collection type.Good job updating the empty enumerable return type to match the new DTO naming convention.
42-42: Mapping correctly updated.The mapper configuration has been properly updated to use the new DTO type name.
Streetcode/Streetcode.BLL/DTO/Partners/PartnerDto.cs (4)
2-2: Appropriate import for image functionality.The import of the Images namespace aligns with the new Logo property added to this class.
7-7: Standardized DTO naming convention.The class name has been properly updated from
PartnerDTOtoPartnerDtofollowing consistent naming conventions throughout the codebase.
25-25: Consistent type references in collections.Good job updating the collection type to use the standardized
StreetcodeShortDtonaming convention.
27-27: Added Logo property to address image disappearance.This property addition directly addresses the PR objective of fixing disappearing images in the "Партнери" section by ensuring the image data is properly included in the DTO.
Streetcode/Streetcode.BLL/MediatR/Partners/Create/CreatePartnerHandler.cs (3)
12-12: Standardized handler return type.The interface implementation has been properly updated to follow the new naming convention for DTOs.
30-30: Updated method signature.The method signature has been correctly changed to align with the interface declaration.
51-51: Consistent return type mapping.The mapper usage has been updated to use the new DTO type name, maintaining consistency across the codebase.
Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/GetAll/GetAllTermsHandler.cs (5)
4-4: Updated import for Term DTOs.The import statement has been correctly updated to reference the new namespace structure.
9-9: Enhanced return type with pagination support.The handler now returns a more structured response object (
GetAllTermsDto) that supports pagination, which addresses the pagination issues mentioned in the PR objectives.
20-20: Updated method signature for pagination.The method signature has been properly updated to reflect the new return type that supports pagination.
22-27: Implemented pagination support.Good implementation of pagination by:
- Using the repository's
GetAllPaginatedmethod- Creating a structured response with total count and paginated results
- Correctly mapping the entity collection to the new DTO type
This change directly addresses the pagination issues mentioned in the PR objectives.
29-29: Return statement updated for the new DTO structure.The return statement has been correctly updated to return the new DTO that includes pagination information.
Streetcode/Streetcode.XUnitTest/MediatRTests/Partners/GetParnerByStreetcodeIdTest.cs (1)
54-54: Naming convention standardization from PartnerDTO to PartnerDtoThe renaming of DTO classes from uppercase "DTO" suffix to lowercase "Dto" suffix aligns with standard C# naming conventions and improves consistency throughout the codebase. This change appears to be part of a broader effort to standardize DTO naming across the application.
Also applies to: 89-89, 101-101, 130-131, 162-164
Streetcode/Streetcode.XIntegrationTest/ControllerTests/Utils/Client/StreetCode/TextContent/TermClient.cs (1)
2-2: Updated namespace and aligned Term DTO naming conventionsThe changes appropriately update the namespace to a more specific path (
Streetcode.BLL.DTO.Streetcode.TextContent.Term) and standardize the DTO naming convention from uppercase "DTO" to lowercase "Dto". This improves code organization and maintains consistency with the naming conventions applied throughout the codebase.Also applies to: 14-14, 19-19, 26-26
Streetcode/Streetcode.XUnitTest/MediatRTests/Partners/GetAllPartnersTest.cs (6)
6-6: Updated dependencies to include IBlobServiceThe test now correctly imports and mocks the
IBlobServiceinterface which is needed for retrieving base64 logo images, aligning with the changes in theGetAllPartnersHandler.Also applies to: 17-22
26-32: Refactored test constructor to use new dependenciesThe constructor has been updated to initialize the blob service mock and create the handler with all required dependencies. This approach is better than creating the handler in each test method, improving test maintainability.
39-41: Updated test setup methods to configure all required dependenciesThe test methods now consistently set up all required dependencies, including the blob service, before executing the test. This ensures that the tests accurately reflect the behavior of the handler with its new dependency.
Also applies to: 56-58, 73-81
49-49: Updated DTO naming convention in assertions and helper methodsThe test correctly uses the new
PartnerDtonaming convention in assertions and helper methods, maintaining consistency with the changes in the production code.Also applies to: 88-88, 121-148
163-168: Added SetupBlobService method to configure the blob service mockThis new method provides a centralized way to set up the blob service mock to return a predefined base64 string, which helps maintain DRY principles and ensures consistent behavior across tests.
170-174: Updated SetupMapper method to use the new DTO naming conventionThe mapper setup method now correctly maps to
IEnumerable<PartnerDto>instead of the old DTO name, ensuring consistency with the changes in the production code.Streetcode/Streetcode.XIntegrationTest/ControllerTests/Streetcode/StreetcodeQueriesControllerTests.cs (2)
210-210: Updated DTO naming convention for StreetcodeShortDtoThe test correctly uses the new
StreetcodeShortDtonaming convention in deserialization calls, maintaining consistency with the changes in the production code.Also applies to: 240-240, 274-274
225-225: Updated deserialization target for GetAllShortAsync responseThe test now deserializes the response from
GetAllShortAsynctoGetAllStreetcodesShortDtoinstead ofIEnumerable<StreetcodeShortDTO>, and asserts against theStreetcodesShortproperty. This reflects a change in the API response structure, which now returns a wrapper object.Also applies to: 227-227
Streetcode/Streetcode.BLL/DTO/Partners/PartnerCreateUpdateDto.cs (2)
1-1: Updated import for consistency with DTO organizationThe import statement has been updated to reflect the new Create namespace organization, which aligns with the DTO structure refactoring across the codebase.
9-11: Properties properly standardized to match DTO modelThe class now includes all necessary properties to support the updated partner model with appropriate nullability annotations. The
Streetcodesproperty has been changed fromList<StreetcodeShortDTO>toList<StreetcodeShortDto>, which aligns with the standardized naming conventions being applied throughout the codebase.Also applies to: 12-13, 14-15, 16-17, 18-19, 20-21, 22-23, 24-25
Streetcode/Streetcode.BLL/MediatR/Partners/GetAll/GetAllPartnersHandler.cs (8)
6-6: Added BlobStorage service integrationAdded import for
IBlobServiceto support retrieving partner logo images as base64 strings.
12-12: Updated response type to follow standardized naming conventionsChanged the return type from
Result<GetAllPartnersResponseDTO>toResult<GetAllPartnersDto>to follow the DTO naming conventions being standardized across the codebase.
16-16: Integrated blob service for image handlingAdded the
IBlobServicedependency and removed no longer needed dependencies. This change streamlines the handler by focusing on its core responsibilities and implementing proper image retrieval functionality.Also applies to: 18-26
28-28: Updated method signature for consistencyThe method signature now uses the standardized
GetAllPartnersDtoreturn type, ensuring consistency with the class declaration and the rest of the codebase.
36-38: Enhanced entity loading with proper includesAdded includes for related entities, particularly the
Logoproperty. This is crucial for ensuring that partner logos are properly loaded when mapping to DTOs.
40-45: Improved response mapping with the new DTO structureReplaced direct mapping with a call to the specialized
MapToPartnerDtosmethod, which handles additional processing for logos. This change properly structures the response according to the newGetAllPartnersDtoformat.
47-48: Simplified result handlingRemoved unnecessary error handling and directly returns the successful result, as the error handling is now managed at a higher level.
50-63: Added powerful logo retrieval functionalityImplemented a new private method that enhances the partner DTOs by retrieving the base64 representation of their logos. This ensures that the frontend receives complete partner data including images.
Streetcode/Streetcode.WebApi/Controllers/Partners/PartnersController.cs (3)
22-22: Updated response type to the new standardized DTOChanged the response type to
GetAllPartnersDtoto reflect the updated DTO structure that includes pagination information and the collection of partners.
36-37: Standardized DTO naming conventionUpdated the response type from
PartnerDTOtoPartnerDtofollowing the standardized naming convention being implemented across the codebase.
43-44: Consistent DTO naming updates across all endpointsAll endpoints now use the standardized
PartnerDtonaming convention in their response type declarations, ensuring a consistent API documentation and client experience.Also applies to: 51-52, 59-60, 67-68, 77-78, 87-88
Streetcode/Streetcode.XIntegrationTest/ControllerTests/Streetcode/TextContent/TermControllerTests.cs (4)
2-2: Updated import to reflect standardized DTO namespaceThe import statement has been updated to reflect the standardized Term DTO namespace structure.
32-33: Updated to use the new paginated DTO structureThe test has been updated to deserialize the response to
GetAllTermsDtoinstead ofIEnumerable<TermDTO>, reflecting the new paginated response structure being implemented across the API.
37-38: Enhanced test validationAdded an assertion to verify that the returned Terms collection is not empty, providing more comprehensive validation of the API response.
48-49: Standardized DTO naming in all test methodsUpdated all test methods to use the standardized
TermDtonaming convention when deserializing responses, maintaining consistency with the changes in the main codebase.Also applies to: 67-68, 83-84, 103-104, 119-120, 135-136
| [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IEnumerable<TermDto>))] | ||
| public async Task<IActionResult> GetAll([FromQuery] ushort? page, [FromQuery] ushort? pageSize) |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Pagination parameters added but return type annotation may need updating
The addition of pagination parameters is a good improvement that addresses the reported pagination issues. However, if the underlying implementation now returns a GetAllTermsDto (containing both items and pagination metadata) as suggested in the summary, the ProducesResponseType annotation should reflect this rather than showing IEnumerable<TermDto>.
Consider adding XML documentation comments for these parameters to improve API discoverability.
🏁 Script executed:
#!/bin/bash
# Check if GetAllTermsQuery actually returns GetAllTermsDto instead of IEnumerable<TermDto>
rg -A 5 "GetAllTermsQuery" --type csLength of output: 3587
Update the API Response Type Annotation
Great work addressing the pagination issues by adding the new parameters. However, since the GetAllTermsQuery now returns a GetAllTermsDto (which includes both the items and pagination metadata) rather than an IEnumerable<TermDto>, the ProducesResponseType attribute in the TermController should be updated accordingly. Additionally, consider adding XML documentation comments for the pagination parameters to boost API discoverability.
- File:
Streetcode/Streetcode.WebApi/Controllers/Streetcode/TextContent/TermController.cs(Lines 16-17) - Recommended Change: Update the annotation from
IEnumerable<TermDto>toGetAllTermsDto.
Thanks for your attention to this detail. Let's make sure the response type accurately reflects the data returned!
✅ Actions performedReviews paused. |
|
|



Ticket
❗❗❗ATTENTION: related PR on the frontend. Make sure to merge them together.❗❗❗
Code reviewers
Summary of issue
Summary of change
CHECK LIST
Summary by CodeRabbit
New Features
Refactor
Tests