-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve layout and move interaction to content store client
* Use Dapr Client to invoke the content store * Move logic for API integration to separate client class * Move pending papers list to dedicated query
- Loading branch information
Showing
11 changed files
with
163 additions
and
89 deletions.
There are no files selected for viewing
6 changes: 4 additions & 2 deletions
6
apps/contentstore/PaperBoy.ContentStore/Application/Projections/IPaperInfoRepository.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,8 +1,10 @@ | ||
using PaperBoy.ContentStore.Domain; | ||
using PaperBoy.ContentStore.Shared; | ||
|
||
namespace PaperBoy.ContentStore.Application.Projections; | ||
|
||
public interface IPaperInfoRepository | ||
{ | ||
Task<PaperInfo?> GetByIdAsync(Guid id); | ||
Task<PagedResult<PaperInfo>> GetAllAsync(int page, int pageSize); | ||
Task<PagedResult<PaperInfo>> GetByStatusAsync(string status, int page, int pageSize); | ||
Task<PagedResult<PaperInfo>> GetPendingAsync(int page, int pageSize); | ||
} |
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,3 +1,3 @@ | ||
namespace PaperBoy.ContentStore.Application.Projections; | ||
namespace PaperBoy.ContentStore.Shared; | ||
|
||
public record PagedResult<T>(IEnumerable<T> Items, int Page, int PageSize, int TotalCount); |
19 changes: 19 additions & 0 deletions
19
apps/dashboard/PaperBoy.Dashboard/Clients/ContentStore/ContentStoreClient.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,19 @@ | ||
using Dapr.Client; | ||
|
||
namespace PaperBoy.Dashboard.Clients.ContentStore; | ||
|
||
public interface IContentStoreClient | ||
{ | ||
Task<PagedResult<PaperInfo>> GetPendingPapersAsync(PaperStatus[] statuses, int pageIndex); | ||
} | ||
|
||
public class ContentStoreClient(DaprClient daprClient) : IContentStoreClient | ||
{ | ||
public async Task<PagedResult<PaperInfo>> GetPendingPapersAsync(PaperStatus[] statuses, int pageIndex) | ||
{ | ||
var statusFilter = string.Join(",", statuses.Select(x => x.ToString())); | ||
|
||
return await daprClient.InvokeMethodAsync<PagedResult<PaperInfo>>(HttpMethod.Get, "contentstore", | ||
"/papers/pending"); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
apps/dashboard/PaperBoy.Dashboard/Clients/ContentStore/PagedResult.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,7 @@ | ||
namespace PaperBoy.Dashboard.Clients.ContentStore; | ||
|
||
public record PagedResult<T>(IEnumerable<T> Items, int Page, int PageSize, int TotalCount) | ||
{ | ||
public bool HasPreviousPage => Page > 0; | ||
public bool HasNextPage => (Page + 1) * PageSize < TotalCount; | ||
} |
4 changes: 1 addition & 3 deletions
4
...rd/PaperBoy.Dashboard/Models/PaperInfo.cs → ...shboard/Clients/ContentStore/PaperInfo.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
Oops, something went wrong.