Вынесение модели в отдельный проект

This commit is contained in:
2025-04-18 12:20:15 +04:00
parent df7f01938f
commit e1ec15d03e
96 changed files with 974 additions and 7683 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
using Pf2eDataScrapper.Model;
using Pf2eModel.Model;
using Slugify;
namespace Pf2eDataScrapper.Importers;
@@ -1,5 +1,4 @@
namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.Compendium;
namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.Compendium;
internal class AonprdReference(string id, string file)
{
@@ -1,11 +1,11 @@
using LinqToDB;
using Newtonsoft.Json.Linq;
using Pf2eDataScrapper.Model;
using Pf2eDataScrapper.Model.Base;
using Pf2eDataScrapper.Model.Base.Source;
using Pf2eDataScrapper.Model.Base.Targets;
using Pf2eDataScrapper.Model.Enum;
using Pf2eDataScrapper.Model.Structure;
using Pf2eModel.Model;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Base.Source;
using Pf2eModel.Model.Base.Targets;
using Pf2eModel.Model.Enum;
using Pf2eModel.Model.Structure;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
@@ -0,0 +1,69 @@
using Pf2eDataScrapper.Importers.Repositories;
using Pf2eModel.Model.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using static LinqToDB.Reflection.Methods.LinqToDB.Insert;
namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder;
public static class AonprdEnumResolver
{
private static readonly ICollection<Solver> Solvers = [
new Solver<ActionType>(new() {
{ "Single Action", ActionType.SingleAction },
{ "Reaction or One Action", ActionType.SingleAction },
{ "Free Action or One Action", ActionType.SingleAction },
{ "Two Actions", ActionType.TwoActions },
{ "Three Actions", ActionType.ThreeActions },
{ "Single Action to Three Actions", ActionType.SingleToThreeActions },
{ "Single Action or more Actions", ActionType.SingleToThreeActions },
{ "Single Action or Two Actions", ActionType.SingleToTwoActions },
{ "Single Action to Two Actions", ActionType.SingleToTwoActions },
}),
new Solver<SourceCategory>(new() {
{ "Rulebooks", SourceCategory.Rulebooks },
{ "Adventure Paths", SourceCategory.AdventurePaths },
{ "Lost Omens", SourceCategory.LostOmens },
{ "Adventures", SourceCategory.Adventures },
{ "Comics", SourceCategory.Comics },
{ "Blog Posts", SourceCategory.BlogPosts },
{ "Society", SourceCategory.Society },
}),
];
public static T ResolveEventArgs<T>(string value) where T : struct, Enum
{
Type type = typeof(T);
Solver? solver = Solvers.FirstOrDefault(s => s.Type == type);
if (solver is null || solver.GetType() != typeof(Solver<T>))
{
throw new EnumResolverEnumUnknownException(type);
}
Solver<T> tSolver = (Solver<T>) solver;
return tSolver.Data.TryGetValue(value, out var data) ? data : throw new EnumResolverValueUnknownException(type, value);
}
private abstract class Solver
{
public abstract Type Type { get; }
}
private class Solver<T>(Dictionary<string, T> data) : Solver where T : struct, Enum
{
public override Type Type { get; } = typeof(T);
public Dictionary<string, T> Data { get; } = data;
}
public class EnumResolverEnumUnknownException(Type t) : Exception($"Can't resolve type '{t.FullName}': Solver not defined");
public class EnumResolverValueUnknownException(Type t, string value) : Exception($"Can't resolve type '{t.FullName}': Value '{value}' is not matched");
}
@@ -1,5 +1,5 @@
using Newtonsoft.Json.Linq;
using Pf2eDataScrapper.Model.Enum;
using Pf2eModel.Model.Enum;
namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder.Processors;
@@ -8,7 +8,7 @@ internal class ActionProcessor(ProcessorInput input) : AbstractProcessor(input)
{
public override EntityType Type => EntityType.Action;
public override Model.Structure.Action Object { get; } = new();
public override Pf2eModel.Model.Structure.Action Object { get; } = new();
public override void Process()
{
@@ -1,5 +1,5 @@
using Pf2eDataScrapper.Model.Enum;
using Pf2eDataScrapper.Model.Structure;
using Pf2eModel.Model.Enum;
using Pf2eModel.Model.Structure;
namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder.Processors;
@@ -1,11 +1,11 @@
using Newtonsoft.Json.Linq;
using Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder;
using Pf2eDataScrapper.Model;
using Pf2eDataScrapper.Model.Base;
using Pf2eDataScrapper.Model.Base.Source;
using Pf2eDataScrapper.Model.Base.Targets;
using Pf2eDataScrapper.Model.Enum;
using Pf2eDataScrapper.Model.Structure;
using Pf2eModel.Model;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Base.Source;
using Pf2eModel.Model.Base.Targets;
using Pf2eModel.Model.Enum;
using Pf2eModel.Model.Structure;
using System.Security.Cryptography;
using System.Text;
@@ -1,5 +1,5 @@
using Newtonsoft.Json.Linq;
using Pf2eDataScrapper.Model.Enum;
using Pf2eModel.Model.Enum;
namespace Pf2eDataScrapper.Importers.Implementations.Pf2eFoundry.DataBuilder.Processors;
@@ -8,17 +8,17 @@ internal class ActionProcessor(JObject input) : AbstractProcessor(input)
{
public override EntityType Type => EntityType.Action;
public override Model.Structure.Action Object { get; } = new();
public override Pf2eModel.Model.Structure.Action Object { get; } = new();
public override void Process()
{
base.Process();
/*
Object.Type = EnumRequired<ActionType>("system.actionType.value");
// Object.Category = EnumOptional<ActionCategory>("system.category", ActionCategory.Unknown);
Object.Category = EnumOptional<ActionCategory>("system.category", ActionCategory.Unknown);
Object.Actions = GetOptional<int>("system.actions.value");
// Object.DeathNote = GetOptional<bool>("system.deathNote");
Object.DeathNote = GetOptional<bool>("system.deathNote");
*/
JObject extra = new()
{
{ "selfEffect", Input.SelectToken("system.selfEffect") }
@@ -1,6 +1,6 @@
using Newtonsoft.Json.Linq;
using Pf2eDataScrapper.Model.Enum;
using Pf2eDataScrapper.Model.Structure;
using Pf2eModel.Model.Enum;
using Pf2eModel.Model.Structure;
namespace Pf2eDataScrapper.Importers.Implementations.Pf2eFoundry.DataBuilder.Processors;
@@ -1,24 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using Pf2eDataScrapper.Model;
using Pf2eDataScrapper.Model.Enum;
#nullable disable
namespace Pf2eDataScrapper.Migrations
{
[DbContext(typeof(Pf2eDbContext))]
[Migration("20250418062358_Function")]
partial class Function
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
}
}
}
@@ -1,75 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Pf2eDataScrapper.Migrations
{
/// <inheritdoc />
public partial class Function : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql("""
CREATE OR REPLACE FUNCTION f_truncate_tables()
RETURNS void
LANGUAGE plpgsql AS
$func$
BEGIN
EXECUTE
(SELECT 'TRUNCATE TABLE '
|| string_agg(format('%I.%I', schemaname, tablename), ', ')
|| ' CASCADE;'
FROM pg_tables
WHERE schemaname = 'public'
AND tablename != '__EFMigrationsHistory'
);
END
$func$;
""");
migrationBuilder.Sql("""
CREATE OR REPLACE FUNCTION f_drop_tables()
RETURNS void
LANGUAGE plpgsql AS
$func$
BEGIN
EXECUTE
(SELECT 'DROP TABLE '
|| string_agg(format('%I.%I', schemaname, tablename), ', ')
|| ' CASCADE;'
FROM pg_tables
WHERE schemaname = 'public'
);
END
$func$;
""");
migrationBuilder.Sql("""
CREATE OR REPLACE FUNCTION f_permission_tables(_username text)
RETURNS void
LANGUAGE plpgsql AS
$func$
DECLARE
_tbl text;
_sch text;
BEGIN
FOR _sch, _tbl IN
SELECT schemaname, tablename
FROM pg_tables
WHERE schemaname = 'public'
LOOP
EXECUTE format('ALTER TABLE %I.%I OWNER TO %I', _sch, _tbl, _username);
END LOOP;
END
$func$;
""");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql("DROP FUNCTION f_truncate_tables;");
migrationBuilder.Sql("DROP FUNCTION f_drop_tables;");
migrationBuilder.Sql("DROP FUNCTION f_permission_tables;");
}
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,106 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Pf2eDataScrapper.Migrations
{
/// <inheritdoc />
public partial class EnumUpdate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("Npgsql:Enum:action_category", "unknown,offensive,defensive,interaction,familiar,army_tactic,army_war_action,kingdom_activity,kingdom_feat,kingdom_feature")
.Annotation("Npgsql:Enum:action_type", "none,1_action,2_actions,3_actions,1-3_actions,1-2_actions")
.Annotation("Npgsql:Enum:alias_type", "legacy,english,legacy_english,hobby,other")
.Annotation("Npgsql:Enum:ancestry_vision", "normal,low-light-vision,darkvision")
.Annotation("Npgsql:Enum:attribute_values", "any,str,dex,con,int,wis,cha")
.Annotation("Npgsql:Enum:class_progression_type", "entity,ancestry_feat,class_feat,general_feat,skill_feat,skill_increase")
.Annotation("Npgsql:Enum:condition_group", "unknown,senses,abilities,death,attitudes,detection")
.Annotation("Npgsql:Enum:deity_category", "deity,pantheon,covenant,philosophy")
.Annotation("Npgsql:Enum:deity_fonts", "none,heal,harm,any")
.Annotation("Npgsql:Enum:deity_sanctification", "holy,unholy,any")
.Annotation("Npgsql:Enum:entity_rarity", "common,uncommon,rare,unique")
.Annotation("Npgsql:Enum:entity_type", "unknown,trait,action,ancestry,background,backpack,campaign_feature,class,condition,deity,feat,heritage,spell")
.Annotation("Npgsql:Enum:feat_action_type", "passive,action,reaction,free")
.Annotation("Npgsql:Enum:feat_category", "ancestryfeature,classfeature,calling,class,skill,general,ancestry,bonus,deityboon,curse,pfsboon,campaign_feature")
.Annotation("Npgsql:Enum:size", "med,tiny")
.Annotation("Npgsql:Enum:source_category", "rulebook,adventure-path,lost-omens,adventures,comics,blog-posts,society")
.Annotation("Npgsql:Enum:spell_area_type", "burst,emanation,cone,line,square,cube,cylinder")
.Annotation("Npgsql:Enum:spell_damage_category", "persistent,splash")
.Annotation("Npgsql:Enum:spell_damage_kinds", "damage,healing,any")
.Annotation("Npgsql:Enum:training_stage", "untrained,trained,expert,master,legendary")
.Annotation("Npgsql:Enum:trait_type", "regular,tradition")
.OldAnnotation("Npgsql:Enum:action_category", "unknown,offensive,defensive,interaction,familiar,army_tactic,army_war_action,kingdom_activity,kingdom_feat,kingdom_feature")
.OldAnnotation("Npgsql:Enum:action_type", "none,1_action,2_actions,3_actions,1-3_actions,1-2_actions")
.OldAnnotation("Npgsql:Enum:alias_type", "legacy,english,legacy_english,hobby,other")
.OldAnnotation("Npgsql:Enum:ancestry_vision", "normal,low-light-vision,darkvision")
.OldAnnotation("Npgsql:Enum:attribute_values", "any,str,dex,con,int,wis,cha")
.OldAnnotation("Npgsql:Enum:class_progression_type", "entity,ancestry_feat,class_feat,general_feat,skill_feat,skill_increase")
.OldAnnotation("Npgsql:Enum:condition_group", "unknown,senses,abilities,death,attitudes,detection")
.OldAnnotation("Npgsql:Enum:deity_category", "deity,pantheon,covenant,philosophy")
.OldAnnotation("Npgsql:Enum:deity_fonts", "none,heal,harm,any")
.OldAnnotation("Npgsql:Enum:deity_sanctification", "holy,unholy,any")
.OldAnnotation("Npgsql:Enum:entity_rarity", "common,uncommon,rare,unique")
.OldAnnotation("Npgsql:Enum:entity_type", "unknown,trait,action,ancestry,background,backpack,campaign_feature,class,condition,deity,feat,heritage,spell")
.OldAnnotation("Npgsql:Enum:feat_action_type", "passive,action,reaction,free")
.OldAnnotation("Npgsql:Enum:feat_category", "ancestryfeature,classfeature,calling,class,skill,general,ancestry,bonus,deityboon,curse,pfsboon,campaign_feature")
.OldAnnotation("Npgsql:Enum:size", "med,tiny")
.OldAnnotation("Npgsql:Enum:source_category", "rulebook,adventure-path,lost-omens")
.OldAnnotation("Npgsql:Enum:spell_area_type", "burst,emanation,cone,line,square,cube,cylinder")
.OldAnnotation("Npgsql:Enum:spell_damage_category", "persistent,splash")
.OldAnnotation("Npgsql:Enum:spell_damage_kinds", "damage,healing,any")
.OldAnnotation("Npgsql:Enum:training_stage", "untrained,trained,expert,master,legendary")
.OldAnnotation("Npgsql:Enum:trait_type", "regular,tradition");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("Npgsql:Enum:action_category", "unknown,offensive,defensive,interaction,familiar,army_tactic,army_war_action,kingdom_activity,kingdom_feat,kingdom_feature")
.Annotation("Npgsql:Enum:action_type", "none,1_action,2_actions,3_actions,1-3_actions,1-2_actions")
.Annotation("Npgsql:Enum:alias_type", "legacy,english,legacy_english,hobby,other")
.Annotation("Npgsql:Enum:ancestry_vision", "normal,low-light-vision,darkvision")
.Annotation("Npgsql:Enum:attribute_values", "any,str,dex,con,int,wis,cha")
.Annotation("Npgsql:Enum:class_progression_type", "entity,ancestry_feat,class_feat,general_feat,skill_feat,skill_increase")
.Annotation("Npgsql:Enum:condition_group", "unknown,senses,abilities,death,attitudes,detection")
.Annotation("Npgsql:Enum:deity_category", "deity,pantheon,covenant,philosophy")
.Annotation("Npgsql:Enum:deity_fonts", "none,heal,harm,any")
.Annotation("Npgsql:Enum:deity_sanctification", "holy,unholy,any")
.Annotation("Npgsql:Enum:entity_rarity", "common,uncommon,rare,unique")
.Annotation("Npgsql:Enum:entity_type", "unknown,trait,action,ancestry,background,backpack,campaign_feature,class,condition,deity,feat,heritage,spell")
.Annotation("Npgsql:Enum:feat_action_type", "passive,action,reaction,free")
.Annotation("Npgsql:Enum:feat_category", "ancestryfeature,classfeature,calling,class,skill,general,ancestry,bonus,deityboon,curse,pfsboon,campaign_feature")
.Annotation("Npgsql:Enum:size", "med,tiny")
.Annotation("Npgsql:Enum:source_category", "rulebook,adventure-path,lost-omens")
.Annotation("Npgsql:Enum:spell_area_type", "burst,emanation,cone,line,square,cube,cylinder")
.Annotation("Npgsql:Enum:spell_damage_category", "persistent,splash")
.Annotation("Npgsql:Enum:spell_damage_kinds", "damage,healing,any")
.Annotation("Npgsql:Enum:training_stage", "untrained,trained,expert,master,legendary")
.Annotation("Npgsql:Enum:trait_type", "regular,tradition")
.OldAnnotation("Npgsql:Enum:action_category", "unknown,offensive,defensive,interaction,familiar,army_tactic,army_war_action,kingdom_activity,kingdom_feat,kingdom_feature")
.OldAnnotation("Npgsql:Enum:action_type", "none,1_action,2_actions,3_actions,1-3_actions,1-2_actions")
.OldAnnotation("Npgsql:Enum:alias_type", "legacy,english,legacy_english,hobby,other")
.OldAnnotation("Npgsql:Enum:ancestry_vision", "normal,low-light-vision,darkvision")
.OldAnnotation("Npgsql:Enum:attribute_values", "any,str,dex,con,int,wis,cha")
.OldAnnotation("Npgsql:Enum:class_progression_type", "entity,ancestry_feat,class_feat,general_feat,skill_feat,skill_increase")
.OldAnnotation("Npgsql:Enum:condition_group", "unknown,senses,abilities,death,attitudes,detection")
.OldAnnotation("Npgsql:Enum:deity_category", "deity,pantheon,covenant,philosophy")
.OldAnnotation("Npgsql:Enum:deity_fonts", "none,heal,harm,any")
.OldAnnotation("Npgsql:Enum:deity_sanctification", "holy,unholy,any")
.OldAnnotation("Npgsql:Enum:entity_rarity", "common,uncommon,rare,unique")
.OldAnnotation("Npgsql:Enum:entity_type", "unknown,trait,action,ancestry,background,backpack,campaign_feature,class,condition,deity,feat,heritage,spell")
.OldAnnotation("Npgsql:Enum:feat_action_type", "passive,action,reaction,free")
.OldAnnotation("Npgsql:Enum:feat_category", "ancestryfeature,classfeature,calling,class,skill,general,ancestry,bonus,deityboon,curse,pfsboon,campaign_feature")
.OldAnnotation("Npgsql:Enum:size", "med,tiny")
.OldAnnotation("Npgsql:Enum:source_category", "rulebook,adventure-path,lost-omens,adventures,comics,blog-posts,society")
.OldAnnotation("Npgsql:Enum:spell_area_type", "burst,emanation,cone,line,square,cube,cylinder")
.OldAnnotation("Npgsql:Enum:spell_damage_category", "persistent,splash")
.OldAnnotation("Npgsql:Enum:spell_damage_kinds", "damage,healing,any")
.OldAnnotation("Npgsql:Enum:training_stage", "untrained,trained,expert,master,legendary")
.OldAnnotation("Npgsql:Enum:trait_type", "regular,tradition");
}
}
}
File diff suppressed because it is too large Load Diff
-61
View File
@@ -1,61 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Pf2eDataScrapper.Model.Base.Keywords;
using Pf2eDataScrapper.Model.Base.Source;
using Pf2eDataScrapper.Model.Base.Targets;
using Pf2eDataScrapper.Model.Enum;
using Pf2eDataScrapper.Model.Structure;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Base;
public class Entity
{
[System.ComponentModel.DataAnnotations.Key]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
[MaxLength(Pf2eDbContext.NameLength)]
[Comment("Отображаемое имя")]
public string Name { get; set; } = null!;
[Column(Order = 3)]
[Comment("Тип объекта")]
public EntityType Type { get; set; }
[Column(Order = 4)]
[MaxLength(Pf2eDbContext.NameLength)]
[Comment("Часть имени в URL")]
public string Slug { get; set; } = null!;
[Column(Order = 5)]
[StringLength(255)]
[Comment("Изображение объекта")]
public string Img { get; set; } = null!;
[Column(Order = 6)]
[Comment("Текстовое описание объекта")]
public string Description { get; set; } = null!;
[Column(Order = 7)]
public EntityRarity Rarity { get; set; } = EntityRarity.Common;
[Column(Order = 8)]
[Comment("Флаг, указывающий, что у объекта существует перевод")]
public bool? IsTranslated { get; set; } = false;
[Column(Order = 9)]
[Comment("Флаг, указывающий, что объект был проверен и не требует автоматической перезаписи")]
public bool? IsChecked { get; set; } = false;
public virtual ICollection<Trait> Traits { get; set; } = [];
public virtual ICollection<Keyword> Keywords { get; set; } = [];
public virtual ICollection<EntityAlias> Aliases { get; set; } = [];
public virtual ICollection<EntitySource> Sources { get; set; } = [];
public virtual ICollection<EntityExternal> Externals { get; set; } = [];
}
@@ -1,22 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Pf2eDataScrapper.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Base;
[PrimaryKey(nameof(EntityId), nameof(Type))]
public partial class EntityAlias
{
[Column(Order = 1)]
public int EntityId { get; set; }
[Column(Order = 2)]
public AliasType Type { get; set; } = AliasType.Other;
[Column(Order = 3)]
[MaxLength(Pf2eDbContext.NameLength)]
public string Alias { get; set; } = null!;
public virtual Entity Entity { get; set; } = null!;
}
@@ -1,20 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Base.Keywords;
public partial class Keyword
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public string Slug { get; set; } = null!;
public virtual ICollection<Entity> Entities { get; set; } = [];
public virtual ICollection<KeywordAlias> Aliases { get; set; } = [];
}
@@ -1,21 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Base.Keywords;
public partial class KeywordAlias
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public int KeywordId { get; set; }
[Column(Order = 3)]
[MaxLength(Pf2eDbContext.NameLength)]
public string Value { get; set; } = null!;
public virtual Keyword Keyword { get; set; } = null!;
}
@@ -1,28 +0,0 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Base.Source;
[PrimaryKey(nameof(EntityId), nameof(SourceId))]
public partial class EntitySource
{
[Column(Order = 1)]
public int EntityId { get; set; }
[Column(Order = 2)]
public int SourceId { get; set; }
[Column(Order = 3)]
[MaxLength(255)]
[Comment("Номер страницы, эррата и т.д.")]
public string Suffix { get; set; } = null!;
[Column(Order = 4)]
[Comment("Флаг, указывающий, что объект является частью ремастера")]
public bool IsRemaster { get; set; }
public virtual Entity Entity { get; set; } = null!;
public virtual Source Source { get; set; } = null!;
}
@@ -1,26 +0,0 @@
using Pf2eDataScrapper.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Base.Source;
public partial class Source
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
[MaxLength(Pf2eDbContext.NameLength)]
public string Name { get; set; } = null!;
[Column(Order = 3)]
public SourceCategory Category { get; set; }
[Column(Order = 4)]
public DateOnly? ReleaseDate { get; set; }
public ICollection<EntitySource> EntitySources { get; set; } = [];
}
@@ -1,29 +0,0 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Base.Targets;
[PrimaryKey(nameof(EntityId), nameof(TargetId))]
public partial class EntityExternal
{
[Column(Order = 0)]
public int EntityId { get; set; }
[Column(Order = 1)]
public int TargetId { get; set; }
[Column(Order = 2)]
[MaxLength(255)]
[Comment("Часть URL до объекта. Для источников Foundry - полный UUID объекта")]
public string Suffix { get; set; } = "";
[Column(Order = 3)]
[MaxLength(32)]
[Comment("Контроль версии объекта")]
public string Md5 { get; set; } = null!;
public virtual Entity Entity { get; set; } = null!;
public virtual ExternalTarget Target { get; set; } = null!;
}
@@ -1,27 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Base.Targets;
public partial class ExternalTarget
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
[StringLength(Pf2eDbContext.NameLength)]
public string Name { get; set; } = null!;
[Column(Order = 3)]
[StringLength(255)]
public string Icon { get; set; } = null!;
[Column(Order = 3)]
[StringLength(Pf2eDbContext.NameLength)]
public string Prefix { get; set; } = null!;
[Column(Order = 4)]
public virtual ICollection<EntityExternal> EntityExternals { get; set; } = [];
}
@@ -1,21 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Common;
public partial class Frequency
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public int Max { get; set; }
[Column(Order = 3)]
public int Per { get; set; }
[Column(Order = 4)]
public int? Value { get; set; }
}
-24
View File
@@ -1,24 +0,0 @@
using Pf2eDataScrapper.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Common;
public partial class Language
{
[System.ComponentModel.DataAnnotations.Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
[MaxLength(Pf2eDbContext.NameLength)]
public string Name { get; set; } = null!;
[Column(Order = 3)]
[MaxLength(Pf2eDbContext.NameLength)]
public string Slug { get; set; } = null!;
[Column(Order = 4)]
public EntityRarity Rarity { get; set; }
}
-16
View File
@@ -1,16 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Common;
public partial class Training
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
[MaxLength(Pf2eDbContext.NameLength)]
public string Key { get; set; } = null!;
}
@@ -1,35 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum ActionCategory
{
Unknown,
[PgName("offensive")]
Offensive,
[PgName("defensive")]
Defensive,
[PgName("interaction")]
Interaction,
[PgName("familiar")]
Familiar,
[PgName("army_tactic")]
ArmyTactic,
[PgName("army_war_action")]
ArmyWarAction,
[PgName("kingdom_activity")]
KingdomActivity,
[PgName("kingdom_feat")]
KingdomFeat,
[PgName("kingdom_feature")]
KingdomFeature,
}
-30
View File
@@ -1,30 +0,0 @@
using NpgsqlTypes;
using Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder;
namespace Pf2eDataScrapper.Model.Enum;
public enum ActionType
{
[PgName("none")]
None,
[AonprdEnum(["Single Action", "Reaction or One Action", "Free Action or One Action"])]
[PgName("1_action")]
SingleAction,
[AonprdEnum("Two Actions")]
[PgName("2_actions")]
TwoActions,
[AonprdEnum("Three Actions")]
[PgName("3_actions")]
ThreeActions,
[AonprdEnum(["Single Action to Three Actions", "Single Action or more Actions"])]
[PgName("1-3_actions")]
SingleToThreeActions,
[AonprdEnum(["Single Action or Two Actions", "Single Action to Two Actions"])]
[PgName("1-2_actions")]
SingleToTwoActions,
}
-21
View File
@@ -1,21 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum AliasType
{
[PgName("legacy")]
Legacy,
[PgName("english")]
English,
[PgName("legacy_english")]
LegacyEnglish,
[PgName("hobby")]
Hobby,
[PgName("other")]
Other,
}
@@ -1,15 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum AncestryVision
{
[PgName("normal")]
normal,
[PgName("low-light-vision")]
LowLightVision,
[PgName("darkvision")]
darkvision,
}
@@ -1,27 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum AttributeValues
{
[PgName("any")]
Any,
[PgName("str")]
Strength,
[PgName("dex")]
Dexterity,
[PgName("con")]
Constitution,
[PgName("int")]
Intelligence,
[PgName("wis")]
Wisdom,
[PgName("cha")]
Charisma
}
@@ -1,24 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum ClassProgressionType
{
[PgName("entity")]
Entity,
[PgName("ancestry_feat")]
AncestryFeat,
[PgName("class_feat")]
ClassFeat,
[PgName("general_feat")]
GeneralFeat,
[PgName("skill_feat")]
SkillFeat,
[PgName("skill_increase")]
SkillIncrease,
}
@@ -1,25 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum ConditionGroup
{
[PgName("unknown")]
Unknown,
[PgName("senses")]
Senses,
[PgName("abilities")]
Abilities,
[PgName("death")]
Death,
[PgName("attitudes")]
Attitudes,
[PgName("detection")]
Detection
}
@@ -1,18 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum DeityCategory
{
[PgName("deity")]
Deity,
[PgName("pantheon")]
Pantheon,
[PgName("covenant")]
Covenant,
[PgName("philosophy")]
Philosophy,
}
-18
View File
@@ -1,18 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum DeityFonts
{
[PgName("none")]
None,
[PgName("heal")]
Heal,
[PgName("harm")]
Harm,
[PgName("any")]
Any,
}
@@ -1,15 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum DeitySanctification
{
[PgName("holy")]
Holy,
[PgName("unholy")]
Unholy,
[PgName("any")]
Any,
}
@@ -1,18 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum EntityRarity
{
[PgName("common")]
Common,
[PgName("uncommon")]
Uncommon,
[PgName("rare")]
Rare,
[PgName("unique")]
Unique
}
-45
View File
@@ -1,45 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum EntityType
{
[PgName("unknown")]
Unknown,
[PgName("trait")]
Trait,
[PgName("action")]
Action,
[PgName("ancestry")]
Ancestry,
[PgName("background")]
Background,
[PgName("backpack")]
Backpack,
[PgName("campaign_feature")]
CampaignFeature,
[PgName("class")]
Class,
[PgName("condition")]
Condition,
[PgName("deity")]
Deity,
[PgName("feat")]
Feat,
[PgName("heritage")]
Heritage,
[PgName("spell")]
Spell
}
@@ -1,18 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum FeatActionType
{
[PgName("passive")]
Passive,
[PgName("action")]
Action,
[PgName("reaction")]
Reaction,
[PgName("free")]
Free,
}
@@ -1,42 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum FeatCategory
{
[PgName("ancestryfeature")]
Ancestryfeature,
[PgName("classfeature")]
Classfeature,
[PgName("calling")]
Calling,
[PgName("class")]
Class,
[PgName("skill")]
Skill,
[PgName("general")]
General,
[PgName("ancestry")]
Ancestry,
[PgName("bonus")]
Bonus,
[PgName("deityboon")]
Deityboon,
[PgName("curse")]
Curse,
[PgName("pfsboon")]
Pfsboon,
[PgName("campaign_feature")]
CampaignFeature,
}
-12
View File
@@ -1,12 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum Size
{
[PgName("med")]
med,
[PgName("tiny")]
tiny,
}
@@ -1,34 +0,0 @@
using NpgsqlTypes;
using Pf2eDataScrapper.Importers.Implementations.Aonprd.DataBuilder;
namespace Pf2eDataScrapper.Model.Enum;
public enum SourceCategory
{
[PgName("rulebook")]
[AonprdEnum("Rulebooks")]
Rulebooks,
[PgName("adventure-path")]
[AonprdEnum("Adventure Paths")]
AdventurePaths,
[PgName("lost-omens")]
[AonprdEnum("Lost Omens")]
LostOmens,
[PgName("adventures")]
[AonprdEnum("Adventures")]
Adventures,
[PgName("comics")]
[AonprdEnum("Comics")]
Comics,
[PgName("blog-posts")]
[AonprdEnum("Blog Posts")]
BlogPosts,
[PgName("society")]
[AonprdEnum("Society")]
Society,
}
@@ -1,27 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum SpellAreaType
{
[PgName("burst")]
Burst,
[PgName("emanation")]
Emanation,
[PgName("cone")]
Cone,
[PgName("line")]
Line,
[PgName("square")]
Square,
[PgName("cube")]
Cube,
[PgName("cylinder")]
Cylinder,
}
@@ -1,12 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum SpellDamageCategory
{
[PgName("persistent")]
Persistent,
[PgName("splash")]
Splash,
}
@@ -1,15 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum SpellDamageKinds
{
[PgName("damage")]
Damage,
[PgName("healing")]
Healing,
[PgName("any")]
Any,
}
@@ -1,13 +0,0 @@
namespace Pf2eDataScrapper.Model.Enum;
public enum TrainingStage
{
Untrained = 0,
Trained = 1,
Expert = 2,
Master = 3,
Legendary = 4,
}
-12
View File
@@ -1,12 +0,0 @@
using NpgsqlTypes;
namespace Pf2eDataScrapper.Model.Enum;
public enum TraitType
{
[PgName("regular")]
Regular,
[PgName("tradition")]
Tradition
}
-11
View File
@@ -1,11 +0,0 @@
using Pf2eDataScrapper.Model.Base;
namespace Pf2eDataScrapper.Model;
internal interface IEntity
{
public int Id { get; set; }
public Entity Entity { get; set; }
}
-146
View File
@@ -1,146 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Pf2eDataScrapper.Model.Base;
using Pf2eDataScrapper.Model.Base.Keywords;
using Pf2eDataScrapper.Model.Base.Source;
using Pf2eDataScrapper.Model.Base.Targets;
using Pf2eDataScrapper.Model.Common;
using Pf2eDataScrapper.Model.Enum;
using Pf2eDataScrapper.Model.Structure;
using Pf2eDataScrapper.Model.Structure.AncestryRelation;
using Pf2eDataScrapper.Model.Structure.BackgroundRelation;
using Pf2eDataScrapper.Model.Structure.ClassRelation;
using Pf2eDataScrapper.Model.Structure.DeityRelation;
using Pf2eDataScrapper.Model.Structure.FeatRelation;
using Pf2eDataScrapper.Model.Structure.SpellRelation;
namespace Pf2eDataScrapper.Model;
public partial class Pf2eDbContext : DbContext
{
public Pf2eDbContext()
{
}
public Pf2eDbContext(DbContextOptions<Pf2eDbContext> options)
: base(options)
{
}
#region DbSets
public virtual DbSet<Structure.Action> Actions { get; set; }
public virtual DbSet<Ancestry> Ancestries { get; set; }
public virtual DbSet<AncestryBoost> AncestryBoosts { get; set; }
public virtual DbSet<AncestryItem> AncestryItems { get; set; }
public virtual DbSet<AncestryLanguage> AncestryLanguages { get; set; }
public virtual DbSet<Background> Backgrounds { get; set; }
public virtual DbSet<BackgroundBoost> BackgroundBoosts { get; set; }
public virtual DbSet<BackgroundItem> BackgroundItems { get; set; }
public virtual DbSet<BackgroundTraining> BackgroundSkills { get; set; }
public virtual DbSet<Class> Classes { get; set; }
public virtual DbSet<ClassKeyAbility> ClassKeyAbilities { get; set; }
public virtual DbSet<ClassProgression> ClassProgressions { get; set; }
public virtual DbSet<ClassTraining> ClassTrainings { get; set; }
public virtual DbSet<Condition> Conditions { get; set; }
public virtual DbSet<Deity> Deities { get; set; }
public virtual DbSet<DeityAttribute> DeityAttributes { get; set; }
public virtual DbSet<DeityDomain> DeityDomains { get; set; }
public virtual DbSet<DeitySpell> DeitySpells { get; set; }
public virtual DbSet<DeityWeapon> DeityWeapons { get; set; }
public virtual DbSet<Entity> Entities { get; set; }
public virtual DbSet<EntityAlias> EntityAliases { get; set; }
public virtual DbSet<EntityExternal> EntityExternals { get; set; }
public virtual DbSet<EntitySource> EntitySources { get; set; }
public virtual DbSet<ExternalTarget> ExternalTargets { get; set; }
public virtual DbSet<Feat> Feats { get; set; }
public virtual DbSet<FeatPrerequisite> FeatPrerequisites { get; set; }
public virtual DbSet<Frequency> Frequencies { get; set; }
public virtual DbSet<Heritage> Heritages { get; set; }
public virtual DbSet<Keyword> Keywords { get; set; }
public virtual DbSet<KeywordAlias> KeywordAliases { get; set; }
public virtual DbSet<Language> Languages { get; set; }
public virtual DbSet<Source> Sources { get; set; }
public virtual DbSet<Spell> Spells { get; set; }
public virtual DbSet<SpellArea> SpellAreas { get; set; }
public virtual DbSet<SpellDamage> SpellDamages { get; set; }
public virtual DbSet<SpellDefense> SpellDefenses { get; set; }
public virtual DbSet<SpellRitual> SpellRituals { get; set; }
public virtual DbSet<Training> Trainings { get; set; }
public virtual DbSet<Trait> Traits { get; set; }
#endregion
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
EnvSettings.Load();
// optionsBuilder.LogTo(Console.WriteLine);
optionsBuilder.UseSnakeCaseNamingConvention();
optionsBuilder.UseNpgsql(EnvSettings.DatabaseConnection,
builder =>
{
builder
.MapEnum<EntityType>()
.MapEnum<EntityRarity>()
.MapEnum<AliasType>()
.MapEnum<TraitType>()
.MapEnum<ActionType>()
.MapEnum<ActionCategory>()
.MapEnum<Size>()
.MapEnum<AncestryVision>()
.MapEnum<ClassProgressionType>()
.MapEnum<ConditionGroup>()
.MapEnum<DeityCategory>()
.MapEnum<DeityFonts>()
.MapEnum<DeitySanctification>()
.MapEnum<FeatActionType>()
.MapEnum<FeatCategory>()
.MapEnum<SpellAreaType>()
.MapEnum<SpellDamageCategory>()
.MapEnum<SpellDamageKinds>()
.MapEnum<AttributeValues>()
.MapEnum<TrainingStage>()
.MapEnum<SourceCategory>()
;
}
);
}
}
@@ -1,412 +0,0 @@
using LinqToDB.Common;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Pf2eDataScrapper.Model.Base;
using Pf2eDataScrapper.Model.Base.Keywords;
using Pf2eDataScrapper.Model.Base.Source;
using Pf2eDataScrapper.Model.Base.Targets;
using Pf2eDataScrapper.Model.Common;
using Pf2eDataScrapper.Model.Enum;
using Pf2eDataScrapper.Model.Structure;
using Pf2eDataScrapper.Model.Structure.AncestryRelation;
using Pf2eDataScrapper.Model.Structure.BackgroundRelation;
using Pf2eDataScrapper.Model.Structure.ClassRelation;
using Pf2eDataScrapper.Model.Structure.DeityRelation;
using Pf2eDataScrapper.Model.Structure.FeatRelation;
using Pf2eDataScrapper.Model.Structure.SpellRelation;
using System.Reflection;
namespace Pf2eDataScrapper.Model;
public partial class Pf2eDbContext
{
public const int NameLength = 255;
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.UseIdentityByDefaultColumns();
DefineEnums(modelBuilder);
DefineBase(modelBuilder);
DefineCommon(modelBuilder);
DefineStructure(modelBuilder);
DefineFunctions(modelBuilder);
}
private void DefineEnums(ModelBuilder modelBuilder)
{
modelBuilder
.HasPostgresEnum<EntityType>()
.HasPostgresEnum<EntityRarity>()
.HasPostgresEnum<AliasType>()
.HasPostgresEnum<TraitType>()
.HasPostgresEnum<ActionType>()
.HasPostgresEnum<ActionCategory>()
.HasPostgresEnum<Size>()
.HasPostgresEnum<AncestryVision>()
.HasPostgresEnum<ClassProgressionType>()
.HasPostgresEnum<ConditionGroup>()
.HasPostgresEnum<DeityCategory>()
.HasPostgresEnum<DeityFonts>()
.HasPostgresEnum<DeitySanctification>()
.HasPostgresEnum<FeatActionType>()
.HasPostgresEnum<FeatCategory>()
.HasPostgresEnum<SpellAreaType>()
.HasPostgresEnum<SpellDamageCategory>()
.HasPostgresEnum<SpellDamageKinds>()
.HasPostgresEnum<AttributeValues>()
.HasPostgresEnum<TrainingStage>()
.HasPostgresEnum<SourceCategory>()
;
}
private void DefineBase(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Entity>(entity =>
{
entity.HasMany(e => e.Traits).WithMany(t => t.Entities);
entity.HasMany(e => e.Keywords).WithMany(t => t.Entities);
// EntityAlias
entity.HasMany(e => e.Aliases).WithOne(e => e.Entity)
.HasForeignKey(e => e.EntityId)
.OnDelete(DeleteBehavior.Cascade);
// EntitySource
entity.HasMany(e => e.Sources).WithOne(e => e.Entity)
.HasForeignKey(e => e.EntityId)
.OnDelete(DeleteBehavior.Cascade);
// EntityExternal
entity.HasMany(e => e.Externals).WithOne(e => e.Entity)
.HasForeignKey(e => e.EntityId)
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<EntityAlias>(entity => { });
// Source
modelBuilder.Entity<Source>(entity =>
{
entity.Property(e => e.Id).HasColumnName("id");
entity.HasMany(s => s.EntitySources).WithOne(e => e.Source)
.HasForeignKey(e => e.SourceId)
.OnDelete(DeleteBehavior.Cascade);
// + EntitySource
});
modelBuilder.Entity<EntitySource>(entity => { });
// External
modelBuilder.Entity<ExternalTarget>(entity =>
{
entity.HasMany(t => t.EntityExternals).WithOne(e => e.Target)
.HasForeignKey(e => e.TargetId)
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<EntityExternal>(entity => { });
// Keywords
modelBuilder.Entity<Keyword>(entity =>
{
entity.HasMany(e => e.Aliases).WithOne(e => e.Keyword)
.HasForeignKey(e => e.KeywordId)
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<KeywordAlias>(entity => { });
}
private void DefineCommon(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Frequency>(entity => { });
modelBuilder.Entity<Language>(entity => { });
modelBuilder.Entity<Training>(entity => { });
}
private void BindEntity<T>(EntityTypeBuilder<T> entity) where T : class, IEntity
{
entity.HasOne(entity => entity.Entity)
.WithOne()
.HasForeignKey<T>(entity => entity.Id)
.IsRequired();
}
private void DefineStructure(ModelBuilder modelBuilder)
{
// Action
modelBuilder.Entity<Structure.Action>(entity =>
{
BindEntity(entity);
});
// Ancestry
modelBuilder.Entity<Ancestry>(entity =>
{
BindEntity(entity);
entity.HasMany(e => e.AncestryBoosts).WithOne(e => e.Ancestry)
.HasForeignKey(e => e.AncestryId)
.OnDelete(DeleteBehavior.Cascade);
entity.HasMany(e => e.AncestryItems).WithOne(e => e.Ancestry)
.HasForeignKey(e => e.AncestryId)
.OnDelete(DeleteBehavior.Cascade);
entity.HasMany(e => e.AncestryLanguages).WithOne(e => e.Ancestry)
.HasForeignKey(e => e.AncestryId)
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<AncestryBoost>(entity => { });
modelBuilder.Entity<AncestryItem>(entity =>
{
entity.HasOne(d => d.Item).WithMany()
.HasForeignKey(d => d.ItemId)
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<AncestryLanguage>(entity =>
{
entity.HasOne(d => d.Language).WithMany()
.HasForeignKey(d => d.LanguageId)
.OnDelete(DeleteBehavior.Cascade);
});
// Background
modelBuilder.Entity<Background>(entity =>
{
BindEntity(entity);
});
modelBuilder.Entity<BackgroundBoost>(entity =>
{
entity.HasOne(d => d.Background).WithMany(p => p.BackgroundBoosts)
.HasForeignKey(d => d.BackgroundId)
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<BackgroundItem>(entity =>
{
entity.HasOne(d => d.Background).WithMany(p => p.BackgroundItems)
.HasForeignKey(d => d.BackgroundId)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Entity).WithMany()
.HasForeignKey(d => d.EntityId)
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<BackgroundTraining>(entity =>
{
entity.HasOne(d => d.Background).WithMany(p => p.BackgroundSkills)
.HasForeignKey(d => d.BackgroundId)
.OnDelete(DeleteBehavior.Cascade);
});
// Class
modelBuilder.Entity<Class>(entity =>
{
BindEntity(entity);
});
modelBuilder.Entity<ClassKeyAbility>(entity =>
{
entity.HasOne(d => d.Class).WithMany(p => p.ClassKeyAbilities)
.HasForeignKey(d => d.ClassId)
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<ClassProgression>(entity =>
{
entity.HasOne(d => d.Class).WithMany(p => p.ClassProgressions)
.HasForeignKey(d => d.ClassId)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Entity).WithMany()
.HasForeignKey(d => d.EntityId)
.OnDelete(DeleteBehavior.SetNull);
});
modelBuilder.Entity<ClassTraining>(entity =>
{
entity.HasOne(d => d.Class).WithMany(p => p.ClassTrainings)
.HasForeignKey(d => d.ClassId)
.OnDelete(DeleteBehavior.Cascade);
entity.HasOne(d => d.Training).WithMany()
.HasForeignKey(d => d.TrainingId)
.OnDelete(DeleteBehavior.SetNull);
});
// Condition
modelBuilder.Entity<Condition>(entity =>
{
BindEntity(entity);
});
// Deity
modelBuilder.Entity<Deity>(entity =>
{
BindEntity(entity);
entity.HasMany(e => e.DeityAttributes).WithOne(e => e.Deity)
.HasForeignKey(e => e.DeityId)
.OnDelete(DeleteBehavior.Cascade);
entity.HasMany(e => e.DeityDomains).WithOne(e => e.Deity)
.HasForeignKey(e => e.DeityId)
.OnDelete(DeleteBehavior.Cascade);
entity.HasMany(e => e.DeitySpells).WithOne(e => e.Deity)
.HasForeignKey(e => e.DeityId)
.OnDelete(DeleteBehavior.Cascade);
entity.HasMany(e => e.DeityWeapons).WithOne(e => e.Deity)
.HasForeignKey(e => e.DeityId)
.OnDelete(DeleteBehavior.Cascade);
entity.HasMany(e => e.Skills).WithMany();
});
modelBuilder.Entity<DeityAttribute>(entity => { });
modelBuilder.Entity<DeityDomain>(entity => { });
modelBuilder.Entity<DeitySpell>(entity =>
{
entity.HasOne(d => d.Spell).WithMany()
.HasForeignKey(d => d.SpellId)
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<DeityWeapon>(entity => { });
// Feat
modelBuilder.Entity<Feat>(entity =>
{
BindEntity(entity);
entity.HasMany(e => e.FeatPrerequisites).WithOne(e => e.Feat)
.HasForeignKey(e => e.FeatId)
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<FeatPrerequisite>(entity => { });
// Heritage
modelBuilder.Entity<Heritage>(entity =>
{
BindEntity(entity);
entity.HasOne(d => d.Ancestry).WithMany(p => p.Heritages)
.HasForeignKey(d => d.AncestryId)
.OnDelete(DeleteBehavior.Cascade);
});
// Spell
modelBuilder.Entity<Spell>(entity =>
{
BindEntity(entity);
entity.HasOne(e => e.SpellArea).WithOne(e => e.Spell)
.HasForeignKey<SpellArea>(e => e.SpellId)
.OnDelete(DeleteBehavior.Cascade)
.IsRequired(false);
entity.HasOne(e => e.SpellRitual).WithOne(e => e.Spell)
.HasForeignKey<SpellRitual>(e => e.SpellId)
.OnDelete(DeleteBehavior.Cascade)
.IsRequired(false);
entity.HasMany(e => e.SpellDamages).WithOne(e => e.Spell)
.HasForeignKey(e => e.SpellId)
.OnDelete(DeleteBehavior.Cascade);
entity.HasMany(e => e.SpellDefenses).WithOne(e => e.Spell)
.HasForeignKey(e => e.SpellId)
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<SpellArea>(entity => { });
modelBuilder.Entity<SpellDamage>(entity => { });
modelBuilder.Entity<SpellDefense>(entity => { });
modelBuilder.Entity<SpellRitual>(entity => { });
// Trait
modelBuilder.Entity<Trait>(entity =>
{
BindEntity(entity);
});
}
private void DefineFunctions(ModelBuilder modelBuilder)
{
// modelBuilder.HasDbFunction(typeof(Pf2eDbContext).GetMethod(nameof(FTruncateTables), Array.Empty<Type>()))
/*
modelBuilder.HasPostgresExtension($"""
CREATE OR REPLACE FUNCTION f_truncate_tables()
RETURNS void
LANGUAGE plpgsql AS
$func$
BEGIN
EXECUTE (
SELECT 'TRUNCATE TABLE '
|| string_agg(format('%I.%I', schemaname, tablename), ', ')
|| ' CASCADE;'
FROM pg_tables
WHERE schemaname = 'public'
AND tablename != '__EFMigrationsHistory'
);
END
$func$;
""")
;
/*
Database.ExecuteSql($"""
CREATE OR REPLACE FUNCTION f_truncate_tables()
RETURNS void
LANGUAGE plpgsql AS
$func$
BEGIN
EXECUTE (
SELECT 'TRUNCATE TABLE '
|| string_agg(format('%I.%I', schemaname, tablename), ', ')
|| ' CASCADE;'
FROM pg_tables
WHERE schemaname = 'public'
AND tablename != '__EFMigrationsHistory'
);
END
$func$;
""");
Database.ExecuteSql($"""
CREATE OR REPLACE FUNCTION f_drop_tables()
RETURNS void
LANGUAGE plpgsql AS
$func$
BEGIN
EXECUTE (
SELECT 'DROP TABLE '
|| string_agg(format('%I.%I', schemaname, tablename), ', ')
|| ' CASCADE;'
FROM pg_tables
WHERE schemaname = 'public'
);
END
$func$;
""");
Database.ExecuteSql($"""
CREATE OR REPLACE FUNCTION f_permission_tables(_username text)
RETURNS void
LANGUAGE plpgsql AS
$func$
DECLARE
_tbl text;
_sch text;
BEGIN
FOR _sch, _tbl IN
SELECT schemaname, tablename
FROM pg_tables
WHERE schemaname = 'public'
LOOP
EXECUTE format('ALTER TABLE %I.%I OWNER TO %I', _sch, _tbl, _username);
END LOOP;
END
$func$;
""");
*/
}
}
@@ -1,37 +0,0 @@
using Pf2eDataScrapper.Model.Base;
using Pf2eDataScrapper.Model.Enum;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure;
public partial class Action : IEntity
{
[System.ComponentModel.DataAnnotations.Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public ActionType Type { get; set; }
[Column(Order = 3)]
public int? Actions { get; set; } = null;
[Column(Order = 4)]
public int? MaxActions { get; set; } = null;
[Column(Order = 5)]
public bool IsReaction { get; set; } = false;
[Column(Order = 6)]
public bool IsFreeAction { get; set; } = false;
[Column(Order = 6)]
public bool IsPassive { get; set; } = false;
[Column(Order = 6)]
public string? Extra { get; set; }
public Entity Entity { get; set; } = null!;
}
@@ -1,39 +0,0 @@
using Pf2eDataScrapper.Model.Base;
using Pf2eDataScrapper.Model.Enum;
using Pf2eDataScrapper.Model.Structure.AncestryRelation;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure;
public partial class Ancestry : IEntity
{
[System.ComponentModel.DataAnnotations.Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Column(Order = 1)]
public int Id { get; set; }
public Entity Entity { get; set; } = null!;
[Column(Order = 2)]
public Size Size { get; set; } = Size.med;
[Column(Order = 3)]
public int Hp { get; set; }
[Column(Order = 4)]
public int Reach { get; set; }
[Column(Order = 5)]
public int Speed { get; set; }
[Column(Order = 6)]
public AncestryVision Vision { get; set; } = AncestryVision.normal;
public virtual ICollection<AncestryBoost> AncestryBoosts { get; set; } = [];
public virtual ICollection<AncestryItem> AncestryItems { get; set; } = [];
public virtual ICollection<AncestryLanguage> AncestryLanguages { get; set; } = [];
public virtual ICollection<Heritage> Heritages { get; set; } = [];
}
@@ -1,23 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.AncestryRelation;
public partial class AncestryBoost
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public int AncestryId { get; set; }
[Column(Order = 3)]
public bool Boost { get; set; } = true;
[Column(Order = 4)]
public Enum.AttributeValues Value { get; set; }
public virtual Ancestry Ancestry { get; set; } = null!;
}
@@ -1,22 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Pf2eDataScrapper.Model.Base;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.AncestryRelation;
[PrimaryKey(nameof(AncestryId), nameof(ItemId))]
public partial class AncestryItem
{
[Column(Order = 1)]
public int AncestryId { get; set; }
[Column(Order = 2)]
public int ItemId { get; set; }
[Column(Order = 3)]
public int Level { get; set; }
public virtual Ancestry Ancestry { get; set; } = null!;
public virtual Entity Item { get; set; } = null!;
}
@@ -1,22 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Pf2eDataScrapper.Model.Common;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.AncestryRelation;
[PrimaryKey(nameof(AncestryId), nameof(LanguageId))]
public partial class AncestryLanguage
{
[Column(Order = 1)]
public int AncestryId { get; set; }
[Column(Order = 2)]
public int LanguageId { get; set; }
[Column(Order = 3)]
public bool IsAdditional { get; set; }
public virtual Ancestry Ancestry { get; set; } = null!;
public virtual Language Language { get; set; } = null!;
}
@@ -1,22 +0,0 @@
using Pf2eDataScrapper.Model.Base;
using Pf2eDataScrapper.Model.Structure.BackgroundRelation;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure;
public partial class Background : IEntity
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Column(Order = 1)]
public int Id { get; set; }
public Entity Entity { get; set; } = null!;
public virtual ICollection<BackgroundBoost> BackgroundBoosts { get; set; } = [];
public virtual ICollection<BackgroundItem> BackgroundItems { get; set; } = [];
public virtual ICollection<BackgroundTraining> BackgroundSkills { get; set; } = [];
}
@@ -1,21 +0,0 @@
using Pf2eDataScrapper.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.BackgroundRelation;
public partial class BackgroundBoost
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public int BackgroundId { get; set; }
[Column(Order = 3)]
public AttributeValues Attribute { get; set; }
public virtual Background Background { get; set; } = null!;
}
@@ -1,22 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Pf2eDataScrapper.Model.Base;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.BackgroundRelation;
[PrimaryKey(nameof(BackgroundId), nameof(EntityId))]
public partial class BackgroundItem
{
[Column(Order = 1)]
public int BackgroundId { get; set; }
[Column(Order = 2)]
public int EntityId { get; set; }
[Column(Order = 3)]
public int? Level { get; set; }
public virtual Background Background { get; set; } = null!;
public virtual Entity Entity { get; set; } = null!;
}
@@ -1,27 +0,0 @@
using Pf2eDataScrapper.Model.Common;
using Pf2eDataScrapper.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.BackgroundRelation;
public partial class BackgroundTraining
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public int BackgroundId { get; set; }
[Column(Order = 3)]
public int TrainingId { get; set; }
[Column(Order = 4)]
public TrainingStage Level { get; set; }
public virtual Background Background { get; set; } = null!;
public virtual Training Training { get; set; } = null!;
}
-34
View File
@@ -1,34 +0,0 @@
using Pf2eDataScrapper.Model.Base;
using Pf2eDataScrapper.Model.Structure.ClassRelation;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure;
public partial class Class : IEntity
{
[Key]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public Entity Entity { get; set; } = null!;
[Column(Order = 3)]
public int Hp { get; set; }
[Column(Order = 4)]
public int Perception { get; set; }
[Column(Order = 5)]
public bool Spellcasting { get; set; }
[Column(Order = 6)]
public int AdditionalTrainedSkills { get; set; }
public virtual ICollection<ClassKeyAbility> ClassKeyAbilities { get; set; } = [];
public virtual ICollection<ClassProgression> ClassProgressions { get; set; } = [];
public virtual ICollection<ClassTraining> ClassTrainings { get; set; } = [];
}
@@ -1,21 +0,0 @@
using Pf2eDataScrapper.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.ClassRelation;
public partial class ClassKeyAbility
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public int ClassId { get; set; }
[Column(Order = 3)]
public AttributeValues Value { get; set; }
public virtual Class Class { get; set; } = null!;
}
@@ -1,29 +0,0 @@
using Pf2eDataScrapper.Model.Base;
using Pf2eDataScrapper.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.ClassRelation;
public partial class ClassProgression
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public int ClassId { get; set; }
[Column(Order = 31)]
public int Level { get; set; }
[Column(Order = 4)]
public ClassProgressionType Type { get; set; }
[Column(Order = 5)]
public int? EntityId { get; set; }
public virtual Class Class { get; set; } = null!;
public virtual Entity? Entity { get; set; }
}
@@ -1,30 +0,0 @@
using Pf2eDataScrapper.Model.Common;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.ClassRelation;
public partial class ClassTraining
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public int ClassId { get; set; }
[Column(Order = 3)]
public int? TrainingId { get; set; }
[Column(Order = 4)]
[MaxLength(Pf2eDbContext.NameLength)]
public string? Name { get; set; }
[Column(Order = 5)]
public int Stage { get; set; }
public virtual Class Class { get; set; } = null!;
public virtual Training? Training { get; set; }
}
@@ -1,22 +0,0 @@
using Pf2eDataScrapper.Model.Base;
using Pf2eDataScrapper.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure;
public partial class Condition : IEntity
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Column(Order = 1)]
public int Id { get; set; }
public Entity Entity { get; set; } = null!;
[Column(Order = 2)]
public ConditionGroup? Group { get; set; }
[Column(Order = 3)]
public string? Extra { get; set; }
}
-40
View File
@@ -1,40 +0,0 @@
using Pf2eDataScrapper.Model.Base;
using Pf2eDataScrapper.Model.Common;
using Pf2eDataScrapper.Model.Enum;
using Pf2eDataScrapper.Model.Structure.DeityRelation;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure;
public partial class Deity : IEntity
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Column(Order = 1)]
public int Id { get; set; }
public Entity Entity { get; set; } = null!;
[Column(Order = 2)]
public DeityCategory Category { get; set; }
[Column(Order = 3)]
public DeityFonts Fonts { get; set; }
[Column(Order = 4)]
public DeitySanctification Sanctification { get; set; }
[Column(Order = 5)]
public bool SanctificationMust { get; set; }
public virtual ICollection<DeityAttribute> DeityAttributes { get; set; } = new List<DeityAttribute>();
public virtual ICollection<DeityDomain> DeityDomains { get; set; } = new List<DeityDomain>();
public virtual ICollection<DeitySpell> DeitySpells { get; set; } = new List<DeitySpell>();
public virtual ICollection<DeityWeapon> DeityWeapons { get; set; } = new List<DeityWeapon>();
public virtual ICollection<Training> Skills { get; set; } = new List<Training>();
}
@@ -1,17 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Pf2eDataScrapper.Model.Enum;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.DeityRelation;
[PrimaryKey(nameof(DeityId), nameof(Attribute))]
public partial class DeityAttribute
{
[Column(Order = 1)]
public int DeityId { get; set; }
[Column(Order = 2)]
public AttributeValues Attribute { get; set; }
public virtual Deity Deity { get; set; } = null!;
}
@@ -1,24 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.DeityRelation;
public partial class DeityDomain
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public int DeityId { get; set; }
[Column(Order = 3)]
public bool IsPrimary { get; set; }
[Column(Order = 4)]
[MaxLength(Pf2eDbContext.NameLength)]
public string Value { get; set; } = null!;
public virtual Deity Deity { get; set; } = null!;
}
@@ -1,25 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.DeityRelation;
public partial class DeitySpell
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public int DeityId { get; set; }
[Column(Order = 3)]
public int Level { get; set; }
[Column(Order = 4)]
public int SpellId { get; set; }
public virtual Deity Deity { get; set; } = null!;
public virtual Spell Spell { get; set; } = null!;
}
@@ -1,21 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.DeityRelation;
public partial class DeityWeapon
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public int DeityId { get; set; }
[Column(Order = 3)]
[MaxLength(Pf2eDbContext.NameLength)]
public string Weapon { get; set; } = null!;
public virtual Deity Deity { get; set; } = null!;
}
-47
View File
@@ -1,47 +0,0 @@
using Pf2eDataScrapper.Model.Base;
using Pf2eDataScrapper.Model.Enum;
using Pf2eDataScrapper.Model.Structure.FeatRelation;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure;
public partial class Feat : IEntity
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Column(Order = 1)]
public int Id { get; set; }
public Entity Entity { get; set; } = null!;
[Column(Order = 2)]
public ActionType Type { get; set; }
[Column(Order = 3)]
public ActionCategory Category { get; set; }
[Column(Order = 4)]
public int? Actions { get; set; }
[Column(Order = 5)]
public int Level { get; set; }
[Column(Order = 6)]
public int? LevelTaken { get; set; }
[Column(Order = 7)]
public int? MaxTakable { get; set; }
[Column(Order = 8)]
[MaxLength(255)]
public string? Location { get; set; }
[Column(Order = 9)]
public bool? OnlyLevel1 { get; set; }
[Column(Order = 10)]
public string? Extra { get; set; }
public virtual ICollection<FeatPrerequisite> FeatPrerequisites { get; set; } = [];
}
@@ -1,21 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.FeatRelation;
public partial class FeatPrerequisite
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public int FeatId { get; set; }
[Column(Order = 3)]
[MaxLength(255)]
public string Value { get; set; } = null!;
public virtual Feat Feat { get; set; } = null!;
}
@@ -1,20 +0,0 @@
using Pf2eDataScrapper.Model.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure;
public partial class Heritage : IEntity
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Column(Order = 1)]
public int Id { get; set; }
public Entity Entity { get; set; } = null!;
[Column(Order = 2)]
public int? AncestryId { get; set; }
public virtual Ancestry? Ancestry { get; set; }
}
-59
View File
@@ -1,59 +0,0 @@
using Pf2eDataScrapper.Model.Base;
using Pf2eDataScrapper.Model.Structure.SpellRelation;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure;
public partial class Spell : IEntity
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Column(Order = 1)]
public int Id { get; set; }
public Entity Entity { get; set; } = null!;
[Column(Order = 2)]
public int Level { get; set; }
[Column(Order = 3)]
public int Cost { get; set; }
[Column(Order = 4)]
public bool Counteraction { get; set; }
[Column(Order = 5)]
public bool Sustained { get; set; }
[Column(Order = 6)]
[MaxLength(255)]
public string Duration { get; set; } = null!;
[Column(Order = 7)]
[MaxLength(255)]
public string Range { get; set; } = null!;
[Column(Order = 8)]
[MaxLength(255)]
public string Requirements { get; set; } = null!;
[Column(Order = 9)]
[MaxLength(255)]
public string Target { get; set; } = null!;
[Column(Order = 10)]
[MaxLength(255)]
public string Time { get; set; } = null!;
[Column(Order = 11)]
public bool CanHeightening { get; set; }
public virtual SpellArea? SpellArea { get; set; }
public virtual SpellRitual? SpellRitual { get; set; }
public virtual ICollection<SpellDamage> SpellDamages { get; set; } = new List<SpellDamage>();
public virtual ICollection<SpellDefense> SpellDefenses { get; set; } = new List<SpellDefense>();
}
@@ -1,25 +0,0 @@
using Pf2eDataScrapper.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.SpellRelation;
public partial class SpellArea
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Column(Order = 1)]
public int SpellId { get; set; }
[Column(Order = 2)]
[MaxLength(255)]
public string? Details { get; set; }
[Column(Order = 3)]
public SpellAreaType Type { get; set; }
[Column(Order = 4)]
public int Value { get; set; }
public virtual Spell Spell { get; set; } = null!;
}
@@ -1,43 +0,0 @@
using Pf2eDataScrapper.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.SpellRelation;
public partial class SpellDamage
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public int SpellId { get; set; }
[Column(Order = 3)]
[MaxLength(255)]
public string Key { get; set; } = null!;
[Column(Order = 4)]
public bool? ApplyMod { get; set; }
[Column(Order = 5)]
public SpellDamageCategory? Category { get; set; }
[Column(Order = 6)]
[MaxLength(255)]
public string Formula { get; set; } = null!;
[Column(Order = 7)]
public SpellDamageKinds Kinds { get; set; }
[Column(Order = 8)]
[MaxLength(255)]
public string? Materials { get; set; }
[Column(Order = 9)]
[MaxLength(255)]
public string Type { get; set; } = null!;
public virtual Spell Spell { get; set; } = null!;
}
@@ -1,27 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.SpellRelation;
public partial class SpellDefense
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column(Order = 1)]
public int Id { get; set; }
[Column(Order = 2)]
public int SpellId { get; set; }
[Column(Order = 3)]
public bool IsPassive { get; set; }
[Column(Order = 4)]
public bool? IsBasic { get; set; }
[Column(Order = 5)]
[MaxLength(255)]
public string Statistic { get; set; } = null!;
public virtual Spell Spell { get; set; } = null!;
}
@@ -1,25 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure.SpellRelation;
public partial class SpellRitual
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Column(Order = 1)]
public int SpellId { get; set; }
[Column(Order = 2)]
[MaxLength(255)]
public string PrimaryCheck { get; set; } = null!;
[Column(Order = 3)]
public int SecondaryCasters { get; set; }
[Column(Order = 4)]
[MaxLength(255)]
public string SecondaryChecks { get; set; } = null!;
public virtual Spell Spell { get; set; } = null!;
}
-21
View File
@@ -1,21 +0,0 @@
using Pf2eDataScrapper.Model.Base;
using Pf2eDataScrapper.Model.Enum;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Pf2eDataScrapper.Model.Structure;
public partial class Trait : IEntity
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Column(Order = 1)]
public int Id { get; set; }
public Entity Entity { get; set; } = null!;
[Column(Order = 2)]
public TraitType Type { get; set; }
public virtual ICollection<Entity> Entities { get; set; } = [];
}
+4 -4
View File
@@ -24,6 +24,10 @@
<PackageReference Include="Slugify.Core" Version="5.1.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Pf2eModel\Pf2eModel.csproj" />
</ItemGroup>
<ItemGroup>
<None Update=".env">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
@@ -33,8 +37,4 @@
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project>
+2
View File
@@ -1,6 +1,8 @@
using Pf2eDataScrapper;
using Pf2eDataScrapper.Importers.Implementations.Aonprd;
Console.SetWindowSize(Console.LargestWindowWidth - 20, Console.LargestWindowHeight - 10);
EnvSettings.Load();
/*