-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
93 changed files
with
1,105 additions
and
410 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -21,8 +21,10 @@ jobs: | |
run: dotnet restore | ||
- name: Build | ||
run: dotnet build -c Release --no-restore | ||
- name: Test | ||
- name: Application Test | ||
run: dotnet test ./tests/NKZSoft.Template.Application.Tests --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage | ||
# - name: REST Test | ||
# run: dotnet test ./tests/NKZSoft.Template.Presentation.REST.Tests --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage | ||
- name: Code Coverage Report | ||
uses: irongut/[email protected] | ||
with: | ||
|
This file contains 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 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 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
6 changes: 6 additions & 0 deletions
6
src/NKZSoft.Template.Application/Common/Interfaces/IDbInitializer.cs
This file contains 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,6 @@ | ||
namespace NKZSoft.Template.Application.Common.Interfaces; | ||
|
||
public interface IDbInitializer | ||
{ | ||
Task SeedAsync(IApplicationDbContext context, CancellationToken cancellationToken = default); | ||
} |
This file contains 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 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 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 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 |
---|---|---|
@@ -1,20 +1,14 @@ | ||
using NKZSoft.Template.Application.Models; | ||
using NKZSoft.Template.Domain.AggregatesModel.ToDoAggregates.Entities; | ||
using NKZSoft.Template.Domain.AggregatesModel.ToDoAggregates.Entities; | ||
|
||
namespace NKZSoft.Template.Application.Mapper; | ||
|
||
using Models; | ||
|
||
public class MappingConfig | ||
public class MappingConfig : IRegister | ||
{ | ||
public static TypeAdapterConfig Configure() | ||
public void Register(TypeAdapterConfig config) | ||
{ | ||
var config = new TypeAdapterConfig(); | ||
|
||
config.NewConfig<ToDoItem, ToDoItemDto>(); | ||
|
||
config.NewConfig<ToDoList, ToDoListDto>(); | ||
|
||
return config; | ||
} | ||
} |
This file contains 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 |
---|---|---|
@@ -1,8 +1,6 @@ | ||
using NKZSoft.Template.Application.Common.Models; | ||
|
||
namespace NKZSoft.Template.Application.Models; | ||
|
||
using Common.Models; | ||
|
||
public sealed record ToDoItemDto(int Id, string Title, string? Note, string CreatedBy, DateTime Created, string ModifiedBy, DateTime? Modified, DateTime? Deleted) | ||
: BaseDto(CreatedBy, Created, ModifiedBy, Modified, Deleted); | ||
public sealed record ToDoItemDto(Guid Id, string Title, string? Note, string CreatedBy, DateTime Created, string ModifiedBy, DateTime? Modified, DateTime? Deleted) | ||
: BaseDto(CreatedBy, Created, ModifiedBy, Modified, Deleted); |
This file contains 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 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
2 changes: 1 addition & 1 deletion
2
src/NKZSoft.Template.Application/TodoItems/Commands/Create/CreateToВoItemCommand.cs
This file contains 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
namespace NKZSoft.Template.Application.TodoItems.Commands.Create; | ||
|
||
public sealed record CreateToВoItemCommand(string Title, int? ListId) : IRequest<IResult<int>>; | ||
public sealed record CreateToВoItemCommand(string Title, int? ListId) : IRequest<IResult<Guid>>; |
2 changes: 1 addition & 1 deletion
2
src/NKZSoft.Template.Application/TodoItems/Commands/Delete/DeleteTodoItemCommand.cs
This file contains 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
namespace NKZSoft.Template.Application.TodoItems.Commands.Delete; | ||
|
||
public sealed record DeleteTodoItemCommand(int Id) : IRequest; | ||
public sealed record DeleteTodoItemCommand(Guid Id) : IRequest; |
2 changes: 1 addition & 1 deletion
2
src/NKZSoft.Template.Application/TodoItems/Commands/Update/UpdateTodoItemCommand.cs
This file contains 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
namespace NKZSoft.Template.Application.TodoItems.Commands.Update; | ||
|
||
public sealed record UpdateTodoItemCommand(int Id, string Title, string Description) : IRequest; | ||
public sealed record UpdateTodoItemCommand(Guid Id, string Title, string Description) : IRequest; |
This file contains 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 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 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
23 changes: 13 additions & 10 deletions
23
src/NKZSoft.Template.Application/TodoItems/Queries/Get/GetTodoItemQueryHandler.cs
This file contains 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 |
---|---|---|
@@ -1,32 +1,35 @@ | ||
using NKZSoft.Template.Application.Models; | ||
using NKZSoft.Template.Domain.AggregatesModel.ToDoAggregates.Entities; | ||
|
||
namespace NKZSoft.Template.Application.TodoItems.Queries.Get; | ||
namespace NKZSoft.Template.Application.TodoItems.Queries.Get; | ||
|
||
using Domain.AggregatesModel.ToDoAggregates.Entities; | ||
using Application.Models; | ||
using Common.Exceptions; | ||
using Common.Handlers; | ||
using Common.Interfaces; | ||
|
||
public sealed class GetTodoItemQueryHandler : HandlerQueryBase<GetTodoItemQuery, Result<ToDoItemDto>> | ||
{ | ||
public GetTodoItemQueryHandler(IApplicationDbContext applicationDbContext, | ||
public GetTodoItemQueryHandler(IApplicationDbContext applicationDbContext, | ||
ICurrentUserService currentUserService, | ||
IMapper mapper) | ||
: base(applicationDbContext, mapper, currentUserService) | ||
{ | ||
} | ||
|
||
public override async Task<Result<ToDoItemDto>> Handle(GetTodoItemQuery request, CancellationToken cancellationToken) | ||
{ | ||
var entity = await ContextDb.Set<ToDoItem>() | ||
.AsNoTracking() | ||
.Where(e => e.Id == request.Id) | ||
.SingleOrDefaultAsync(cancellationToken); | ||
.SingleOrDefaultAsync(cancellationToken) | ||
.ConfigureAwait(false); | ||
|
||
entity.ThrowIfNull(new NotFoundException()); | ||
|
||
return Result.Ok(await entity.BuildAdapter(Mapper.Config) | ||
.AdaptToTypeAsync<ToDoItemDto>()); | ||
var dtoItem = await entity | ||
.BuildAdapter(Mapper.Config) | ||
.AdaptToTypeAsync<ToDoItemDto>() | ||
.ConfigureAwait(false); | ||
|
||
return Result.Ok(dtoItem); | ||
} | ||
} | ||
} |
This file contains 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
Oops, something went wrong.