Sticker icon

This commit is contained in:
2025-12-04 00:19:36 +08:00
parent ee5c7cb7ce
commit eaeaa28c60
6 changed files with 88 additions and 48 deletions

View File

@@ -38,7 +38,7 @@ public class SnCustomApp : ModelBase, IIdentifiedResource
[NotMapped]
public SnDeveloper Developer => Project.Developer;
[NotMapped] public string ResourceIdentifier => "custom-app:" + Id;
[NotMapped] public string ResourceIdentifier => "developer.app:" + Id;
public Proto.CustomApp ToProto()
{

View File

@@ -50,5 +50,5 @@ public class FilePool : ModelBase, IIdentifiedResource
public Guid? AccountId { get; set; }
public string ResourceIdentifier => $"file-pool/{Id}";
public string ResourceIdentifier => $"file.pool:{Id}";
}

View File

@@ -11,47 +11,33 @@ public class SnSticker : ModelBase, IIdentifiedResource
{
public Guid Id { get; set; } = Guid.NewGuid();
[MaxLength(128)]
public string Slug { get; set; } = null!;
// Outdated fields, for backward compability
[MaxLength(32)]
public string? ImageId { get; set; }
[Column(TypeName = "jsonb")]
public SnCloudFileReferenceObject? Image { get; set; } = null!;
[MaxLength(128)] public string Slug { get; set; } = null!;
[Column(TypeName = "jsonb")] public SnCloudFileReferenceObject Image { get; set; } = null!;
public Guid PackId { get; set; }
[IgnoreMember] [JsonIgnore] public StickerPack Pack { get; set; } = null!;
[JsonIgnore]
public StickerPack Pack { get; set; } = null!;
public string ResourceIdentifier => $"sticker/{Id}";
public string ResourceIdentifier => $"sticker:{Id}";
}
[Index(nameof(Prefix), IsUnique = true)]
public class StickerPack : ModelBase
public class StickerPack : ModelBase, IIdentifiedResource
{
public Guid Id { get; set; } = Guid.NewGuid();
[MaxLength(1024)]
public string Name { get; set; } = null!;
[Column(TypeName = "jsonb")] public SnCloudFileReferenceObject? Icon { get; set; }
[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!;
[MaxLength(4096)]
public string Description { get; set; } = string.Empty;
[MaxLength(128)]
public string Prefix { get; set; } = null!;
[IgnoreMember]
public List<SnSticker> Stickers { get; set; } = [];
[IgnoreMember]
[JsonIgnore]
public List<StickerPackOwnership> Ownerships { get; set; } = [];
[IgnoreMember] [JsonIgnore] public List<StickerPackOwnership> Ownerships { get; set; } = [];
public Guid PublisherId { get; set; }
public SnPublisher Publisher { get; set; } = null!;
public string ResourceIdentifier => $"sticker.pack:{Id}";
}
public class StickerPackOwnership : ModelBase
@@ -62,6 +48,5 @@ public class StickerPackOwnership : ModelBase
public StickerPack Pack { get; set; } = null!;
public Guid AccountId { get; set; }
[NotMapped]
public SnAccount Account { get; set; } = null!;
}
[NotMapped] public SnAccount Account { get; set; } = null!;
}