From 400faa2fc35cb7c3b95deaf919b283d7e112116f Mon Sep 17 00:00:00 2001 From: Kleidukos Date: Sat, 23 May 2026 16:22:52 +0200 Subject: [PATCH] Created entities for database --- .../Entities/CardMarket/CardMarketSetInfo.cs | 15 +++ OakArchive/Entities/Cards/Attack.cs | 21 +++ OakArchive/Entities/Cards/Card.cs | 57 ++++++++ OakArchive/Entities/Cards/CollectedCard.cs | 32 +++++ OakArchive/Entities/Cards/Weakness.cs | 16 +++ OakArchive/Entities/Collection/Collection.cs | 28 ++++ OakArchive/Entities/Enums/Category.cs | 16 +++ OakArchive/Entities/Enums/Condition.cs | 12 ++ OakArchive/Entities/Enums/GradingCompany.cs | 14 ++ OakArchive/Entities/Enums/Language.cs | 25 ++++ OakArchive/Entities/Enums/Rarity.cs | 124 ++++++++++++++++++ OakArchive/Entities/Enums/Stage.cs | 37 ++++++ OakArchive/Entities/Enums/Variant.cs | 22 ++++ OakArchive/Entities/Grading/Grading.cs | 28 ++++ OakArchive/Entities/Serie/Serie.cs | 24 ++++ OakArchive/Entities/Set/CardCount.cs | 26 ++++ OakArchive/Entities/Set/Legal.cs | 22 ++++ OakArchive/Entities/Set/Set.cs | 36 +++++ OakArchive/Entities/TCGdex/TcgDexCardInfo.cs | 17 +++ .../Entities/TCGdex/TcgDexSeriesInfo.cs | 17 +++ OakArchive/Entities/TCGdex/TcgDexSetInfo.cs | 17 +++ OakArchive/Entities/User/ApplicationUser.cs | 14 ++ OakArchive/Entities/User/Settings.cs | 16 +++ OakArchive/Models/TcgDex/Weakness.cs | 12 ++ .../Util/Extensions/LanguageExtensions.cs | 46 +++++++ 25 files changed, 694 insertions(+) create mode 100644 OakArchive/Entities/CardMarket/CardMarketSetInfo.cs create mode 100644 OakArchive/Entities/Cards/Attack.cs create mode 100644 OakArchive/Entities/Cards/Card.cs create mode 100644 OakArchive/Entities/Cards/CollectedCard.cs create mode 100644 OakArchive/Entities/Cards/Weakness.cs create mode 100644 OakArchive/Entities/Collection/Collection.cs create mode 100644 OakArchive/Entities/Enums/Category.cs create mode 100644 OakArchive/Entities/Enums/Condition.cs create mode 100644 OakArchive/Entities/Enums/GradingCompany.cs create mode 100644 OakArchive/Entities/Enums/Language.cs create mode 100644 OakArchive/Entities/Enums/Rarity.cs create mode 100644 OakArchive/Entities/Enums/Stage.cs create mode 100644 OakArchive/Entities/Enums/Variant.cs create mode 100644 OakArchive/Entities/Grading/Grading.cs create mode 100644 OakArchive/Entities/Serie/Serie.cs create mode 100644 OakArchive/Entities/Set/CardCount.cs create mode 100644 OakArchive/Entities/Set/Legal.cs create mode 100644 OakArchive/Entities/Set/Set.cs create mode 100644 OakArchive/Entities/TCGdex/TcgDexCardInfo.cs create mode 100644 OakArchive/Entities/TCGdex/TcgDexSeriesInfo.cs create mode 100644 OakArchive/Entities/TCGdex/TcgDexSetInfo.cs create mode 100644 OakArchive/Entities/User/ApplicationUser.cs create mode 100644 OakArchive/Entities/User/Settings.cs create mode 100644 OakArchive/Models/TcgDex/Weakness.cs create mode 100644 OakArchive/Util/Extensions/LanguageExtensions.cs diff --git a/OakArchive/Entities/CardMarket/CardMarketSetInfo.cs b/OakArchive/Entities/CardMarket/CardMarketSetInfo.cs new file mode 100644 index 0000000..2e315e2 --- /dev/null +++ b/OakArchive/Entities/CardMarket/CardMarketSetInfo.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using OakArchive.Entities.Cards; + +namespace OakArchive.Entities.CardMarket; + +public class CardMarketSetInfo +{ + [Key] public Guid Id { get; set; } = Guid.NewGuid(); + + public string ExpansionId { get; set; } = string.Empty; + + [ForeignKey(nameof(Set))] public Guid SetId { get; set; } + public virtual Set.Set Set { get; set; } = null!; +} \ No newline at end of file diff --git a/OakArchive/Entities/Cards/Attack.cs b/OakArchive/Entities/Cards/Attack.cs new file mode 100644 index 0000000..12c105f --- /dev/null +++ b/OakArchive/Entities/Cards/Attack.cs @@ -0,0 +1,21 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal; + +namespace OakArchive.Entities.Cards; + +public class Attack +{ + [Key] public Guid Id { get; set; } = Guid.NewGuid(); + + public List Cost { get; set; } = []; + + public string Name { get; set; } = string.Empty; + + public int? Damage { get; set; } + + public string Effect { get; set; } = string.Empty; + + [ForeignKey(nameof(Card))] public Guid CardId { get; set; } + public virtual Card Card { get; set; } = null!; +} \ No newline at end of file diff --git a/OakArchive/Entities/Cards/Card.cs b/OakArchive/Entities/Cards/Card.cs new file mode 100644 index 0000000..2bd9fd9 --- /dev/null +++ b/OakArchive/Entities/Cards/Card.cs @@ -0,0 +1,57 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using OakArchive.Entities.CardMarket; +using OakArchive.Entities.Enums; +using OakArchive.Entities.Set; +using OakArchive.Entities.TCGdex; + +namespace OakArchive.Entities.Cards; + +public class Card +{ + [Key] public Guid Id { get; set; } = Guid.NewGuid(); + + [Required] public string Name { get; set; } = string.Empty; + + public string Image { get; set; } = string.Empty; + + public int CardNumber { get; set; } = 0; + + public ulong PHash { get; set; } = 0; + + public int? Hp { get; set; } + + public int? Retreat { get; set; } + + public string? TrainerType { get; set; } + + public string? EnergyType { get; set; } + + public string? Illustrator { get; set; } + + public string? EvolveFrom { get; set; } + + public string? Description { get; set; } + + public string? RegulationMark { get; set; } + + public Rarity? Rarity { get; set; } + + public Category? Category { get; set; } + + [Column(TypeName = "jsonb")] + public List? Variants { get; set; } + + [Column(TypeName = "jsonb")] public List? Types { get; set; } + + [ForeignKey(nameof(Set))] public Guid SetId { get; set; } + public virtual Set.Set Set { get; set; } = null!; + + public virtual TcgDexCardInfo TcgDexCardInfo { get; set; } = null!; + + public virtual Legal? Legal { get; set; } + + public virtual ICollection Attacks { get; set; } = new List(); + + public virtual ICollection Weaknesses { get; set; } = new List(); +} \ No newline at end of file diff --git a/OakArchive/Entities/Cards/CollectedCard.cs b/OakArchive/Entities/Cards/CollectedCard.cs new file mode 100644 index 0000000..0074db4 --- /dev/null +++ b/OakArchive/Entities/Cards/CollectedCard.cs @@ -0,0 +1,32 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using OakArchive.Entities.Enums; +using OakArchive.Entities.User; + +namespace OakArchive.Entities.Cards; + +public class CollectedCard +{ + [Key] public Guid Id { get; set; } = Guid.NewGuid(); + + public Variant Variant { get; set; } = Variant.Normal; + + public Condition Condition { get; set; } = Condition.Mint; + + public int Count { get; set; } = 1; + + public Language Language { get; set; } = Language.En; + + public DateTime ScannedAt { get; set; } = DateTime.UtcNow; + + [ForeignKey(nameof(ScannedBy))] public Guid ScannedById { get; set; } + public ApplicationUser ScannedBy { get; set; } = null!; + + [ForeignKey(nameof(Collection))] public Guid CollectionId { get; set; } + public virtual Collection.Collection Collection { get; set; } = null!; + + [ForeignKey(nameof(Card))] public Guid CardId { get; set; } + public virtual Card Card { get; set; } = null!; + + public virtual Grading.Grading? Grading { get; set; } +} \ No newline at end of file diff --git a/OakArchive/Entities/Cards/Weakness.cs b/OakArchive/Entities/Cards/Weakness.cs new file mode 100644 index 0000000..95827cd --- /dev/null +++ b/OakArchive/Entities/Cards/Weakness.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace OakArchive.Entities.Cards; + +public class Weakness +{ + [Key] public Guid Id { get; set; } = Guid.NewGuid(); + + public string Type { get; set; } = string.Empty; + + public string Value { get; set; } = string.Empty; + + [ForeignKey(nameof(Card))] public Guid CardId { get; set; } + public virtual Card Card { get; set; } = null!; +} \ No newline at end of file diff --git a/OakArchive/Entities/Collection/Collection.cs b/OakArchive/Entities/Collection/Collection.cs new file mode 100644 index 0000000..2932304 --- /dev/null +++ b/OakArchive/Entities/Collection/Collection.cs @@ -0,0 +1,28 @@ +using System.ComponentModel.DataAnnotations; +using OakArchive.Entities.Cards; +using OakArchive.Entities.User; + +namespace OakArchive.Entities.Collection; + +public class Collection +{ + + [Key] + public Guid Id { get; set; } = Guid.NewGuid(); + + public string Name { get; set; } = string.Empty; + + public string? Description { get; set; } + + public Guid CreatedBy { get; set; } = Guid.Empty; + + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + + public string InviteCode { get; set; } = string.Empty; + + public bool IsPublic { get; set; } = false; + + public virtual ICollection Members { get; set; } = []; + + public virtual ICollection Cards { get; set; } = []; +} \ No newline at end of file diff --git a/OakArchive/Entities/Enums/Category.cs b/OakArchive/Entities/Enums/Category.cs new file mode 100644 index 0000000..a198508 --- /dev/null +++ b/OakArchive/Entities/Enums/Category.cs @@ -0,0 +1,16 @@ +using System.Text.Json.Serialization; + +namespace OakArchive.Entities.Enums; + +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum Category +{ + [JsonPropertyName("Energy")] + Energy, + + [JsonPropertyName("Pokemon")] + Pokemon, + + [JsonPropertyName("Trainer")] + Trainer +} \ No newline at end of file diff --git a/OakArchive/Entities/Enums/Condition.cs b/OakArchive/Entities/Enums/Condition.cs new file mode 100644 index 0000000..5bdee77 --- /dev/null +++ b/OakArchive/Entities/Enums/Condition.cs @@ -0,0 +1,12 @@ +namespace OakArchive.Entities.Enums; + +public enum Condition +{ + Mint = 0, + NearMint = 1, + Excellent = 2, + Good = 3, + LightPlayed = 4, + Played = 5, + Poor = 6 +} \ No newline at end of file diff --git a/OakArchive/Entities/Enums/GradingCompany.cs b/OakArchive/Entities/Enums/GradingCompany.cs new file mode 100644 index 0000000..d1f4250 --- /dev/null +++ b/OakArchive/Entities/Enums/GradingCompany.cs @@ -0,0 +1,14 @@ +namespace OakArchive.Entities.Enums; + +public enum GradingCompany +{ + PSA, + BGS, + CGC, + APGrading, + EGS, + AOG, + PCA, + GSG, + Other +} \ No newline at end of file diff --git a/OakArchive/Entities/Enums/Language.cs b/OakArchive/Entities/Enums/Language.cs new file mode 100644 index 0000000..a1ce778 --- /dev/null +++ b/OakArchive/Entities/Enums/Language.cs @@ -0,0 +1,25 @@ +using System.ComponentModel; + +namespace OakArchive.Entities.Enums; + +public enum Language +{ + En, + Fr, + Es, + Es_Mx, + It, + Pt, + Pt_Br, + Pt_Pt, + De, + Nl, + Pl, + Ru, + Ja, + Ko, + Zh_Tw, + Id, + Th, + Zh_Cn +} \ No newline at end of file diff --git a/OakArchive/Entities/Enums/Rarity.cs b/OakArchive/Entities/Enums/Rarity.cs new file mode 100644 index 0000000..d129cb9 --- /dev/null +++ b/OakArchive/Entities/Enums/Rarity.cs @@ -0,0 +1,124 @@ +using System.Text.Json.Serialization; + +namespace OakArchive.Entities.Enums; + +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum Rarity +{ + [JsonPropertyName("ACE SPEC Rare")] + AceSpecRare, + + [JsonPropertyName("Amazing Rare")] + AmazingRare, + + [JsonPropertyName("Black White Rare")] + BlackWhiteRare, + + [JsonPropertyName("Classic Collection")] + ClassicCollection, + + [JsonPropertyName("Common")] + Common, + + [JsonPropertyName("Crown")] + Crown, + + [JsonPropertyName("Double rare")] + DoubleRare, + + [JsonPropertyName("Four Diamond")] + FourDiamond, + + [JsonPropertyName("Full Art Trainer")] + FullArtTrainer, + + [JsonPropertyName("Holo Rare")] + HoloRare, + + [JsonPropertyName("Holo Rare V")] + HoloRareV, + + [JsonPropertyName("Holo Rare VMAX")] + HoloRareVmax, + + [JsonPropertyName("Holo Rare VSTAR")] + HoloRareVstar, + + [JsonPropertyName("Hyper rare")] + HyperRare, + + [JsonPropertyName("Illustration rare")] + IllustrationRare, + + [JsonPropertyName("LEGEND")] + Legend, + + [JsonPropertyName("Mega Hyper Rare")] + MegaHyperRare, + + [JsonPropertyName("None")] + None, + + [JsonPropertyName("One Diamond")] + OneDiamond, + + [JsonPropertyName("One Shiny")] + OneShiny, + + [JsonPropertyName("One Star")] + OneStar, + + [JsonPropertyName("Radiant Rare")] + RadiantRare, + + [JsonPropertyName("Rare")] + Rare, + + [JsonPropertyName("Rare Holo")] + RareHolo, + + [JsonPropertyName("Rare Holo LV.X")] + RareHoloLvX, + + [JsonPropertyName("Rare PRIME")] + RarePrime, + + [JsonPropertyName("Secret Rare")] + SecretRare, + + [JsonPropertyName("Shiny Ultra Rare")] + ShinyUltraRare, + + [JsonPropertyName("Shiny rare")] + ShinyRare, + + [JsonPropertyName("Shiny rare V")] + ShinyRareV, + + [JsonPropertyName("Shiny rare VMAX")] + ShinyRareVmax, + + [JsonPropertyName("Special illustration rare")] + SpecialIllustrationRare, + + [JsonPropertyName("Three Diamond")] + ThreeDiamond, + + [JsonPropertyName("Three Star")] + ThreeStar, + + [JsonPropertyName("Two Diamond")] + TwoDiamond, + + [JsonPropertyName("Two Shiny")] + TwoShiny, + + [JsonPropertyName("Two Star")] + TwoStar, + + [JsonPropertyName("Ultra Rare")] + UltraRare, + + [JsonPropertyName("Uncommon")] + Uncommon +} \ No newline at end of file diff --git a/OakArchive/Entities/Enums/Stage.cs b/OakArchive/Entities/Enums/Stage.cs new file mode 100644 index 0000000..df2c46a --- /dev/null +++ b/OakArchive/Entities/Enums/Stage.cs @@ -0,0 +1,37 @@ +using System.Text.Json.Serialization; + +namespace OakArchive.Entities.Enums; + +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum Stage +{ + [JsonPropertyName("BREAK")] + Break, + + [JsonPropertyName("Basic")] + Basic, + + [JsonPropertyName("LEVEL-UP")] + LevelUp, + + [JsonPropertyName("MEGA")] + Mega, + + [JsonPropertyName("RESTORED")] + Restored, + + [JsonPropertyName("Stage1")] + Stage1, + + [JsonPropertyName("Stage2")] + Stage2, + + [JsonPropertyName("V-UNION")] + VUnion, + + [JsonPropertyName("VMAX")] + VMax, + + [JsonPropertyName("VSTAR")] + VStar +} \ No newline at end of file diff --git a/OakArchive/Entities/Enums/Variant.cs b/OakArchive/Entities/Enums/Variant.cs new file mode 100644 index 0000000..2126d95 --- /dev/null +++ b/OakArchive/Entities/Enums/Variant.cs @@ -0,0 +1,22 @@ +using System.Text.Json.Serialization; + +namespace OakArchive.Entities.Enums; + +[JsonConverter(typeof(JsonStringEnumConverter))] +public enum Variant +{ + [JsonPropertyName("firstEdition")] + FirstEdition, + + [JsonPropertyName("holo")] + Holo, + + [JsonPropertyName("normal")] + Normal, + + [JsonPropertyName("reverse")] + Reverse, + + [JsonPropertyName("wPromo")] + WPromo +} \ No newline at end of file diff --git a/OakArchive/Entities/Grading/Grading.cs b/OakArchive/Entities/Grading/Grading.cs new file mode 100644 index 0000000..3c15cb4 --- /dev/null +++ b/OakArchive/Entities/Grading/Grading.cs @@ -0,0 +1,28 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using OakArchive.Entities.Cards; +using OakArchive.Entities.Enums; + +namespace OakArchive.Entities.Grading; + +public class Grading +{ + [Key] public Guid Id { get; set; } = Guid.NewGuid(); + + [Required] public GradingCompany Company { get; set; } = GradingCompany.PSA; + [Required] public string CertificateNumber { get; set; } = string.Empty; + + public double Grade { get; set; } + + public double? Centering { get; set; } + public double? Corners { get; set; } + public double? Edges { get; set; } + public double? Surface { get; set; } + + public string? GraderNotes { get; set; } + + public DateTime GradedAt { get; set; } + + [ForeignKey(nameof(CollectedCard))] public Guid CollectedCardId { get; set; } + public virtual CollectedCard CollectedCard { get; set; } = null!; +} \ No newline at end of file diff --git a/OakArchive/Entities/Serie/Serie.cs b/OakArchive/Entities/Serie/Serie.cs new file mode 100644 index 0000000..52133ca --- /dev/null +++ b/OakArchive/Entities/Serie/Serie.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; +using OakArchive.Entities.Enums; +using OakArchive.Entities.TCGdex; + +namespace OakArchive.Entities.Serie; + +public class Serie +{ + [Key] + public Guid Id { get; set; } = Guid.NewGuid(); + + [Required] + public string Name { get; set; } = string.Empty; + + public string? Logo { get; set; } + + public Language? Language { get; set; } + + //public DateTime? ReleaseDate { get; set; } + + public virtual ICollection Sets { get; set; } = new List(); + + public virtual TcgDexSeriesInfo TcgDexSeriesInfo { get; set; } = null!; +} \ No newline at end of file diff --git a/OakArchive/Entities/Set/CardCount.cs b/OakArchive/Entities/Set/CardCount.cs new file mode 100644 index 0000000..efdf346 --- /dev/null +++ b/OakArchive/Entities/Set/CardCount.cs @@ -0,0 +1,26 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace OakArchive.Entities.Set; + +public class CardCount +{ + [Key] public Guid Id { get; set; } = Guid.NewGuid(); + + public int Total { get; set; } = 0; + + public int Official { get; set; } = 0; + + public int Normal { get; set; } = 0; + + public int Reverse { get; set; } = 0; + + public int Holo { get; set; } = 0; + + public int FirstEd { get; set; } = 0; + + [ForeignKey(nameof(Set))] + public Guid SetId { get; set; } + + public virtual Set Set { get; set; } = null!; +} \ No newline at end of file diff --git a/OakArchive/Entities/Set/Legal.cs b/OakArchive/Entities/Set/Legal.cs new file mode 100644 index 0000000..b035cfe --- /dev/null +++ b/OakArchive/Entities/Set/Legal.cs @@ -0,0 +1,22 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using OakArchive.Entities.Cards; + +namespace OakArchive.Entities.Set; + +public class Legal +{ + [Key] public Guid Id { get; set; } = Guid.NewGuid(); + + public bool Expanded { get; set; } = false; + + public bool Standard { get; set; } = false; + + [ForeignKey(nameof(Set))] + public Guid? SetId { get; set; } + public virtual Set? Set { get; set; } + + [ForeignKey(nameof(Card))] + public Guid? CardId { get; set; } + public virtual Card? Card { get; set; } +} \ No newline at end of file diff --git a/OakArchive/Entities/Set/Set.cs b/OakArchive/Entities/Set/Set.cs new file mode 100644 index 0000000..2c1b46f --- /dev/null +++ b/OakArchive/Entities/Set/Set.cs @@ -0,0 +1,36 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using OakArchive.Entities.CardMarket; +using OakArchive.Entities.Cards; +using OakArchive.Entities.Enums; +using OakArchive.Entities.TCGdex; + +namespace OakArchive.Entities.Set; + +public class Set +{ + [Key] public Guid Id { get; set; } = Guid.NewGuid(); + + [Required] public string Name { get; set; } = string.Empty; + + public string? Symbol { get; set; } + + public string? Logo { get; set; } + + public Language Language { get; set; } = Language.En; + + public DateTime? ReleaseDate { get; set; } + + public ICollection Cards { get; set; } = new List(); + + public virtual TcgDexSetInfo SetInfo { get; set; } = null!; + + public virtual CardMarketSetInfo CardMarketSetInfo { get; set; } = null!; + + [ForeignKey(nameof(Serie))] public Guid SerieId { get; set; } + public virtual Serie.Serie Serie { get; set; } = null!; + + public virtual CardCount CardCount { get; set; } = null!; + + public virtual Legal? Legal { get; set; } +} \ No newline at end of file diff --git a/OakArchive/Entities/TCGdex/TcgDexCardInfo.cs b/OakArchive/Entities/TCGdex/TcgDexCardInfo.cs new file mode 100644 index 0000000..ac9562d --- /dev/null +++ b/OakArchive/Entities/TCGdex/TcgDexCardInfo.cs @@ -0,0 +1,17 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using OakArchive.Entities.Cards; + +namespace OakArchive.Entities.TCGdex; + +public class TcgDexCardInfo +{ + [Key] public Guid Id { get; set; } = Guid.NewGuid(); + + [Required] public string FullId { get; set; } = string.Empty; + + [Required] public int LocalId { get; set; } = 0; + + [ForeignKey(nameof(Card))] public Guid CardId { get; set; } + public virtual Card Card { get; set; } = null!; +} \ No newline at end of file diff --git a/OakArchive/Entities/TCGdex/TcgDexSeriesInfo.cs b/OakArchive/Entities/TCGdex/TcgDexSeriesInfo.cs new file mode 100644 index 0000000..39a547c --- /dev/null +++ b/OakArchive/Entities/TCGdex/TcgDexSeriesInfo.cs @@ -0,0 +1,17 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace OakArchive.Entities.TCGdex; + +public class TcgDexSeriesInfo +{ + [Key] + public Guid Id { get; set; } = Guid.NewGuid(); + + [Required] + public string SeriesId { get; set; } = string.Empty; + + [ForeignKey(nameof(Set))] + public Guid SeriesIdRef { get; set; } + public virtual Serie.Serie Series { get; set; } = null!; +} \ No newline at end of file diff --git a/OakArchive/Entities/TCGdex/TcgDexSetInfo.cs b/OakArchive/Entities/TCGdex/TcgDexSetInfo.cs new file mode 100644 index 0000000..df6bd2a --- /dev/null +++ b/OakArchive/Entities/TCGdex/TcgDexSetInfo.cs @@ -0,0 +1,17 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace OakArchive.Entities.TCGdex; + +public class TcgDexSetInfo +{ + [Key] + public Guid Id { get; set; } = Guid.NewGuid(); + + [Required] + public string SetId { get; set; } = string.Empty; + + [ForeignKey(nameof(Set))] + public Guid SetIdRef { get; set; } + public virtual Set.Set Set { get; set; } = null!; +} \ No newline at end of file diff --git a/OakArchive/Entities/User/ApplicationUser.cs b/OakArchive/Entities/User/ApplicationUser.cs new file mode 100644 index 0000000..3218176 --- /dev/null +++ b/OakArchive/Entities/User/ApplicationUser.cs @@ -0,0 +1,14 @@ +using Microsoft.AspNetCore.Identity; + +namespace OakArchive.Entities.User; + +public class ApplicationUser : IdentityUser +{ + public DateTime CreatedAt { get; set; } = DateTime.UtcNow; + + public virtual Settings Settings { get; set; } = new(); + + private Collection.Collection DefaultCollection { get; set; } = new(); + + public virtual ICollection Collections { get; set; } = []; +} \ No newline at end of file diff --git a/OakArchive/Entities/User/Settings.cs b/OakArchive/Entities/User/Settings.cs new file mode 100644 index 0000000..8d9ab6c --- /dev/null +++ b/OakArchive/Entities/User/Settings.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace OakArchive.Entities.User; + +public class Settings +{ + [Key] + public Guid Id { get; set; } = Guid.NewGuid(); + + public bool AddCardsToDefaultList { get; set; } = true; + + [ForeignKey(nameof(User))] + public Guid UserId { get; set; } + public virtual ApplicationUser User { get; set; } = null!; +} \ No newline at end of file diff --git a/OakArchive/Models/TcgDex/Weakness.cs b/OakArchive/Models/TcgDex/Weakness.cs new file mode 100644 index 0000000..e4c8d1f --- /dev/null +++ b/OakArchive/Models/TcgDex/Weakness.cs @@ -0,0 +1,12 @@ +using System.Text.Json.Serialization; + +namespace OakArchive.Models.TcgDex; + +public class Weakness +{ + [JsonPropertyName("type")] + public string? Type { get; set; } + + [JsonPropertyName("value")] + public string? Value { get; set; } +} \ No newline at end of file diff --git a/OakArchive/Util/Extensions/LanguageExtensions.cs b/OakArchive/Util/Extensions/LanguageExtensions.cs new file mode 100644 index 0000000..ddace1f --- /dev/null +++ b/OakArchive/Util/Extensions/LanguageExtensions.cs @@ -0,0 +1,46 @@ +using OakArchive.Entities.Enums; + +namespace OakArchive.Util.Extensions; + +public static class LanguageExtensions +{ + public static string ToApiCode(this Language lang) + { + return lang switch + { + Language.Es_Mx => "es-mx", + Language.Pt_Br => "pt-br", + Language.Pt_Pt => "pt-pt", + Language.Zh_Tw => "zh-tw", + Language.Zh_Cn => "zh-cn", + _ => lang.ToString().ToLower() + }; + } + + // Ein zusätzliches Feld für deine Avalonia-UI (Anzeigename) + public static string GetDisplayName(this Language lang) + { + return lang switch + { + Language.En => "English", + Language.Fr => "Français", + Language.Es => "Español", + Language.Es_Mx => "Español (México)", + Language.It => "Italiano", + Language.Pt => "Português", + Language.Pt_Br => "Português (Brasil)", + Language.Pt_Pt => "Português (Portugal)", + Language.De => "Deutsch", + Language.Nl => "Nederlands", + Language.Pl => "Polski", + Language.Ru => "Русский", + Language.Ja => "日本語", + Language.Ko => "한국어", + Language.Zh_Tw => "繁體中文 (Taiwan)", + Language.Id => "Bahasa Indonesia", + Language.Th => "ไทย", + Language.Zh_Cn => "简体中文 (China)", + _ => lang.ToString() + }; + } +} \ No newline at end of file