Skip to content

A bunch of different tasks related to the admin page#2556

Open
Michael-Kolpakov wants to merge 8 commits into
release/1.2.3from
feature/issue-2344
Open

A bunch of different tasks related to the admin page#2556
Michael-Kolpakov wants to merge 8 commits into
release/1.2.3from
feature/issue-2344

Conversation

@Michael-Kolpakov

@Michael-Kolpakov Michael-Kolpakov commented Mar 17, 2025

Copy link
Copy Markdown
Contributor

Ticket

❗❗❗ATTENTION: related PR on the frontend. Make sure to merge them together.❗❗❗

Code reviewers

Summary of issue

  1. Duplicate requests on the admin page.
  2. Problems with disappearing images in the 'Партнери' section of the admin page.
  3. Problems with tag record not disappearing after deleting it from table.
  4. Pagination disappears after navigating past page 5 in the dictionary

Summary of change

  1. Both the frontend and backend codebases have been updated to eliminate unnecessary duplicate requests from the client to the server.
  2. Now all the necessary fields are pulled from the server and the pictures in the 'Партнери' section no longer disappear.
  3. Now the frontend correctly interacts with the tag storage and they are correctly displayed in the table.
  4. The pagination was redesigned to match the rest of the admin part of the website and there are no more problems interacting with it.

CHECK LIST

  • СI passed
  • Сode coverage >=95%
  • PR is reviewed manually again (to make sure you have 100% ready code)
  • All reviewers agreed to merge the PR
  • I've checked new feature as logged in and logged out user if needed
  • PR meets all conventions

Summary by CodeRabbit

  • New Features

    • Introduced pagination for retrieving partners, streetcode summaries, and terms, allowing users to navigate data more efficiently.
    • Enhanced partner details now include additional descriptive fields and improved image (logo) support.
  • Refactor

    • Streamlined API response formats across partners, streetcodes, and terms to provide a more consistent and maintainable experience.
  • Tests

    • Updated testing suite to validate the enhanced endpoints and ensure reliable data delivery with the new pagination features.

@coderabbitai

coderabbitai Bot commented Mar 17, 2025

Copy link
Copy Markdown

Note

Reviews paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Walkthrough

This 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

