Updated the tagging code from cohle

- Uses a List<string> as the underlying type which EF Core will serialize as JSON. Since SQLite doesn't have any native JSON features, it gets stored as TEXT
- Got rid of the alternate pathway used for selecting an image so it always has a degree of randomness assuming enough images were returned
- Simplified some of the existing Regex and removed the non capturing groups as they're cancerous
- Added/removed images will be spoilered.
- Added a metadata property for images. This is a JSON object that EF Core will serialize/deserialize for you and presently contains the user ID of whoever added the image as well as when it was added. Can be easily extended with no migration needed. Will be null for existing images.
- Added a migration process for moving Tags to TagList for fishtank
This commit is contained in:
barelyprofessional
2026-05-10 15:30:54 -05:00
parent 7df7e7dadf
commit d71819819d
9 changed files with 1504 additions and 76 deletions

View File

@@ -14,6 +14,8 @@ public class ApplicationDbContext : DbContext
{
//modelBuilder.Entity<KasinoShopProfileDbModel>()
// .OwnsOne(p => p.StateData, b => b.ToJson());
modelBuilder.Entity<ImageDbModel>().
OwnsOne(p => p.Metadata, b => b.ToJson());
}
public DbSet<UserDbModel> Users { get; set; }