Code2Gether-Discord / JokesOnYou

A learning project, A jokes website build as a team project.
12 stars 11 forks source link

Feature: Make Jokes Returned in Pages. #177

Closed HellHunterMax closed 2 years ago

HellHunterMax commented 2 years ago

Jokes on a pages should be limited. 10 jokes per page?

Example how it could be done sort of


/// <summary>
    /// Special filter for book entities
    /// </summary>
    public class BookFilter : Filter
    {
        /// <summary>
        /// We need to implement special filter. We want to give a user a way to search for specific year 
        /// when books were published.
        /// </summary>
        public int? PublishedAt { get; set; }
    }
    /// <summary>
    /// General filter
    /// </summary>
    public class Filter
    {
        /// <summary>
        /// General search through all meaningfull parameters.
        /// </summary>
        public string Search { get; set; }

        /// <summary>
        /// How many entities should be in Response. If we have 100 books, we but 10 in Count, the API will return 10.
        /// Should be applied after search and sorting
        /// </summary>
        public int Count { get; set; } = 10;

        /// <summary>
        /// How many entities should be skipped. For example, we've already showed 3 pages (or 30 entities with infinite scroll)
        /// and how we need to load entities from 31 to 41. So we make Offset equal to 30. Should be applied after search and sorting
        /// </summary>
        public int Offset { get; set; } = 0;

        /// <summary>
        /// Sort by which field. We can pass "author" and the results will be sorted by autor's names.
        /// </summary>
        public string SortBy { get; set; }

        /// <summary>
        /// If we need Descending sorting we might pass "true" here
        /// </summary>
        public bool SortDesc { get; set; } = false;
    }