File(s) Change Summary
BLL/DTO/Partners/
.../GetAllPartnersDto.cs
.../PartnerCreateUpdateDto.cs
.../PartnerDto.cs
.../GetAllPartnersResponseDTO.cs (removed)
Added new partner DTOs; removed obsolete response DTO; properties updated and renamed (eg. PartnerDTO → PartnerDto).
BLL/DTO/Streetcode/
.../GetAllStreetcodesShortDto.cs
.../StreetcodeShortDTO.cs (removed)
.../StreetcodeShortDto.cs
Introduced paginated DTO for streetcodes; removed outdated version and updated type naming.
BLL/DTO/Streetcode/TextContent/Term/
.../GetAllTermsDto.cs
.../TermCreateDto.cs
.../TermDto.cs
.../TermCreateDTO.cs (removed)
Added and renamed term DTOs; removed redundant term creation DTO; standardized property initialization.
BLL/Mapping/
.../Partners/PartnerProfile.cs
.../Streetcode/StreetcodeProfile.cs
.../Streetcode/TextContent/TermProfile.cs
Updated AutoMapper configuration to use new DTO names (PartnerDto, StreetcodeShortDto, TermDto).
BLL/MediatR/
.../Partners/
.../Streetcode/Streetcode/
.../Streetcode/TextContent/Term/
Modified handler and query signatures to return new DTO types; GetAllPartnersHandler now includes blob service usage for logos; pagination introduced in GetAllStreetcodesShort and GetAllTerms handlers.
WebApi/Controllers/
.../Partners/PartnersController.cs
.../Streetcode/StreetcodeController.cs
.../Streetcode/TextContent/TermController.cs
Revised response type annotations and added pagination query parameters; endpoint signatures updated for consistency.
XIntegrationTest & XUnitTest
.../ControllerTests/Partners/*.cs
.../ControllerTests/Streetcode/*.cs
.../MediatRTests/Partners/*.cs
.../MediatRTests/StreetCode/*.cs
.../MediatRTests/StreetCode/Terms/*.cs
.../Mocks/MockHelpers.cs
.../Validators/Partner/BasePartnersValidatorTests.cs
Adjusted test assertions, mock setups, and helper methods to use updated DTO names and pagination logic; renamed test methods and variables for clarity and consistency.

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
Loading

Poem

In refactored code where names now align,
DTOs wear "Dto" with a refreshed design.
New paginations and blob services unfold,
Mapping and tests in harmony told.
Each change, a step toward clear, concise art—
A collaborative masterpiece, every part!
🚀 Happy coding, with progress at heart!


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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Michael-Kolpakov

Copy link
Copy Markdown
Contributor Author

@coderabbitai ignore

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 naming

The addition of optional pagination parameters (page and pageSize) to the query is a solid enhancement that improves scalability for retrieving streetcodes. The updated return type to GetAllStreetcodesShortDto properly 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" in Handle_WhenPublishedStreetcodesExist_ReturnsStreetcodeShortDTOs. For absolute consistency, you might want to update this to Handle_WhenPublishedStreetcodesExist_ReturnsStreetcodeShortDtos.

Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllPublished/GetAllPublishedHandler.cs (4)

13-15: DTO Naming and Consistency Check
The method signature now returns Result<IEnumerable<StreetcodeShortDto>>, which aligns with the standardized naming conventions (e.g., from StreetcodeShortDTO to StreetcodeShortDto). Ensure that all related mapping configurations and references throughout the project have been updated consistently.


33-34: Updated Handle Method Signature
The Handle method's signature correctly reflects the new DTO type. However, note that the cancellationToken parameter 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 provided cancellationToken. 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 for StreetcodeShortDto is 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 the page and pageSize parameters 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.FromResult is 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.Entities to 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 consistency

The 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 convention

The 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 consistency

While the PartnerDto has been updated, other DTOs in this file (like CreatePartnerDTO, 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 consistency

While StreetcodeShortDto has 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 PartnerDto instead of PartnerDTO, I notice the method name still uses uppercase "DTO". Consider renaming the method to GetPartnerDto() 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

📥 Commits

Reviewing files that changed from the base of the PR and between 4820041 and 61b78ef.

📒 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 Verified

The 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 reference PartnerDto in 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 StreetcodeShortDTO to StreetcodeShortDto, 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 Update

The updated line now uses PartnerDto instead of the old PartnerDTO, 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 Dto

The 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 Declaration

The update on line 8 correctly replaces the old PartnerDTO with the standardized PartnerDto. 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 Update

The change now uses StreetcodeShortDto in the query record instead of StreetcodeShortDTO, 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 update

The changes correctly standardize the DTO naming from TermDTO to TermDto across 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 TermDTO to TermDto across 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 PartnerDTO to PartnerDto aligns 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 UpdatePartnerDTO on 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 Definition

This change correctly updates the generic type parameter to use PartnerDto instead of the obsolete PartnerDTO, 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 StreetcodeShortDTO to StreetcodeShortDto aligns 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 standardization

The changes to the import namespace and the TermDto type 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.Term instead of just TextContent) 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 PartnerDTO to PartnerDto aligns 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? to PartnerDto? 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 PartnerDto type, 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 PartnerDto class, 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 PartnerDTO to PartnerDto aligns 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 PartnerDto naming convention instead of PartnerDTO. 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 PartnerDto type, 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 conventions

The change from StreetcodeShortDTO to StreetcodeShortDto aligns 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 (page and pageSize) to the GetAllShort method 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 update

This change continues the standardization from StreetcodeShortDTO to StreetcodeShortDto for the GetShortById method, 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 StreetcodeShortDTO to StreetcodeShortDto aligns 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 StreetcodeShortDto type, 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 GetAllStreetcodesShortDto class.


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 using StreetcodeShortDTO to StreetcodeShortDto in the Streetcodes property 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 organization

The 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 handler

The 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 DTOs

The change from TermDTO to TermDto follows 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 practices

Using a specific TermCreateDto for 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 convention

This 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 Title is 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 Title property is being initialized in tests. If Description is 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*\{" --multiline

Length 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.cs marks the Description property as required (using the null-forgiving operator). However, our tests—specifically in the files:

  • Streetcode/Streetcode.XIntegrationTest/ControllerTests/Utils/BeforeAndAfterTestAtribute/Streetcode/TextContent/Terms/ExtractCreateTestTermAttribute.cs
  • Streetcode/Streetcode.XUnitTest/MediatRTests/StreetCode/Terms/CreateTermTest.cs

...only initialize the Title property when creating new instances of TermCreateDto.

Please verify the intended requirement for Description:

  • If it’s meant to be mandatory: Update the tests to also initialize the Description property 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 DTO

This class provides a clean implementation for supporting paginated responses of streetcodes. The initialization of StreetcodesShort to 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 naming

The instantiation correctly uses the new StreetcodeShortDto class.


68-68: Correctly updated mapping configuration

The mapping setup correctly references the new DTO class name.


92-93: Properly configured mapper setup

The 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 convention

The change from PartnerDTO to PartnerDto aligns 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 convention

The change from StreetcodeShortDTO to StreetcodeShortDto is 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 renaming

The namespace has been properly organized to include the Term-specific path, and the class has been renamed from TermDTO to TermDto following the standardization effort.


6-10: Property null initializers are correctly maintained

The 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 correctly

The 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 DTO

The static property has been properly updated to use the renamed TermDto type, maintaining compatibility with the renamed class.


16-21: Object instantiation updated to use new type name

The object instantiation has been correctly updated to use the renamed TermDto type while maintaining the same property initialization.

Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Update/UpdateTermCommand.cs (1)

3-3: Clean namespace update and DTO renaming

The changes to use the new Term-specific namespace and rename from TermDTO to TermDto follow 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 standardization

Both 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 names

The 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 naming

All 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 Term subdirectory. 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 TermDTO to TermDto to 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 TermDto class name instead of TermDTO, 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 TermDto to 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.Helpers namespace which contains the PaginationResponse class 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 GetAllTermsDto rather 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:

  1. Verification of correct page size handling
  2. Handling of page numbers that exceed available data
  3. 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 TermDto instead of TermDTO, 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_WhenSaveChangesAsyncFailed to ShouldCreateFailingly_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 TermCreateDto instead of TermCreateDTO, maintaining consistency with the standardized naming convention.


139-139: Updated method signatures and variable declarations to use standardized DTO naming.

All references to TermDTO and TermCreateDTO have been updated to use the standardized TermDto and TermCreateDto naming 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 objects

The renaming of mock objects from patterns like _repositoryMock to _mockRepository enhances 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 clarity

The test method name has been improved from Handle_WhenStreetcodesExist_ReturnsStreetcodeShortDTOs to ShouldGetAllSuccessfully_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 FluentAssertions

Using 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 scenario

This 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 test

This 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 pagination

These 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 methods

The new helper methods GetStreetcodeObjects and GetEmptyStreetcodeObjects improve 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 method

The GetRequest method 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 verification

The updated verification method now correctly validates that the repository's GetAllPaginated method 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 partners

This 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 Partners property 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 convention

The change from PartnerDTO to PartnerDto aligns 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 terms

This 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 applied

The change from PartnerDTO to PartnerDto aligns 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 improvements

This change fulfills two important objectives:

  1. Standardizes the DTO naming convention (GetAllPartnersResponseDTOGetAllPartnersDto)
  2. Adds pagination parameters which should help address the pagination issues mentioned in the PR objectives

The implementation now accepts optional page and pageSize parameters, 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 class

The handler class now properly implements IRequestHandler<GetPartnerByIdQuery, Result<PartnerDto>> using the updated DTO naming convention.


28-28: Updated method signature with consistent DTO naming

The Handle method signature now correctly returns Task<Result<PartnerDto>>, maintaining consistency with the class declaration and the broader naming convention changes.


44-44: Updated mapping to use new DTO type

The mapping operation now correctly maps to PartnerDto instead of PartnerDTO, completing the type renaming throughout the handler.

Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/GetAll/GetAllTermsQuery.cs (2)

3-3: Updated namespace for Term DTO

The 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 issues

This 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:

  1. Adds optional page and pageSize parameters with appropriate defaults
  2. Updates the return type to use the new GetAllTermsDto that supports paginated responses

This 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 GetAllPartnersResponseDTO to GetAllPartnersDto aligns 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 PartnerDTO to PartnerDto keeps 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> to IEnumerable<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> to Result<PartnerDto>, properly reflecting the standardized DTO naming convention.


27-27: Updated method signature for consistency.

The Handle method signature now returns Task<Result<PartnerDto>> instead of Task<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 PartnerDto type instead of PartnerDTO, 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 PartnerDto instead of PartnerDTO, aligning with the standardized DTO naming convention.


65-65: Updated assertion type check.

The assertion now correctly verifies the result is of type PartnerDto instead of PartnerDTO, 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 PartnerDto instead of PartnerDTO to maintain consistency with the standardized naming.


121-124: Updated method return type and implementation.

The method now correctly returns and instantiates PartnerDto instead of PartnerDTO, reflecting the standardized naming convention.


140-145: Updated list type and item instantiation.

The code now correctly uses List<StreetcodeShortDto> and instantiates StreetcodeShortDto objects instead of using the previous StreetcodeShortDTO naming, 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 PartnerDto instead of PartnerDTO, 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 PartnerDto instead of PartnerDTO to 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 PartnerDTO to PartnerDto is 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 PartnerDTO to PartnerDto following consistent naming conventions throughout the codebase.


25-25: Consistent type references in collections.

Good job updating the collection type to use the standardized StreetcodeShortDto naming 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:

  1. Using the repository's GetAllPaginated method
  2. Creating a structured response with total count and paginated results
  3. 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 PartnerDto

The 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 conventions

The 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 IBlobService

The test now correctly imports and mocks the IBlobService interface which is needed for retrieving base64 logo images, aligning with the changes in the GetAllPartnersHandler.

Also applies to: 17-22


26-32: Refactored test constructor to use new dependencies

The 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 dependencies

The 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 methods

The test correctly uses the new PartnerDto naming 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 mock

This 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 convention

The 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 StreetcodeShortDto

The test correctly uses the new StreetcodeShortDto naming 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 response

The test now deserializes the response from GetAllShortAsync to GetAllStreetcodesShortDto instead of IEnumerable<StreetcodeShortDTO>, and asserts against the StreetcodesShort property. 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 organization

The 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 model

The class now includes all necessary properties to support the updated partner model with appropriate nullability annotations. The Streetcodes property has been changed from List<StreetcodeShortDTO> to List<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 integration

Added import for IBlobService to support retrieving partner logo images as base64 strings.


12-12: Updated response type to follow standardized naming conventions

Changed the return type from Result<GetAllPartnersResponseDTO> to Result<GetAllPartnersDto> to follow the DTO naming conventions being standardized across the codebase.


16-16: Integrated blob service for image handling

Added the IBlobService dependency 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 consistency

The method signature now uses the standardized GetAllPartnersDto return type, ensuring consistency with the class declaration and the rest of the codebase.


36-38: Enhanced entity loading with proper includes

Added includes for related entities, particularly the Logo property. This is crucial for ensuring that partner logos are properly loaded when mapping to DTOs.


40-45: Improved response mapping with the new DTO structure

Replaced direct mapping with a call to the specialized MapToPartnerDtos method, which handles additional processing for logos. This change properly structures the response according to the new GetAllPartnersDto format.


47-48: Simplified result handling

Removed 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 functionality

Implemented 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 DTO

Changed the response type to GetAllPartnersDto to reflect the updated DTO structure that includes pagination information and the collection of partners.


36-37: Standardized DTO naming convention

Updated the response type from PartnerDTO to PartnerDto following the standardized naming convention being implemented across the codebase.


43-44: Consistent DTO naming updates across all endpoints

All endpoints now use the standardized PartnerDto naming 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 namespace

The import statement has been updated to reflect the standardized Term DTO namespace structure.


32-33: Updated to use the new paginated DTO structure

The test has been updated to deserialize the response to GetAllTermsDto instead of IEnumerable<TermDTO>, reflecting the new paginated response structure being implemented across the API.


37-38: Enhanced test validation

Added 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 methods

Updated all test methods to use the standardized TermDto naming 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

Comment on lines +16 to +17
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IEnumerable<TermDto>))]
public async Task<IActionResult> GetAll([FromQuery] ushort? page, [FromQuery] ushort? pageSize)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 cs

Length 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> to GetAllTermsDto.

Thanks for your attention to this detail. Let's make sure the response type accurately reflects the data returned!

@coderabbitai

coderabbitai Bot commented Mar 17, 2025

Copy link
Copy Markdown
✅ Actions performed

Reviews paused.

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

sonarqubecloud Bot commented May 9, 2025

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants