From 4b0382a931dae00ee33d35e30d31ead0aadb9b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20G=C3=B3reczny?= Date: Sun, 27 Dec 2020 20:08:19 +0100 Subject: [PATCH] SES-121 Added spells tables --- .../ApplicationDbContext.cs | 4 +- .../Repositories/CharacterSpellRepository.cs | 14 +++ .../CharacterSpellSlotsRepository.cs | 14 +++ .../Repositories/SpellRepository.cs | 14 +++ .../SessionCompanion.Database.csproj | 4 + .../Tables/CharacterSpell.cs | 18 ++++ .../Tables/CharacterSpellSlots.cs | 48 +++++++++ .../SessionCompanion.Database/Tables/Spell.cs | 25 +++++ .../Intefraces/ICharacterSpellService.cs | 14 +++ .../Intefraces/ICharacterSpellSlotsService.cs | 12 +++ .../Intefraces/ISpellService.cs | 13 +++ .../Profiles/CharacterSpellProfile.cs | 33 +++++++ .../Profiles/CharacterSpellSlotsProfile.cs | 14 +++ .../Profiles/SpellProfile.cs | 34 +++++++ .../Services/CharacterSpellService.cs | 20 ++++ .../Services/CharacterSpellSlotsService.cs | 20 ++++ .../Services/SpellService.cs | 18 ++++ .../CharacterSpellSlotsViewModel.cs | 48 +++++++++ .../CharacterSpellViewModel.cs | 14 +++ ...CharacterSpellWithSpellDetailsViewModel.cs | 25 +++++ .../Enums/SpellsEnums.cs | 99 +++++++++++++++++++ .../SessionCompanion.ViewModels.csproj | 4 + .../SpellViewModels/SpellViewModel.cs | 26 +++++ .../Configurations/RepositoryConfiguration.cs | 4 +- .../Configurations/ServiceConfiguration.cs | 4 + 25 files changed, 541 insertions(+), 2 deletions(-) create mode 100644 SessionCompanion/SessionCompanion.Database/Repositories/CharacterSpellRepository.cs create mode 100644 SessionCompanion/SessionCompanion.Database/Repositories/CharacterSpellSlotsRepository.cs create mode 100644 SessionCompanion/SessionCompanion.Database/Repositories/SpellRepository.cs create mode 100644 SessionCompanion/SessionCompanion.Database/Tables/CharacterSpell.cs create mode 100644 SessionCompanion/SessionCompanion.Database/Tables/CharacterSpellSlots.cs create mode 100644 SessionCompanion/SessionCompanion.Database/Tables/Spell.cs create mode 100644 SessionCompanion/SessionCompanion.Services/Intefraces/ICharacterSpellService.cs create mode 100644 SessionCompanion/SessionCompanion.Services/Intefraces/ICharacterSpellSlotsService.cs create mode 100644 SessionCompanion/SessionCompanion.Services/Intefraces/ISpellService.cs create mode 100644 SessionCompanion/SessionCompanion.Services/Profiles/CharacterSpellProfile.cs create mode 100644 SessionCompanion/SessionCompanion.Services/Profiles/CharacterSpellSlotsProfile.cs create mode 100644 SessionCompanion/SessionCompanion.Services/Profiles/SpellProfile.cs create mode 100644 SessionCompanion/SessionCompanion.Services/Services/CharacterSpellService.cs create mode 100644 SessionCompanion/SessionCompanion.Services/Services/CharacterSpellSlotsService.cs create mode 100644 SessionCompanion/SessionCompanion.Services/Services/SpellService.cs create mode 100644 SessionCompanion/SessionCompanion.ViewModels/CharacterSpellSlotsViewModels/CharacterSpellSlotsViewModel.cs create mode 100644 SessionCompanion/SessionCompanion.ViewModels/CharacterSpellViewModels/CharacterSpellViewModel.cs create mode 100644 SessionCompanion/SessionCompanion.ViewModels/CharacterSpellViewModels/CharacterSpellWithSpellDetailsViewModel.cs create mode 100644 SessionCompanion/SessionCompanion.ViewModels/Enums/SpellsEnums.cs create mode 100644 SessionCompanion/SessionCompanion.ViewModels/SpellViewModels/SpellViewModel.cs diff --git a/SessionCompanion/SessionCompanion.Database/ApplicationDbContext.cs b/SessionCompanion/SessionCompanion.Database/ApplicationDbContext.cs index 83ac5eb..def3e6f 100644 --- a/SessionCompanion/SessionCompanion.Database/ApplicationDbContext.cs +++ b/SessionCompanion/SessionCompanion.Database/ApplicationDbContext.cs @@ -24,7 +24,9 @@ namespace SessionCompanion.Database public virtual DbSet Strengths { get; set; } public virtual DbSet Users { get; set; } public virtual DbSet Wisdoms { get; set; } - + public virtual DbSet Spells { get; set; } + public virtual DbSet CharacterSpells { get; set; } + public virtual DbSet CharacterSpellSlots { get; set; } public ApplicationDbContext(DbContextOptions options) : base(options) { } protected override void OnModelCreating(ModelBuilder builder) diff --git a/SessionCompanion/SessionCompanion.Database/Repositories/CharacterSpellRepository.cs b/SessionCompanion/SessionCompanion.Database/Repositories/CharacterSpellRepository.cs new file mode 100644 index 0000000..50af106 --- /dev/null +++ b/SessionCompanion/SessionCompanion.Database/Repositories/CharacterSpellRepository.cs @@ -0,0 +1,14 @@ +using SessionCompanion.Database.Repositories.Base; +using SessionCompanion.Database.Tables; +using System; +using System.Collections.Generic; +using System.Text; + +namespace SessionCompanion.Database.Repositories +{ + public class CharacterSpellRepository : Repository, IRepository + { + public CharacterSpellRepository(ApplicationDbContext _dbContext) : base(_dbContext) + { } + } +} diff --git a/SessionCompanion/SessionCompanion.Database/Repositories/CharacterSpellSlotsRepository.cs b/SessionCompanion/SessionCompanion.Database/Repositories/CharacterSpellSlotsRepository.cs new file mode 100644 index 0000000..9d2542d --- /dev/null +++ b/SessionCompanion/SessionCompanion.Database/Repositories/CharacterSpellSlotsRepository.cs @@ -0,0 +1,14 @@ +using SessionCompanion.Database.Repositories.Base; +using SessionCompanion.Database.Tables; + +namespace SessionCompanion.Database.Repositories +{ + public class CharacterSpellSlotsRepository: Repository, IRepository + { + public CharacterSpellSlotsRepository(ApplicationDbContext _dbContext) + : base(_dbContext) + { + + } + } +} diff --git a/SessionCompanion/SessionCompanion.Database/Repositories/SpellRepository.cs b/SessionCompanion/SessionCompanion.Database/Repositories/SpellRepository.cs new file mode 100644 index 0000000..414f1b7 --- /dev/null +++ b/SessionCompanion/SessionCompanion.Database/Repositories/SpellRepository.cs @@ -0,0 +1,14 @@ +using SessionCompanion.Database.Repositories.Base; +using SessionCompanion.Database.Tables; +using System; +using System.Collections.Generic; +using System.Text; + +namespace SessionCompanion.Database.Repositories +{ + public class SpellRepository : Repository, IRepository + { + public SpellRepository(ApplicationDbContext _dbContext) : base(_dbContext) + { } + } +} diff --git a/SessionCompanion/SessionCompanion.Database/SessionCompanion.Database.csproj b/SessionCompanion/SessionCompanion.Database/SessionCompanion.Database.csproj index e084383..a157829 100644 --- a/SessionCompanion/SessionCompanion.Database/SessionCompanion.Database.csproj +++ b/SessionCompanion/SessionCompanion.Database/SessionCompanion.Database.csproj @@ -17,4 +17,8 @@ + + + + diff --git a/SessionCompanion/SessionCompanion.Database/Tables/CharacterSpell.cs b/SessionCompanion/SessionCompanion.Database/Tables/CharacterSpell.cs new file mode 100644 index 0000000..f8f9719 --- /dev/null +++ b/SessionCompanion/SessionCompanion.Database/Tables/CharacterSpell.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace SessionCompanion.Database.Tables +{ + public class CharacterSpell : BaseEntity + { + [ForeignKey(nameof(Character))] + public int CharacterId { get; set; } + public virtual Character Character { get; set; } + + [ForeignKey(nameof(Spell))] + public int SpellId { get; set; } + public virtual Spell Spell { get; set; } + } +} diff --git a/SessionCompanion/SessionCompanion.Database/Tables/CharacterSpellSlots.cs b/SessionCompanion/SessionCompanion.Database/Tables/CharacterSpellSlots.cs new file mode 100644 index 0000000..6800a98 --- /dev/null +++ b/SessionCompanion/SessionCompanion.Database/Tables/CharacterSpellSlots.cs @@ -0,0 +1,48 @@ + +namespace SessionCompanion.Database.Tables +{ + using System.ComponentModel.DataAnnotations.Schema; + + public class CharacterSpellSlots : BaseEntity + { + [ForeignKey(nameof(Character))] + public int CharacterId { get; set; } + public virtual Character Character { get; set; } + + public int FirstLevelSlots { get; set; } + + public int FirstLevelSlotsUsed { get; set; } + + public int SecondLevelSlots { get; set; } + + public int SecondLevelSlotsUsed { get; set; } + + public int ThirdLevelSlots { get; set; } + + public int ThirdLevelSlotsUsed { get; set; } + + public int FourthLevelSlots { get; set; } + + public int FourthLevelSlotsUsed { get; set; } + + public int FifthLevelSlots { get; set; } + + public int FifthLevelSlotsUsed { get; set; } + + public int SixthLevelSlots { get; set; } + + public int SixthLevelSlotsUsed { get; set; } + + public int SeventhLevelSlots { get; set; } + + public int SeventhLevelSlotsUsed { get; set; } + + public int EightLevelSlots { get; set; } + + public int EightLevelSlotsUsed { get; set; } + + public int NinthLevelSlots { get; set; } + + public int NinthLevelSlotsUsed { get; set; } + } +} diff --git a/SessionCompanion/SessionCompanion.Database/Tables/Spell.cs b/SessionCompanion/SessionCompanion.Database/Tables/Spell.cs new file mode 100644 index 0000000..0fa9185 --- /dev/null +++ b/SessionCompanion/SessionCompanion.Database/Tables/Spell.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using static SessionCompanion.ViewModels.Enums.SpellsEnums; + +namespace SessionCompanion.Database.Tables +{ + public class Spell : BaseEntity + { + public string Name { get; set; } + public string Description { get; set; } + public string HigherLevel { get; set; } + public Ranges Range { get; set; } + public string Components { get; set; } + public string Material { get; set; } + public bool Ritual { get; set; } + public Durations Duration { get; set; } + public bool Concentration { get; set; } + public CastingTimes CastingTime { get; set; } + public int Level { get; set; } + public Schools School { get; set; } + public string Classes { get; set; } + public string Subclasses { get; set; } + + public virtual ICollection CharacterSpells { get; set; } + } +} diff --git a/SessionCompanion/SessionCompanion.Services/Intefraces/ICharacterSpellService.cs b/SessionCompanion/SessionCompanion.Services/Intefraces/ICharacterSpellService.cs new file mode 100644 index 0000000..6c04548 --- /dev/null +++ b/SessionCompanion/SessionCompanion.Services/Intefraces/ICharacterSpellService.cs @@ -0,0 +1,14 @@ +using SessionCompanion.Database.Tables; +using SessionCompanion.Services.Base; +using SessionCompanion.ViewModels.CharacterSpellViewModels; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace SessionCompanion.Services.Interfaces +{ + public interface ICharacterSpellService : IServiceBase + { + } +} diff --git a/SessionCompanion/SessionCompanion.Services/Intefraces/ICharacterSpellSlotsService.cs b/SessionCompanion/SessionCompanion.Services/Intefraces/ICharacterSpellSlotsService.cs new file mode 100644 index 0000000..dfbd0de --- /dev/null +++ b/SessionCompanion/SessionCompanion.Services/Intefraces/ICharacterSpellSlotsService.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using SessionCompanion.Database.Tables; +using SessionCompanion.Services.Base; +using SessionCompanion.ViewModels.CharacterSpellSlotsViewModels; + +namespace SessionCompanion.Services.Interfaces +{ + public interface ICharacterSpellSlotsService : IServiceBase + { + } +} diff --git a/SessionCompanion/SessionCompanion.Services/Intefraces/ISpellService.cs b/SessionCompanion/SessionCompanion.Services/Intefraces/ISpellService.cs new file mode 100644 index 0000000..b520c8b --- /dev/null +++ b/SessionCompanion/SessionCompanion.Services/Intefraces/ISpellService.cs @@ -0,0 +1,13 @@ +using SessionCompanion.Database.Tables; +using SessionCompanion.Services.Base; +using SessionCompanion.ViewModels.SpellViewModels; +using System; +using System.Collections.Generic; +using System.Text; + +namespace SessionCompanion.Services.Interfaces +{ + public interface ISpellService : IServiceBase + { + } +} diff --git a/SessionCompanion/SessionCompanion.Services/Profiles/CharacterSpellProfile.cs b/SessionCompanion/SessionCompanion.Services/Profiles/CharacterSpellProfile.cs new file mode 100644 index 0000000..0bb7677 --- /dev/null +++ b/SessionCompanion/SessionCompanion.Services/Profiles/CharacterSpellProfile.cs @@ -0,0 +1,33 @@ +using AutoMapper; +using SessionCompanion.Database.Tables; +using SessionCompanion.ViewModels.CharacterSpellViewModels; +using System.Linq; + +namespace SessionCompanion.Services.Profiles +{ + public class CharacterSpellProfile : Profile + { + public CharacterSpellProfile() + { + CreateMap().ReverseMap(); + + CreateMap(); + CreateMap() + + .ForMember(vm => vm.Level, conf => conf.MapFrom(spell => spell.Spell.Level)) + .ForMember(vm => vm.Concentration, conf => conf.MapFrom(spell => spell.Spell.Concentration)) + .ForMember(vm => vm.Ritual, conf => conf.MapFrom(spell => spell.Spell.Ritual)) + .ForMember(vm => vm.Name, conf => conf.MapFrom(spell => spell.Spell.Name.ToString())) + .ForMember(vm => vm.Material, conf => conf.MapFrom(spell => spell.Spell.Material.ToString())) + .ForMember(vm => vm.Range, conf => conf.MapFrom(spell => spell.Spell.Range.ToString())) + .ForMember(vm => vm.Duration, conf => conf.MapFrom(spell => spell.Spell.Duration.ToString())) + .ForMember(vm => vm.CastingTime, conf => conf.MapFrom(spell => spell.Spell.CastingTime.ToString())) + .ForMember(vm => vm.School, conf => conf.MapFrom(spell => spell.Spell.School.ToString())) + .ForMember(vm => vm.Descriptions, conf => conf.MapFrom(spell => spell.Spell.Description.Split(new char[] { ';' }).ToList())) + .ForMember(vm => vm.Components, conf => conf.MapFrom(spell => spell.Spell.Components.Split(new char[] { ';' }).ToList())) + .ForMember(vm => vm.HigherLevel, conf => conf.MapFrom(spell => spell.Spell.HigherLevel.Split(new char[] { ';' }).ToList())) + .ForMember(vm => vm.Classes, conf => conf.MapFrom(spell => spell.Spell.Classes.Split(new char[] { ';' }).ToList())) + .ForMember(vm => vm.Subclasses, conf => conf.MapFrom(spell => spell.Spell.Subclasses.Split(new char[] { ';' }).ToList())); + } + } +} diff --git a/SessionCompanion/SessionCompanion.Services/Profiles/CharacterSpellSlotsProfile.cs b/SessionCompanion/SessionCompanion.Services/Profiles/CharacterSpellSlotsProfile.cs new file mode 100644 index 0000000..8222d1a --- /dev/null +++ b/SessionCompanion/SessionCompanion.Services/Profiles/CharacterSpellSlotsProfile.cs @@ -0,0 +1,14 @@ +using AutoMapper; +using SessionCompanion.Database.Tables; +using SessionCompanion.ViewModels.CharacterSpellSlotsViewModels; + +namespace SessionCompanion.Services.Profiles +{ + public class CharacterSpellSlotsProfile : Profile + { + public CharacterSpellSlotsProfile() + { + CreateMap().ReverseMap(); + } + } +} diff --git a/SessionCompanion/SessionCompanion.Services/Profiles/SpellProfile.cs b/SessionCompanion/SessionCompanion.Services/Profiles/SpellProfile.cs new file mode 100644 index 0000000..d41d420 --- /dev/null +++ b/SessionCompanion/SessionCompanion.Services/Profiles/SpellProfile.cs @@ -0,0 +1,34 @@ +using AutoMapper; +using SessionCompanion.Database.Tables; +using SessionCompanion.ViewModels.SpellViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace SessionCompanion.Services.Profiles +{ + public class SpellProfile : Profile + { + public SpellProfile() + { + CreateMap() + .ForMember(model => model.Description, conf => conf.MapFrom(spell => string.Join(";", spell.Descriptions.Select(s => s.ToString())))) + .ForMember(model => model.Components, conf => conf.MapFrom(spell => string.Join(";", spell.Components.Select(s => s.ToString())))) + .ForMember(model => model.HigherLevel, conf => conf.MapFrom(spell => string.Join(";", spell.HigherLevel.Select(s => s.ToString())))) + .ForMember(model => model.Classes, conf => conf.MapFrom(spell => string.Join(";", spell.Classes.Select(s => s.ToString())))) + .ForMember(model => model.Subclasses, conf => conf.MapFrom(spell => string.Join(";", spell.Subclasses.Select(s => s.ToString())))); + + CreateMap() + .ForMember(vm => vm.Range, conf => conf.MapFrom(spell => spell.Range.ToString())) + .ForMember(vm => vm.Duration, conf => conf.MapFrom(spell => spell.Duration.ToString())) + .ForMember(vm => vm.CastingTime, conf => conf.MapFrom(spell => spell.CastingTime.ToString())) + .ForMember(vm => vm.School, conf => conf.MapFrom(spell => spell.School.ToString())) + .ForMember(vm => vm.Descriptions, conf => conf.MapFrom(spell => spell.Description.Split(new char[] { ';' }).ToList())) + .ForMember(vm => vm.Components, conf => conf.MapFrom(spell => spell.Components.Split(new char[] { ';' }).ToList())) + .ForMember(vm => vm.HigherLevel, conf => conf.MapFrom(spell => spell.HigherLevel.Split(new char[] { ';' }).ToList())) + .ForMember(vm => vm.Classes, conf => conf.MapFrom(spell => spell.Classes.Split(new char[] { ';' }).ToList())) + .ForMember(vm => vm.Subclasses, conf => conf.MapFrom(spell => spell.Subclasses.Split(new char[] { ';' }).ToList())); + } + } +} diff --git a/SessionCompanion/SessionCompanion.Services/Services/CharacterSpellService.cs b/SessionCompanion/SessionCompanion.Services/Services/CharacterSpellService.cs new file mode 100644 index 0000000..3507185 --- /dev/null +++ b/SessionCompanion/SessionCompanion.Services/Services/CharacterSpellService.cs @@ -0,0 +1,20 @@ +using AutoMapper; +using Microsoft.EntityFrameworkCore; +using SessionCompanion.Database.Repositories.Base; +using SessionCompanion.Database.Tables; +using SessionCompanion.Services.Base; +using SessionCompanion.Services.Interfaces; +using SessionCompanion.ViewModels.CharacterSpellViewModels; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace SessionCompanion.Services.Services +{ + public class CharacterSpellService : ServiceBase, ICharacterSpellService + { + public CharacterSpellService(IMapper mapper, IRepository repository) : base(mapper, repository) + { } + } +} diff --git a/SessionCompanion/SessionCompanion.Services/Services/CharacterSpellSlotsService.cs b/SessionCompanion/SessionCompanion.Services/Services/CharacterSpellSlotsService.cs new file mode 100644 index 0000000..db8309e --- /dev/null +++ b/SessionCompanion/SessionCompanion.Services/Services/CharacterSpellSlotsService.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using AutoMapper; +using Microsoft.EntityFrameworkCore; +using SessionCompanion.Database.Repositories.Base; +using SessionCompanion.Database.Tables; +using SessionCompanion.Services.Base; +using SessionCompanion.Services.Interfaces; +using SessionCompanion.ViewModels.CharacterSpellSlotsViewModels; + +namespace SessionCompanion.Services.Services +{ + public class CharacterSpellSlotsService : ServiceBase, ICharacterSpellSlotsService + { + public CharacterSpellSlotsService(IMapper mapper, IRepository repository) : base(mapper, repository) { } + + } +} diff --git a/SessionCompanion/SessionCompanion.Services/Services/SpellService.cs b/SessionCompanion/SessionCompanion.Services/Services/SpellService.cs new file mode 100644 index 0000000..904c14a --- /dev/null +++ b/SessionCompanion/SessionCompanion.Services/Services/SpellService.cs @@ -0,0 +1,18 @@ +using AutoMapper; +using SessionCompanion.Database.Repositories.Base; +using SessionCompanion.Database.Tables; +using SessionCompanion.Services.Base; +using SessionCompanion.Services.Interfaces; +using SessionCompanion.ViewModels.SpellViewModels; +using System; +using System.Collections.Generic; +using System.Text; + +namespace SessionCompanion.Services.Services +{ + public class SpellService : ServiceBase, ISpellService + { + public SpellService(IMapper mapper, IRepository repository) : base(mapper, repository) + { } + } +} diff --git a/SessionCompanion/SessionCompanion.ViewModels/CharacterSpellSlotsViewModels/CharacterSpellSlotsViewModel.cs b/SessionCompanion/SessionCompanion.ViewModels/CharacterSpellSlotsViewModels/CharacterSpellSlotsViewModel.cs new file mode 100644 index 0000000..d223b52 --- /dev/null +++ b/SessionCompanion/SessionCompanion.ViewModels/CharacterSpellSlotsViewModels/CharacterSpellSlotsViewModel.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SessionCompanion.ViewModels.CharacterSpellSlotsViewModels +{ + public class CharacterSpellSlotsViewModel + { + public int Id { get; set; } + public int CharacterId { get; set; } + + public int? FirstLevelSlots { get; set; } + + public int FirstLevelSlotsUsed { get; set; } + + public int SecondLevelSlots { get; set; } + + public int SecondLevelSlotsUsed { get; set; } + + public int ThirdLevelSlots { get; set; } + + public int ThirdLevelSlotsUsed { get; set; } + + public int FourthLevelSlots { get; set; } + + public int FourthLevelSlotsUsed { get; set; } + + public int FifthLevelSlots { get; set; } + + public int FifthLevelSlotsUsed { get; set; } + + public int SixthLevelSlots { get; set; } + + public int SixthLevelSlotsUsed { get; set; } + + public int SeventhLevelSlots { get; set; } + + public int SeventhLevelSlotsUsed { get; set; } + + public int EightLevelSlots { get; set; } + + public int EightLevelSlotsUsed { get; set; } + + public int NinthLevelSlots { get; set; } + + public int NinthLevelSlotsUsed { get; set; } + } +} diff --git a/SessionCompanion/SessionCompanion.ViewModels/CharacterSpellViewModels/CharacterSpellViewModel.cs b/SessionCompanion/SessionCompanion.ViewModels/CharacterSpellViewModels/CharacterSpellViewModel.cs new file mode 100644 index 0000000..95bbe1e --- /dev/null +++ b/SessionCompanion/SessionCompanion.ViewModels/CharacterSpellViewModels/CharacterSpellViewModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace SessionCompanion.ViewModels.CharacterSpellViewModels +{ + public class CharacterSpellViewModel + { + public int Id { get; set; } + public int CharacterId { get; set; } + public int SpellId { get; set; } + } +} diff --git a/SessionCompanion/SessionCompanion.ViewModels/CharacterSpellViewModels/CharacterSpellWithSpellDetailsViewModel.cs b/SessionCompanion/SessionCompanion.ViewModels/CharacterSpellViewModels/CharacterSpellWithSpellDetailsViewModel.cs new file mode 100644 index 0000000..6e23fba --- /dev/null +++ b/SessionCompanion/SessionCompanion.ViewModels/CharacterSpellViewModels/CharacterSpellWithSpellDetailsViewModel.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SessionCompanion.ViewModels.CharacterSpellViewModels +{ + public class CharacterSpellWithSpellDetailsViewModel + { + public int SpellId { get; set; } + public string Name { get; set; } + public List Descriptions { get; set; } + public List HigherLevel { get; set; } + public string Range { get; set; } + public List Components { get; set; } + public string Material { get; set; } + public bool Ritual { get; set; } + public string Duration { get; set; } + public bool Concentration { get; set; } + public string CastingTime { get; set; } + public int Level { get; set; } + public string School { get; set; } + public List Classes { get; set; } + public List Subclasses { get; set; } + } +} diff --git a/SessionCompanion/SessionCompanion.ViewModels/Enums/SpellsEnums.cs b/SessionCompanion/SessionCompanion.ViewModels/Enums/SpellsEnums.cs new file mode 100644 index 0000000..16b416e --- /dev/null +++ b/SessionCompanion/SessionCompanion.ViewModels/Enums/SpellsEnums.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SessionCompanion.ViewModels.Enums +{ + public class SpellsEnums + { + public enum Components + { + V, + S, + M + } + + public enum Ranges + { + Self, + Touch, + Special, + Sight, + Unlimited, + Feet_5, + Feet_10, + Feet_30, + Feet_60, + Feet_90, + Feet_100, + Feet_120, + Feet_150, + Feet_300, + Feet_500, + Miles_1, + Miles_500 + } + + public enum Durations + { + Instantaneous, + Until_dispelled, + Special, + Minutes_1, + Minutes_10, + Hours_1, + Hours_2, + Hours_8, + Hours_24, + Days_7, + Days_10, + Days_30, + Round_1 + } + + public enum CastingTimes + { + Minutes_1, + Minutes_10, + Hours_1, + Hours_8, + Hours_12, + Hours_24, + Action_1, + Reaction_1, + Bonus_Action_1 + } + public enum Schools + { + Evocation, + Conjuration, + Abjuration, + Transmutation, + Enchantment, + Necromancy, + Divination, + Illusion + } + + public enum Classes + { + Wizard, + Sorcerer, + Cleric, + Paladin, + Ranger, + Bard, + Druid, + Warlock + } + + public enum Subclass + { + Lore, + Land, + Life, + Devotion, + Fiend + } + } +} \ No newline at end of file diff --git a/SessionCompanion/SessionCompanion.ViewModels/SessionCompanion.ViewModels.csproj b/SessionCompanion/SessionCompanion.ViewModels/SessionCompanion.ViewModels.csproj index 3ff6557..dfb1517 100644 --- a/SessionCompanion/SessionCompanion.ViewModels/SessionCompanion.ViewModels.csproj +++ b/SessionCompanion/SessionCompanion.ViewModels/SessionCompanion.ViewModels.csproj @@ -13,4 +13,8 @@ + + + + diff --git a/SessionCompanion/SessionCompanion.ViewModels/SpellViewModels/SpellViewModel.cs b/SessionCompanion/SessionCompanion.ViewModels/SpellViewModels/SpellViewModel.cs new file mode 100644 index 0000000..8cc17ad --- /dev/null +++ b/SessionCompanion/SessionCompanion.ViewModels/SpellViewModels/SpellViewModel.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace SessionCompanion.ViewModels.SpellViewModels +{ + public class SpellViewModel + { + public int Id { get; set; } + public string Name { get; set; } + public List Descriptions { get; set; } + public List HigherLevel { get; set; } + public string Range { get; set; } + public List Components { get; set; } + public string Material { get; set; } + public bool Ritual { get; set; } + public string Duration { get; set; } + public bool Concentration { get; set; } + public string CastingTime { get; set; } + public int Level { get; set; } + public string School { get; set; } + public List Classes { get; set; } + public List Subclasses { get; set; } + } +} diff --git a/SessionCompanion/SessionCompanion/Configurations/RepositoryConfiguration.cs b/SessionCompanion/SessionCompanion/Configurations/RepositoryConfiguration.cs index 888dce3..f379c5f 100644 --- a/SessionCompanion/SessionCompanion/Configurations/RepositoryConfiguration.cs +++ b/SessionCompanion/SessionCompanion/Configurations/RepositoryConfiguration.cs @@ -27,7 +27,9 @@ namespace SessionCompanion.Configurations services.AddScoped, StrengthRepository>(); services.AddScoped, UserRepository>(); services.AddScoped, WisdomRepository>(); - + services.AddScoped, SpellRepository>(); + services.AddScoped, CharacterSpellRepository>(); + services.AddScoped, CharacterSpellSlotsRepository>(); return services; } } diff --git a/SessionCompanion/SessionCompanion/Configurations/ServiceConfiguration.cs b/SessionCompanion/SessionCompanion/Configurations/ServiceConfiguration.cs index 0d29b5d..96390ed 100644 --- a/SessionCompanion/SessionCompanion/Configurations/ServiceConfiguration.cs +++ b/SessionCompanion/SessionCompanion/Configurations/ServiceConfiguration.cs @@ -26,6 +26,10 @@ namespace SessionCompanion.Configurations services.AddScoped(); services.AddScoped(); services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + return services; } }