Wonky.Client/Wonky.Entity/Requests/CatalogPager.cs

64 lines
1.9 KiB
C#
Raw Normal View History

2022-03-11 14:21:04 +01:00
// Copyright (C) 2022 FCS Frede's Computer Services.
// This program is free software: you can redistribute it and/or modify
2022-05-31 19:07:39 +02:00
// it under the terms of the GNU Affero General Public License as
2022-03-11 14:21:04 +01:00
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2022-05-31 19:07:39 +02:00
// GNU Affero General Public License for more details.
2022-03-11 14:21:04 +01:00
//
2022-05-31 19:07:39 +02:00
// You should have received a copy of the GNU Affero General Public License
2022-03-11 14:21:04 +01:00
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
//
2022-07-04 11:14:24 +02:00
namespace Wonky.Entity.Requests;
2022-03-11 14:21:04 +01:00
2023-01-16 13:53:09 +01:00
public class CatalogPager
2022-03-11 14:21:04 +01:00
{
2022-07-01 10:02:29 +02:00
/// <summary>
/// internal default page size
/// </summary>
2022-04-03 11:50:33 +02:00
private int _pageSize = 5;
2022-07-01 10:02:29 +02:00
/// <summary>
/// internal max page size
/// </summary>
private const int MaxPageSize = 50;
2022-07-01 10:02:29 +02:00
/// <summary>
/// Set the page number to return
/// </summary>
public int PageNumber { get; set; } = 1;
2022-07-01 10:02:29 +02:00
/// <summary>
/// Set the page size to return
/// </summary>
public int PageSize
2022-03-11 14:21:04 +01:00
{
get => _pageSize;
set => _pageSize = (value > MaxPageSize) ? MaxPageSize : value;
2022-03-11 14:21:04 +01:00
}
2022-07-01 10:02:29 +02:00
/// <summary>
/// Set the search term to use
/// </summary>
public string SearchTerm { get; set; } = "";
2022-07-01 10:02:29 +02:00
/// <summary>
/// Set the column used for search
/// </summary>
public string SearchColumn { get; set; } = "name";
2022-07-01 10:02:29 +02:00
/// <summary>
/// Set column used to order the result
/// </summary>
2022-04-03 11:50:33 +02:00
public string OrderBy { get; set; } = "name";
2022-07-01 10:02:29 +02:00
/// <summary>
/// Set product group filter
/// </summary>
public string SelectGroup { get; set; } = "";
2022-03-11 14:21:04 +01:00
}