femto-backend/Femto.Modules.Blog/Application/Queries/GetPosts/GetPostsQuery.cs
2025-08-10 18:12:16 +02:00

29 lines
No EOL
902 B
C#

using Femto.Common.Domain;
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>
{
/// <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; }
public GetPostsQuery(Guid postId, Guid? currentUserId) : this(currentUserId)
{
this.PostId = postId;
}
}