-
Notifications
You must be signed in to change notification settings - Fork 0
V3.10 create cqrl api #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
b2ae5d1
Add api documentation in Blog minimal api
lakatoshv 1d7b275
Fix CQRS endpoints configurations
lakatoshv 388f9c2
Add CQRS requests
lakatoshv 7e35223
Add Get posts command and command handler in posts feature
lakatoshv 4ed23fa
Add User posts endpoint
lakatoshv 2e20bbc
Add Posts activity endpoint
lakatoshv b95d060
Add Get posts endpoint
lakatoshv d0a58d8
Add Get post by id endpoint
lakatoshv 7dde66e
Add get sender messages endpoint
lakatoshv 43e2f09
Add Get recipient messages endpoint
lakatoshv 7257329
Add get by id message endpoint
lakatoshv 77a48d2
Add Get all messages endpoint
lakatoshv d0975af
Add get all posts endpoint
lakatoshv e977375
Add Health check endpoint
lakatoshv 5ad893e
Add get paged comments command and command handler in comments feature
lakatoshv 76cb043
Add Get paged comments endpoint
lakatoshv 02063bf
Add Get all users endpoint
lakatoshv 52f3c95
Add Initialize account endpoint
lakatoshv 8b06e39
Add send confirmation email endpoint
lakatoshv a03ae0f
Add users activity endpoint
lakatoshv 847b139
Add comments activity endpoint
lakatoshv f2d322c
Add get all comments endpoint
lakatoshv a74f29d
Add get comment by id endpoint
lakatoshv 7745555
Add Get comments by filter endpoint
lakatoshv bff315e
Add get comments by post endpoint
lakatoshv 56aca40
Fix GetAllQueryHandler Mapper issue
lakatoshv dcfc78a
Configure HealthCheck features
lakatoshv 54c2b1d
Configure Messages features
lakatoshv 824f603
Configure Posts features
lakatoshv 4ebb926
Configure carter versioning
lakatoshv 9bead96
Configure swagger to not have conflicts with carter
lakatoshv 928f67a
Configure Account features
lakatoshv df8f262
Configure Comments features
lakatoshv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
19 changes: 19 additions & 0 deletions
19
BlogWebApp/BlogVerticalSliceCQRSMinimalApi/CQRSExtensions/CarterExtensions.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| using Asp.Versioning.Builder; | ||
| using Carter; | ||
|
|
||
| namespace BlogVerticalSliceCQRSMinimalApi.CQRSExtensions; | ||
|
|
||
| public static class CarterExtensions | ||
| { | ||
| public static IEndpointRouteBuilder MapVersionedCarter( | ||
| this IEndpointRouteBuilder app, | ||
| ApiVersionSet versionSet) | ||
| { | ||
| var group = app.MapGroup("/api/v{version:apiVersion}") | ||
| .WithApiVersionSet(versionSet); | ||
|
|
||
| group.MapCarter(); // 👈 ключ | ||
|
|
||
| return app; | ||
| } | ||
| } |
33 changes: 33 additions & 0 deletions
33
...bApp/BlogVerticalSliceCQRSMinimalApi/Features/Accounts/GetAllUsers/GetAllUsersEndpoint.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| using Asp.Versioning; | ||
| using Blog.Contracts.V1; | ||
| using Blog.Contracts.V1.Responses.UsersResponses; | ||
| using Carter; | ||
| using MediatR; | ||
| using Microsoft.AspNetCore.Mvc; | ||
|
|
||
| namespace BlogVerticalSliceCQRSMinimalApi.Features.Accounts.GetAllUsers; | ||
|
|
||
| public class GetAllUsersEndpoint : ICarterModule | ||
| { | ||
| public void AddRoutes(IEndpointRouteBuilder app) | ||
| { | ||
| var group = app.MapGroup("Accounts") | ||
| .MapToApiVersion(1.0) | ||
| .WithTags("Accounts"); | ||
|
|
||
| group.MapGet(ApiRoutes.AccountsController.GetAllUsers, async ([FromServices] ISender sender) => | ||
| { | ||
| var result = await sender.Send(new GetAllUsersQuery()); | ||
|
|
||
| return result == null | ||
| ? Results.NotFound() | ||
| : Results.Ok(result); | ||
| }) | ||
| .WithName("GetAllUsers") | ||
| .Produces<List<AccountResponse>>() | ||
| .Produces(StatusCodes.Status400BadRequest) | ||
| .Produces(StatusCodes.Status404NotFound) | ||
| .WithSummary("Get All Users") | ||
| .WithDescription("Get All Users"); | ||
| } | ||
| } |
36 changes: 36 additions & 0 deletions
36
...WebApp/BlogVerticalSliceCQRSMinimalApi/Features/Accounts/Initialize/InitializeEndpoint.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| using Asp.Versioning; | ||
| using Blog.Contracts.V1; | ||
| using Blog.Contracts.V1.Responses.UsersResponses; | ||
| using Carter; | ||
| using MediatR; | ||
| using Microsoft.AspNetCore.Mvc; | ||
|
|
||
| namespace BlogVerticalSliceCQRSMinimalApi.Features.Accounts.Initialize; | ||
| /* | ||
| public class GetAllEndpoint : ICarterModule | ||
| { | ||
| public void AddRoutes(IEndpointRouteBuilder app) | ||
| { | ||
| var group = app.MapGroup("Accounts") | ||
| .MapToApiVersion(1.0) | ||
| .WithTags("Accounts"); | ||
|
|
||
| group.MapGet(ApiRoutes.AccountsController.Initialize, async ([FromRoute] string userId, [FromServices] ISender sender) => | ||
| { | ||
| if (string.IsNullOrEmpty(userId)) | ||
| return Results.BadRequest("Something went wrong"); | ||
|
|
||
| var result = await sender.Send(new InitializeQuery(UserId: userId)); | ||
|
|
||
| return result == null | ||
| ? Results.NotFound() | ||
| : Results.Ok(result); | ||
| }) | ||
| .WithName("Initialize") | ||
| .Produces<List<RoleResponse>>() | ||
| .Produces(StatusCodes.Status400BadRequest) | ||
| .Produces(StatusCodes.Status404NotFound) | ||
| .WithSummary("Initialize") | ||
| .WithDescription("Initialize"); | ||
| } | ||
| }*/ |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test comment