refactor post reactions
This commit is contained in:
parent
2519fc77d2
commit
5379d29c5f
13 changed files with 129 additions and 97 deletions
|
@ -3,22 +3,27 @@ using Femto.Modules.Blog.Application.Queries.GetPosts.Dto;
|
|||
|
||||
namespace Femto.Modules.Blog.Application.Queries.GetPosts;
|
||||
|
||||
/// <summary>
|
||||
/// Get posts in reverse chronological order
|
||||
/// </summary>
|
||||
/// <param name="CurrentUserId"></param>
|
||||
public record GetPostsQuery(Guid? CurrentUserId) : IQuery<GetPostsQueryResult>
|
||||
{
|
||||
public Guid? From { get; init; }
|
||||
/// <summary>
|
||||
/// Id of the specific post to load. If specified, After and Amount are ignored
|
||||
/// </summary>
|
||||
public Guid? PostId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// If specified, loads posts from after the given Id. Used for paging
|
||||
/// </summary>
|
||||
public Guid? After { get; init; }
|
||||
public int Amount { get; init; } = 20;
|
||||
public Guid? AuthorId { get; init; }
|
||||
public string? Author { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Default is to load in reverse chronological order
|
||||
/// TODO this is not exposed on the client as it probably wouldn't work that well
|
||||
/// </summary>
|
||||
public GetPostsDirection Direction { get; init; } = GetPostsDirection.Backward;
|
||||
}
|
||||
|
||||
public enum GetPostsDirection
|
||||
{
|
||||
Forward,
|
||||
Backward,
|
||||
}
|
||||
public GetPostsQuery(Guid postId, Guid? currentUserId) : this(currentUserId)
|
||||
{
|
||||
this.PostId = postId;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue