refactor: introduce hexagonal ports and use case structure#5
Open
RoronoaSZ wants to merge 3 commits into
Open
Conversation
- add inbound ports - introduce usecases folder for application workflows - align project structure with hexagonal architecture principles
There was a problem hiding this comment.
Pull request overview
This PR refactors the application layer toward a hexagonal architecture by replacing the service-based TV show listing flow with inbound/outbound ports and a list-use-case implementation.
Changes:
- Introduces
IListTvShowsUseCaseandListTvShowsUseCasefor listing TV shows. - Updates DI and controller dependencies to use the new inbound port.
- Renames repository port imports toward an outbound port namespace and performs minor formatting cleanup.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
TvShow.Api/Controllers/TvShowsController.cs |
Updates the controller to depend on the list TV shows use case. |
TvShow.Application/DependencyInjection.cs |
Registers the new use case implementation. |
TvShow.Application/Models/TvShowResponse.cs |
Adds trailing whitespace-only lines. |
TvShow.Application/Ports/In/IListTvShowsUseCase.cs |
Adds the inbound port for listing TV shows. |
TvShow.Application/Ports/ITvShowRepository.cs |
Removes the previous repository port location. |
TvShow.Application/Services/TvShowManager.cs |
Removes the old application service. |
TvShow.Application/UseCases/ListTvShows/ListTvShowsUseCase.cs |
Adds the new list workflow implementation. |
TvShow.Domain/TvShow.cs |
Normalizes spacing around property initializers. |
TvShow.Infrastructure/DependencyInjection.cs |
Updates repository port namespace import. |
TvShow.Infrastructure/Repositories/InMemoryTvShowRepository.cs |
Updates repository port namespace import. |
|
|
||
| public async Task<IReadOnlyList<TvShowResponse>> ExecuteAsync(CancellationToken cancellationToken = default) | ||
| { | ||
| var tvShows = await _repository.GetAllAsync(); |
| public async Task<ActionResult<IReadOnlyList<TvShowResponse>>> GetAll(CancellationToken cancellationToken) | ||
| { | ||
| var tvShows = await tvShowManager.GetAllAsync(cancellationToken); | ||
| var tvShows = await listTvShowsUseCase.ExecuteAsync(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add inbound ports
introduce usecases folder for application workflows
align project structure with hexagonal architecture principles
modify
.gitignoreto acceptOutdirectory