feat: refund tracked storage usage on deletion and replacement

Persist per-file storage receipts, preserve refundability on rename, account for PDF replacements and permit deletion at the consumption limit. Update CGU, installation documentation and regression tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Paul Schneider 2026-11-08 05:40:08 +00:00
commit ed8f41bd4a
Signed by: notazof
GPG key ID: AD4B9B545FBD7D12
17 changed files with 5636 additions and 65 deletions

View file

@ -145,6 +145,7 @@ namespace Yavsc.Models
builder.Entity<ApplicationUser>().HasMany<ChatConnection>(c => c.Connections);
builder.Entity<ApplicationUser>().Property(u => u.Avatar).HasDefaultValue(Constants.DefaultAvatar);
builder.Entity<ApplicationUser>().Property(u => u.DiskQuota).HasDefaultValue(Constants.DefaultFSQ);
builder.Entity<ResourceStorageRecord>().HasKey(r => new { r.UserId, r.Path });
builder.Entity<ApplicationUser>().HasAlternateKey(u => u.Email);
builder.Entity<BlackListed>().HasOne<ApplicationUser>(bl => bl.User);
builder.Entity<BlackListed>().HasOne<ApplicationUser>(bl => bl.Owner);
@ -380,6 +381,7 @@ namespace Yavsc.Models
public DbSet<Estimate> Estimates { get; set; }
public DbSet<Signature> Signatures { get; set; }
public DbSet<ResourceUsageRecord> ResourceUsageRecords { get; set; }
public DbSet<ResourceStorageRecord> ResourceStorageRecords { get; set; }
public DbSet<ResourceSubscription> ResourceSubscriptions { get; set; }
public DbSet<ResourceSubscriptionPayment> ResourceSubscriptionPayments { get; set; }
public DbSet<AccountBalance> BankStatus { get; set; }

View file

@ -0,0 +1,13 @@
#nullable enable
using System.ComponentModel.DataAnnotations;
namespace Yavsc.Models;
public sealed class ResourceStorageRecord
{
[MaxLength(450)]
public string UserId { get; set; } = "";
[MaxLength(1024)]
public string Path { get; set; } = "";
public long Bytes { get; set; }
}