mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-11 16:49:34 -04:00
- 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
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
namespace KfChatDotNetBot.Models.DbModels;
|
|
|
|
public class ImageDbModel
|
|
{
|
|
public int Id { get; set; }
|
|
public required string Key { get; set; }
|
|
public required string Url { get; set; }
|
|
public required DateTimeOffset LastSeen { get; set; }
|
|
[Obsolete("Use TagList instead")]
|
|
public string? Tags { get; set; }
|
|
/// <summary>
|
|
/// List of image tags for recalling specific images
|
|
/// </summary>
|
|
public required List<string> TagList { get; set; } = [];
|
|
|
|
/// <summary>
|
|
/// JSON object containing whatever bullshit metadata we want to attach to this image
|
|
/// Value will be null for images that were added prior to metadata being introduced
|
|
/// </summary>
|
|
public required ImageMetadataModel? Metadata { get; set; }
|
|
}
|
|
|
|
public class ImageMetadataModel
|
|
{
|
|
/// <summary>
|
|
/// User ID (IN THE BOT, NOT KIWI FARMS USER ID) of whoever added this image
|
|
/// </summary>
|
|
public required int AddedByUserId { get; set; }
|
|
|
|
/// <summary>
|
|
/// When the image was added to the database
|
|
/// </summary>
|
|
public required DateTimeOffset WhenAdded { get; set; }
|
|
} |