-
Notifications
You must be signed in to change notification settings - Fork 5
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
19 changed files
with
98 additions
and
26 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
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
21 changes: 21 additions & 0 deletions
21
src/GraphR.Application/Authors/Handlers/GetAuthorsQueryHandler.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,21 @@ | ||
using GraphR.Application.Authors.Types.Mappings; | ||
using GraphR.Application.Authors.Types.Output; | ||
using GraphR.Domain.Interfaces; | ||
using GrapR.Core.Handlers; | ||
|
||
namespace GraphR.Application.Authors.Handlers; | ||
|
||
internal sealed class GetAuthorsQueryHandler : Handler<AuthorDto[]>, IGetAuthorsQueryHandler | ||
{ | ||
private readonly IAuthorRepository _repository; | ||
|
||
public GetAuthorsQueryHandler(IAuthorRepository repository) | ||
{ | ||
_repository = repository; | ||
} | ||
|
||
public override async Task<AuthorDto[]> Handle() | ||
=> (await _repository.GetAll()).ToOutput(); | ||
} | ||
|
||
public interface IGetAuthorsQueryHandler : IHandler<AuthorDto[]> { } |
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: 5 additions & 1 deletion
6
src/GraphR.Application/Authors/Types/Mappings/AuthorMapping.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,14 +1,18 @@ | ||
using GraphR.Application.Authors.Types.Output; | ||
using GrapR.Domain.Models; | ||
using GraphR.Domain.Entities; | ||
|
||
namespace GraphR.Application.Authors.Types.Mappings; | ||
|
||
internal static class AuthorMapping | ||
{ | ||
internal static AuthorDto[] ToOutput(this Author[] authors) | ||
=> authors.Select(ToOutput).ToArray(); | ||
|
||
internal static AuthorDto ToOutput(this Author author) | ||
=> new AuthorDto | ||
{ | ||
Id = author.Id, | ||
Name = author.Name, | ||
Biography = author.Biography, | ||
}; | ||
} |
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/GraphR.Application/Books/Handlers/Mutation/CreateBookMutationHandler.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
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/GraphR.Domain/Models/Author.cs → src/GraphR.Domain/Entities/Author.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,4 +1,4 @@ | ||
namespace GrapR.Domain.Models; | ||
namespace GraphR.Domain.Entities; | ||
|
||
public sealed class Author | ||
{ | ||
|
4 changes: 2 additions & 2 deletions
4
src/GraphR.Domain/Models/Book.cs → src/GraphR.Domain/Entities/Book.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
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,4 +1,4 @@ | ||
namespace GrapR.Domain.Enums; | ||
namespace GraphR.Domain.Enums; | ||
|
||
public enum Category | ||
{ | ||
|
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,7 +1,9 @@ | ||
using GrapR.Domain.Models; | ||
using GraphR.Domain.Entities; | ||
|
||
namespace GraphR.Domain.Interfaces; | ||
public interface IAuthorRepository | ||
{ | ||
Task<Author> GetById(int id); | ||
|
||
Task<Author[]> GetAll(); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Dapper.FluentMap.Mapping; | ||
using GraphR.Domain.Entities; | ||
|
||
namespace GraphR.Infrastructure.Maps; | ||
|
||
internal class AuthorMap : EntityMap<Author> | ||
{ | ||
public AuthorMap() | ||
{ | ||
Map(x => x.Id).ToColumn("Id"); | ||
Map(x => x.Name).ToColumn("Name"); | ||
Map(x => x.Biography).ToColumn("Biography"); | ||
} | ||
} |
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