Sticker pack ownerships

This commit is contained in:
2025-08-06 02:36:39 +08:00
parent e0ebed7c09
commit 999ba52003
6 changed files with 2311 additions and 6 deletions

View File

@@ -1,5 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
using DysonNetwork.Pass.Account;
using DysonNetwork.Shared.Data;
using Microsoft.EntityFrameworkCore;
@@ -13,11 +15,11 @@ public class Sticker : ModelBase, IIdentifiedResource
// Outdated fields, for backward compability
[MaxLength(32)] public string? ImageId { get; set; }
[Column(TypeName = "jsonb")] public CloudFileReferenceObject? Image { get; set; } = null!;
public Guid PackId { get; set; }
public StickerPack Pack { get; set; } = null!;
[JsonIgnore] public StickerPack Pack { get; set; } = null!;
public string ResourceIdentifier => $"sticker:{Id}";
}
@@ -29,8 +31,19 @@ public class StickerPack : ModelBase
[MaxLength(1024)] public string Name { get; set; } = null!;
[MaxLength(4096)] public string Description { get; set; } = string.Empty;
[MaxLength(128)] public string Prefix { get; set; } = null!;
public List<Sticker> Stickers { get; set; } = new();
public Guid PublisherId { get; set; }
public Publisher.Publisher Publisher { get; set; } = null!;
}
public class StickerPackOwnership : ModelBase
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid PackId { get; set; }
public StickerPack Pack { get; set; } = null!;
public Guid AccountId { get; set; }
[NotMapped] public Account Account { get; set; } = null!;
}