add csfloat api usage

This commit is contained in:
bob
2026-05-29 22:08:32 -05:00
parent b51f1d9f5f
commit d1752b1b07
37 changed files with 6095 additions and 22 deletions

View File

@@ -8,19 +8,34 @@ public class SkinInstanceConfiguration : IEntityTypeConfiguration<SkinInstance>
{
public void Configure(EntityTypeBuilder<SkinInstance> entity)
{
entity.Property(e => e.FloatValue).HasColumnType("numeric(10,9)");
// Full precision so exact-match dupe detection isn't defeated by rounding.
// CSFloat returns deterministic ~17-digit floats; numeric(20,18) holds them.
entity.Property(e => e.FloatValue).HasColumnType("numeric(20,18)");
// Primary lookup key for trade fingerprinting.
entity.HasIndex(e => e.FloatValue);
entity.HasIndex(e => e.PaintSeed);
// The fingerprint that identifies a physical item. NOT unique: duped items
// legitimately share a fingerprint, and detecting that collision is the
// point. Indexed for fast fingerprint resolution during the sweep.
entity.HasIndex(e => new
{
e.SkinId,
e.FloatValue,
e.PaintSeed,
e.StatTrak,
e.Souvenir,
});
// Surfacing fresh dupes is a hot query.
entity.HasIndex(e => e.SuspectedDupe);
entity.HasOne(e => e.Skin)
.WithMany(s => s.Instances)
.HasForeignKey(e => e.SkinId);
// Condition is optional now (derived from float later); set null on delete
// rather than restrict so condition rows can change without blocking.
entity.HasOne(e => e.Condition)
.WithMany(c => c.Instances)
.HasForeignKey(e => e.ConditionId)
.OnDelete(DeleteBehavior.Restrict);
.OnDelete(DeleteBehavior.SetNull);
}
}