add the option to override pagination rules

This commit is contained in:
honzapatCZ 2024-10-19 22:50:43 +02:00
parent ef30ef5fb5
commit 538537f2a7

View File

@ -139,6 +139,11 @@ namespace NejCommon.Controllers
return query; return query;
} }
protected virtual Task<PaginationResponse<TGetAllResponse>> ApplyPagination(IQueryable<TType> query, Pagination pag)
{
return query.ApplyPaginationRes<TType, TGetAllResponse>(providers, pag);
}
/// <summary> /// <summary>
/// Get all the <typeparamref name="TType"/> /// Get all the <typeparamref name="TType"/>
/// </summary> /// </summary>
@ -147,7 +152,7 @@ namespace NejCommon.Controllers
[HttpGet] [HttpGet]
public virtual async Task<Results<BadRequest<Error>, Ok<PaginationResponse<TGetAllResponse>>>> GetAll([FromServices] TOwner company, [FromQuery] Pagination pag) public virtual async Task<Results<BadRequest<Error>, Ok<PaginationResponse<TGetAllResponse>>>> GetAll([FromServices] TOwner company, [FromQuery] Pagination pag)
{ {
var data = await ApplyDefaultOrdering(GetQuery(company)).AsNoTrackingWithIdentityResolution().ApplyPaginationRes<TType, TGetAllResponse>(providers, pag); var data = await ApplyPagination(ApplyDefaultOrdering(GetQuery(company)).AsNoTrackingWithIdentityResolution(), pag);
//Console.Writeline(data.Data); //Console.Writeline(data.Data);