diff --git a/src/Models/QueryOptions.cs b/src/Models/QueryOptions.cs index 805dba2..eb28584 100644 --- a/src/Models/QueryOptions.cs +++ b/src/Models/QueryOptions.cs @@ -1,15 +1,21 @@ namespace Behlog.Core.Models; /// -/// Base class for Query filter data classes. Can be used to filter query results. +/// Base class for Query filter data classes. Can be used to filter query results +/// and apply pagingations to the result. /// public class QueryOptions { + private QueryOptions() + { + } + public int PageNumber { get; set; } = 1; public int PageSize { get; set; } = 10; public int StartIndex => (PageNumber * PageSize) - PageSize; public string OrderBy { get; set; } public bool OrderDesc { get; set; } + public string? Search { get; set; } public static QueryOptions New() { @@ -27,5 +33,22 @@ public QueryOptions WithPageSize(int pageSize) PageSize = pageSize; return this; } - + + public QueryOptions WillOrderBy(string orderBy) + { + OrderBy = orderBy; + return this; + } + + public QueryOptions WillOrderDesc() + { + OrderDesc = true; + return this; + } + + public QueryOptions SearchingFor(string search) + { + Search = search; + return this; + } } \ No newline at end of file