Add AlbumTotalCount [NotMapped] to Person model, set before pagination in FindVisible, read in PersonMapper instead of paginated Albums.Count. Also apply inline aspect-ratio only in masonry mode so grid mode uses CSS aspect-ratio: 1 for square crops.
89 lines
2.6 KiB
C#
89 lines
2.6 KiB
C#
using Butter.Types;
|
||
using System.ComponentModel.DataAnnotations;
|
||
using System.ComponentModel.DataAnnotations.Schema;
|
||
|
||
namespace Lactose.Models;
|
||
|
||
/// <summary>
|
||
/// Represents a person with associated metadata and navigation properties.
|
||
/// </summary>
|
||
public class Person {
|
||
/// <summary>
|
||
/// Gets or sets the unique identifier for the person.
|
||
/// </summary>
|
||
[Key]
|
||
public Guid Id { get; set; }
|
||
|
||
/// <summary>
|
||
/// Gets or sets the name of the person.
|
||
/// </summary>
|
||
[Column(TypeName = "VARCHAR(255)")]
|
||
public string Name { get; set; } = string.Empty;
|
||
|
||
/// <summary>
|
||
/// Gets or sets the creation date and time of the person record.
|
||
/// </summary>
|
||
[Required]
|
||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||
|
||
/// <summary>
|
||
/// Gets or sets the date and time when the person record was last updated.
|
||
/// </summary>
|
||
public DateTime? UpdatedAt { get; set; }
|
||
|
||
/// <summary>
|
||
/// Gets or sets the asset ID used as the profile picture for this person.
|
||
/// </summary>
|
||
public Guid? ProfileAssetId { get; set; }
|
||
|
||
/// <summary>
|
||
/// Gets or sets the horizontal crop offset for the profile picture (0–100, default 50 = center).
|
||
/// </summary>
|
||
public float? ProfileCropX { get; set; }
|
||
|
||
/// <summary>
|
||
/// Gets or sets the vertical crop offset for the profile picture (0–100, default 50 = center).
|
||
/// </summary>
|
||
public float? ProfileCropY { get; set; }
|
||
|
||
/// <summary>
|
||
/// Gets or sets the zoom level for the profile picture (1.0 = fit, higher = more zoomed in).
|
||
/// </summary>
|
||
public float? ProfileCropZoom { get; set; }
|
||
|
||
/// <summary>
|
||
/// Gets or sets the visibility level of the person.
|
||
/// </summary>
|
||
public EVisibility Visibility { get; set; }
|
||
|
||
#region Navigation Properties
|
||
|
||
/// <summary>
|
||
/// Gets or sets the profile picture asset.
|
||
/// </summary>
|
||
public Asset? ProfileAsset { get; set; }
|
||
|
||
/// <summary>
|
||
/// Gets or sets the list of faces associated with the person.
|
||
/// </summary>
|
||
public List<Face>? Faces { get; set; }
|
||
|
||
/// <summary>
|
||
/// Gets or sets the list of albums associated with the person.
|
||
/// </summary>
|
||
public List<Album>? Albums { get; set; }
|
||
|
||
/// <summary>
|
||
/// Gets or sets the list of users who maintain this cosplayer.
|
||
/// </summary>
|
||
public List<User>? Maintainers { get; set; }
|
||
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// Gets or sets the total number of albums (before pagination).
|
||
/// Populated by <c>FindVisible</c>; ignored by EF Core.
|
||
/// </summary>
|
||
[NotMapped]
|
||
public int AlbumTotalCount { get; set; }
|
||
} |