Path: redb/redb.Templates/templates/redb-bff/RedbBff.Models/Dtos.cs
Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb
Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Templates/templates/redb-bff/RedbBff.Models/Dtos.cs
----
using System.ComponentModel.DataAnnotations;
namespace RedbBff.Models;
/// A product as the API sends and receives it. Validation runs on the form and again in the backend.
public sealed class ProductDto
{
public long Id { get; set; }
[Required, StringLength(200)]
public string Name { get; set; } = "";
[Required, StringLength(100)]
public string Category { get; set; } = "";
[Range(0, 1_000_000)]
public decimal Price { get; set; }
public bool InStock { get; set; }
[StringLength(2000)]
public string? Description { get; set; }
}
/// One page of the product list, and the total the filter matches.
public sealed class ProductPage
{
public List Items { get; set; } = [];
public int Total { get; set; }
public int Page { get; set; }
public int PageSize { get; set; }
}
/// A node of the category tree with its children.
public sealed class CategoryNode
{
public long Id { get; set; }
public string Name { get; set; } = "";
public List Children { get; set; } = [];
}
public sealed class NewCategory
{
[Required, StringLength(100)]
public string Name { get; set; } = "";
/// The parent node; null for a top-level category.
public long? ParentId { get; set; }
}
/// The body of an error answer.
public sealed class ApiError
{
public string Message { get; set; } = "";
}