initial upload

This commit is contained in:
kkb 2023-09-21 18:58:32 +02:00
parent a0aa9cc28e
commit f857f43df4
553 changed files with 46169 additions and 13 deletions

View file

@ -0,0 +1,49 @@
using System.Text.Json.Serialization;
namespace Insight.Infrastructure.Models
{
public class PagedList<T>
{
public PagedMetaData Meta { get; } = new();
public IEnumerable<T> Data { get; }
public PagedList(IEnumerable<T> data, int offset, int limit, long total)
{
Data = data;
Meta = new()
{
Offset = offset,
Limit = limit,
Count = data?.Count() ?? 0,
Total = total,
};
}
}
public class PagedDataRequest
{
[JsonPropertyName("offset")]
public int Offset { get; set; } = 0;
[JsonPropertyName("limit")]
public int Limit { get; set; } = 10;
}
public class PagedHeaderData : PagedDataRequest
{
[JsonPropertyName("count")]
public int Count { get; set; } = 0;
[JsonPropertyName("total")]
public long Total { get; set; } = 0;
}
public class PagedMetaData : PagedHeaderData
{
[JsonPropertyName("next")]
public string? Next { get; set; }
[JsonPropertyName("previous")]
public string? Previous { get; set; }
}
}