Files
MilkyShots/Butter/Dtos/Stats/StatsDto.cs
REDCODE 54cf5eff2b feat(stats): add percentage and stale counters to completeness cards
- Show percentage of total assets on missing metadata/thumbnail/preview/phash cards
- Add stale counts for thumbnails and previews (generated at wrong resolution vs current settings)
- Add h-100 to all completeness cards for consistent row heights
2026-07-08 19:45:09 +02:00

144 lines
5.2 KiB
C#

using Butter.Types;
namespace Butter.Dtos.Stats;
/// <summary>
/// Comprehensive statistics about the MilkyShots instance, gatherable from fast aggregate queries.
/// </summary>
public class StatsDto {
/// <summary>
/// Gets or sets the total number of assets (excluding soft-deleted).
/// </summary>
public int TotalAssets { get; set; }
/// <summary>
/// Gets or sets the total number of registered users (excluding soft-deleted).
/// </summary>
public int TotalUsers { get; set; }
/// <summary>
/// Gets or sets the total number of albums.
/// </summary>
public int TotalAlbums { get; set; }
/// <summary>
/// Gets or sets the total number of tags.
/// </summary>
public int TotalTags { get; set; }
/// <summary>
/// Gets or sets the total number of people.
/// </summary>
public int TotalPeople { get; set; }
/// <summary>
/// Gets or sets the total number of detected faces.
/// </summary>
public int TotalFaces { get; set; }
/// <summary>
/// Gets or sets the total number of watched folders.
/// </summary>
public int TotalFolders { get; set; }
/// <summary>
/// Gets or sets the asset count broken down by type (Image, Video, Animation, PhotoSphere).
/// </summary>
public Dictionary<EAssetType, int> AssetsByType { get; set; } = [];
/// <summary>
/// Gets or sets the total storage used by all assets in bytes.
/// </summary>
public long TotalStorageBytes { get; set; }
/// <summary>
/// Gets or sets the storage used broken down by asset type.
/// </summary>
public Dictionary<EAssetType, long> StorageByType { get; set; } = [];
/// <summary>
/// Gets or sets the user count broken down by access level.
/// </summary>
public Dictionary<EAccessLevel, int> UsersByAccessLevel { get; set; } = [];
/// <summary>
/// Gets or sets the number of assets added in the last 7 days.
/// </summary>
public int AssetsAddedLast7Days { get; set; }
/// <summary>
/// Gets or sets the number of assets added in the last 30 days.
/// </summary>
public int AssetsAddedLast30Days { get; set; }
/// <summary>
/// Gets or sets the number of users registered in the last 30 days.
/// </summary>
public int UsersRegisteredLast30Days { get; set; }
/// <summary>
/// Gets or sets the number of assets with no associated folder.
/// </summary>
public int OrphanAssets { get; set; }
/// <summary>
/// Gets or sets the number of publicly shared assets.
/// </summary>
public int PublicAssets { get; set; }
/// <summary>
/// Gets or sets the number of non-publicly-shared assets.
/// </summary>
public int PrivateAssets { get; set; }
/// <summary>
/// Gets or sets the number of image assets missing resolution metadata.
/// </summary>
public int AssetsMissingMetadata { get; set; }
/// <summary>
/// Gets or sets the number of assets missing a generated thumbnail.
/// </summary>
public int AssetsMissingThumbnail { get; set; }
/// <summary>
/// Gets or sets the number of assets whose thumbnail was generated at a different size than the current setting.
/// </summary>
public int AssetsMissingThumbnailStale { get; set; }
/// <summary>
/// Gets or sets the number of assets missing a generated preview.
/// </summary>
public int AssetsMissingPreviews { get; set; }
/// <summary>
/// Gets or sets the number of assets whose preview was generated at a different size than the current setting.
/// </summary>
public int AssetsMissingPreviewsStale { get; set; }
/// <summary>
/// Gets or sets the number of assets missing a perceptual hash.
/// </summary>
public int AssetsMissingPhash { get; set; }
/// <summary>
/// Gets or sets the number of assets with no person assigned (no album with a PersonOwner).
/// </summary>
public int AssetsWithNoPerson { get; set; }
/// <summary>
/// Gets or sets the number of assets with no album assigned.
/// </summary>
public int AssetsWithNoAlbum { get; set; }
/// <summary>
/// Gets or sets the number of albums without a cover image.
/// </summary>
public int AlbumsMissingCover { get; set; }
/// <summary>
/// Gets or sets the number of people/cosplayers without an album that has a cover image.
/// </summary>
/// <remarks>Not wired yet — reserved for future use.</remarks>
public int CosplayersMissingCover { get; set; }
/// <summary>
/// Gets or sets the top tags by asset count.
/// </summary>
public List<TagStatDto> TopTags { get; set; } = [];
/// <summary>
/// Gets or sets the resolution distribution of assets.
/// </summary>
public List<ResolutionBucketDto> ResolutionDistribution { get; set; } = [];
/// <summary>
/// Gets or sets the file format breakdown by MIME type.
/// </summary>
public List<MimeTypeStatDto> FileFormatBreakdown { get; set; } = [];
/// <summary>
/// Gets or sets the monthly new-asset and new-user counts for the last 12 months.
/// </summary>
public List<MonthlyStatDto> MonthlyGrowth { get; set; } = [];
}