Вынесение модели в отдельный проект
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Pf2eModel.Model.Base.Keywords;
|
||||
using Pf2eModel.Model.Base.Source;
|
||||
using Pf2eModel.Model.Base.Targets;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using Pf2eModel.Model.Structure;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.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; } = [];
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Pf2eModel.Model.Enum;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.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!;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.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; } = [];
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.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!;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.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!;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using Pf2eModel.Model.Enum;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.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; } = [];
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.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!;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Pf2eModel.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; } = [];
|
||||
}
|
||||
Reference in New Issue
Block a user