diff --git a/LiberIncantamentum.API/LiberIncantamentum.API.http b/LiberIncantamentum.API/LiberIncantamentum.API.http new file mode 100644 index 0000000..fef7bdf --- /dev/null +++ b/LiberIncantamentum.API/LiberIncantamentum.API.http @@ -0,0 +1,6 @@ +@LiberIncantamentum.API_HostAddress = http://localhost:5196 + +GET {{LiberIncantamentum.API_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/LiberIncantamentum.API/Liber_Incantamentum.API.csproj b/LiberIncantamentum.API/Liber_Incantamentum.API.csproj new file mode 100644 index 0000000..30d500a --- /dev/null +++ b/LiberIncantamentum.API/Liber_Incantamentum.API.csproj @@ -0,0 +1,17 @@ + + + + net9.0 + enable + enable + + + + + + + + + + + diff --git a/Liber_Incantamentum/Program.cs b/LiberIncantamentum.API/Program.cs similarity index 59% rename from Liber_Incantamentum/Program.cs rename to LiberIncantamentum.API/Program.cs index 6eb9fc2..666a9c5 100644 --- a/Liber_Incantamentum/Program.cs +++ b/LiberIncantamentum.API/Program.cs @@ -1,9 +1,3 @@ -using FluentValidation; -using Liber_Incantamentum.Application.Services.Mappings; -using Liber_Incantamentum.Application.Services.Validations; - - - var builder = WebApplication.CreateBuilder(args); // Add services to the container. @@ -12,10 +6,6 @@ builder.Services.AddControllers(); // Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi builder.Services.AddOpenApi(); -builder.Services.AddValidatorsFromAssemblyContaining(); - -builder.Services.AddAutoMapper(cfg => { }, typeof(MageMappingProfile).Assembly); - var app = builder.Build(); // Configure the HTTP request pipeline. diff --git a/Liber_Incantamentum/Properties/launchSettings.json b/LiberIncantamentum.API/Properties/launchSettings.json similarity index 80% rename from Liber_Incantamentum/Properties/launchSettings.json rename to LiberIncantamentum.API/Properties/launchSettings.json index 92c536d..d4118da 100644 --- a/Liber_Incantamentum/Properties/launchSettings.json +++ b/LiberIncantamentum.API/Properties/launchSettings.json @@ -5,7 +5,7 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": false, - "applicationUrl": "http://localhost:5225", + "applicationUrl": "http://localhost:5196", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } @@ -14,7 +14,7 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": false, - "applicationUrl": "https://localhost:7239;http://localhost:5225", + "applicationUrl": "https://localhost:7236;http://localhost:5196", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/Liber_Incantamentum/appsettings.Development.json b/LiberIncantamentum.API/appsettings.Development.json similarity index 100% rename from Liber_Incantamentum/appsettings.Development.json rename to LiberIncantamentum.API/appsettings.Development.json diff --git a/Liber_Incantamentum/appsettings.json b/LiberIncantamentum.API/appsettings.json similarity index 100% rename from Liber_Incantamentum/appsettings.json rename to LiberIncantamentum.API/appsettings.json diff --git a/LiberIncantamentum.Application/Liber_Incantamentum.Application.csproj b/LiberIncantamentum.Application/Liber_Incantamentum.Application.csproj new file mode 100644 index 0000000..125f4c9 --- /dev/null +++ b/LiberIncantamentum.Application/Liber_Incantamentum.Application.csproj @@ -0,0 +1,9 @@ + + + + net9.0 + enable + enable + + + diff --git a/LiberIncantamentum.Domain/Liber_Incantamentum.Domain.csproj b/LiberIncantamentum.Domain/Liber_Incantamentum.Domain.csproj new file mode 100644 index 0000000..125f4c9 --- /dev/null +++ b/LiberIncantamentum.Domain/Liber_Incantamentum.Domain.csproj @@ -0,0 +1,9 @@ + + + + net9.0 + enable + enable + + + diff --git a/LiberIncantamentum.Infrastructure/Liber_Incantamentum.Infrastructure.csproj b/LiberIncantamentum.Infrastructure/Liber_Incantamentum.Infrastructure.csproj new file mode 100644 index 0000000..125f4c9 --- /dev/null +++ b/LiberIncantamentum.Infrastructure/Liber_Incantamentum.Infrastructure.csproj @@ -0,0 +1,9 @@ + + + + net9.0 + enable + enable + + + diff --git a/LiberIncantamentum.UnitTests/Liber_Incantamentum.UnitTests.csproj b/LiberIncantamentum.UnitTests/Liber_Incantamentum.UnitTests.csproj new file mode 100644 index 0000000..125f4c9 --- /dev/null +++ b/LiberIncantamentum.UnitTests/Liber_Incantamentum.UnitTests.csproj @@ -0,0 +1,9 @@ + + + + net9.0 + enable + enable + + + diff --git a/Liber_Incantamentum.Application/DTOs/Mage/MageDto.cs b/Liber_Incantamentum.Application/DTOs/Mage/MageDto.cs deleted file mode 100644 index f85d816..0000000 --- a/Liber_Incantamentum.Application/DTOs/Mage/MageDto.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Liber_Incantamentum.Application.DTOs.Spell; - -namespace Liber_Incantamentum.Application.DTOs.Mage -{ - public class MageDto - { - public Guid Id { get; set; } - public required string Name { get; set; } - public required string Rank { get; set; } - public required string Specialisation { get; set; } - public ICollection Spells { get; set; } = new List(); - } -} diff --git a/Liber_Incantamentum.Application/DTOs/Mage/MageDtoCreate.cs b/Liber_Incantamentum.Application/DTOs/Mage/MageDtoCreate.cs deleted file mode 100644 index 9681d3c..0000000 --- a/Liber_Incantamentum.Application/DTOs/Mage/MageDtoCreate.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Liber_Incantamentum.Application.DTOs.Mage -{ - public class MageDtoCreate - { - public required string Name { get; set; } - public required string Rank { get; set; } - public required string Specialisation { get; set; } - } -} diff --git a/Liber_Incantamentum.Application/DTOs/Mage/MageDtoFilter.cs b/Liber_Incantamentum.Application/DTOs/Mage/MageDtoFilter.cs deleted file mode 100644 index 46eccf6..0000000 --- a/Liber_Incantamentum.Application/DTOs/Mage/MageDtoFilter.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Liber_Incantamentum.Application.DTOs.Mage -{ - public class MageDtoFilter - { - public Guid? Id { get; set; } - public string? Name { get; set; } - public string? Rank { get; set; } - public string? Specialisation { get; set; } - } -} diff --git a/Liber_Incantamentum.Application/DTOs/Mage/MageDtoUpdate.cs b/Liber_Incantamentum.Application/DTOs/Mage/MageDtoUpdate.cs deleted file mode 100644 index 364e29d..0000000 --- a/Liber_Incantamentum.Application/DTOs/Mage/MageDtoUpdate.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Liber_Incantamentum.Application.DTOs.Spell; - -namespace Liber_Incantamentum.Application.DTOs.Mage -{ - public class MageDtoUpdate - { - public Guid Id { get; set; } - public required string Name { get; set; } - public required string Rank { get; set; } - public required string Specialisation { get; set; } - public ICollection Spells { get; set; } = new List(); - } -} diff --git a/Liber_Incantamentum.Application/DTOs/Spell/SpellDto.cs b/Liber_Incantamentum.Application/DTOs/Spell/SpellDto.cs deleted file mode 100644 index f078fc6..0000000 --- a/Liber_Incantamentum.Application/DTOs/Spell/SpellDto.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Liber_Incantamentum.Application.DTOs.Spell -{ - public class SpellDto - { - public Guid Id { get; set; } - public required string Name { get; set; } - public required string Description { get; set; } - public required string Type { get; set; } - public required DateTime CreationDate { get; set; } - public Guid MageId { get; set; } - } -} diff --git a/Liber_Incantamentum.Application/DTOs/Spell/SpellDtoCreate.cs b/Liber_Incantamentum.Application/DTOs/Spell/SpellDtoCreate.cs deleted file mode 100644 index e70aeac..0000000 --- a/Liber_Incantamentum.Application/DTOs/Spell/SpellDtoCreate.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Liber_Incantamentum.Application.DTOs.Spell -{ - public class SpellDtoCreate - { - public required string Name { get; set; } - public required string Description { get; set; } - public required string Type { get; set; } - public required DateTime CreationDate { get; set; } - public Guid MageId { get; set; } - } -} diff --git a/Liber_Incantamentum.Application/DTOs/Spell/SpellDtoFilter.cs b/Liber_Incantamentum.Application/DTOs/Spell/SpellDtoFilter.cs deleted file mode 100644 index 1613788..0000000 --- a/Liber_Incantamentum.Application/DTOs/Spell/SpellDtoFilter.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Liber_Incantamentum.Application.DTOs.Spell -{ - public class SpellDtoFilter - { - public Guid? Id { get; set; } - public string? Name { get; set; } - public string? Description { get; set; } - public string? Type { get; set; } - public DateTime? CreationDate { get; set; } - public Guid? MageId { get; set; } - } -} diff --git a/Liber_Incantamentum.Application/DTOs/Spell/SpellDtoUpdate.cs b/Liber_Incantamentum.Application/DTOs/Spell/SpellDtoUpdate.cs deleted file mode 100644 index 6900f09..0000000 --- a/Liber_Incantamentum.Application/DTOs/Spell/SpellDtoUpdate.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Liber_Incantamentum.Application.DTOs.Spell -{ - public class SpellDtoUpdate - { - public Guid Id { get; set; } - public required string Name { get; set; } - public required string Description { get; set; } - public required string Type { get; set; } - public required DateTime CreationDate { get; set; } - public Guid MageId { get; set; } - } -} diff --git a/Liber_Incantamentum.Application/Exceptions/AlreadyExistingException.cs b/Liber_Incantamentum.Application/Exceptions/AlreadyExistingException.cs deleted file mode 100644 index 3f78eab..0000000 --- a/Liber_Incantamentum.Application/Exceptions/AlreadyExistingException.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Liber_Incantamentum.Application.Exceptions -{ - public class AlreadyExistingException : Exception - { - public AlreadyExistingException() { } - public AlreadyExistingException(string message) : base(message) { } - public AlreadyExistingException(string? message, Exception? innerException) : base(message, innerException) { } - } -} - - diff --git a/Liber_Incantamentum.Application/Exceptions/ConflictException.cs b/Liber_Incantamentum.Application/Exceptions/ConflictException.cs deleted file mode 100644 index 08af113..0000000 --- a/Liber_Incantamentum.Application/Exceptions/ConflictException.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Liber_Incantamentum.Application.Exceptions -{ - public class ConflictException : Exception - { - public ConflictException() { } - public ConflictException(string message) : base(message) { } - public ConflictException(string? message, Exception? innerException) : base(message, innerException) { } - } -} diff --git a/Liber_Incantamentum.Application/Exceptions/NotFoundException.cs b/Liber_Incantamentum.Application/Exceptions/NotFoundException.cs deleted file mode 100644 index 998d741..0000000 --- a/Liber_Incantamentum.Application/Exceptions/NotFoundException.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Liber_Incantamentum.Application.Exceptions -{ - public class NotFoundException : Exception - { - public NotFoundException() { } - public NotFoundException(string message) : base(message) { } - public NotFoundException(string? message, Exception? innerException) : base(message, innerException) { } - } -} diff --git a/Liber_Incantamentum.Application/Interfaces/IMageService.cs b/Liber_Incantamentum.Application/Interfaces/IMageService.cs deleted file mode 100644 index 340878b..0000000 --- a/Liber_Incantamentum.Application/Interfaces/IMageService.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Liber_Incantamentum.Application.DTOs.Mage; - -namespace Liber_Incantamentum.Application.Interfaces -{ - public interface IMageService - { - Task> GetAllMagesAsync(MageDtoFilter filter); - Task UpdateMageAsync(MageDtoUpdate dto, Guid id); - Task DeleteMageAsync(Guid id); - Task AddMageAsync(MageDtoCreate dto); - Task? GetMageByIdAsync(Guid id); - } -} diff --git a/Liber_Incantamentum.Application/Interfaces/ISpellService.cs b/Liber_Incantamentum.Application/Interfaces/ISpellService.cs deleted file mode 100644 index e9d87cd..0000000 --- a/Liber_Incantamentum.Application/Interfaces/ISpellService.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Liber_Incantamentum.Application.DTOs.Spell; - -namespace Liber_Incantamentum.Application.Interfaces -{ - public interface ISpellService - { - Task> GetAllSpellsAsync(SpellDtoFilter filter); - Task UpdateSpellAsync(SpellDtoUpdate dto, Guid id); - Task DeleteSpellAsync(Guid id); - Task AddSpellAsync(SpellDtoCreate dto); - Task? GetSpellByIdAsync(Guid id); - } -} \ No newline at end of file diff --git a/Liber_Incantamentum.Application/Liber_Incantamentum.Application.csproj b/Liber_Incantamentum.Application/Liber_Incantamentum.Application.csproj deleted file mode 100644 index 2c768fb..0000000 --- a/Liber_Incantamentum.Application/Liber_Incantamentum.Application.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - net9.0 - enable - enable - - - - - - - - - - - - diff --git a/Liber_Incantamentum.Application/Services/Generals/MageService.cs b/Liber_Incantamentum.Application/Services/Generals/MageService.cs deleted file mode 100644 index e95e730..0000000 --- a/Liber_Incantamentum.Application/Services/Generals/MageService.cs +++ /dev/null @@ -1,84 +0,0 @@ -using AutoMapper; -using Liber_Incantamentum.Application.DTOs.Mage; -using Liber_Incantamentum.Application.Exceptions; -using Liber_Incantamentum.Application.Interfaces; -using Liber_Incantamentum.Domain.Entities; -using Liber_Incantamentum.Domain.Filter; -using Liber_Incantamentum.Domain.Repositories; - -namespace Liber_Incantamentum.Application.Services.Generals -{ - public class MageService : IMageService - { - private readonly IMageRepository _mageRepository; - private readonly IMapper _mapper; - public MageService(IMageRepository mageRepository, IMapper mapper) - { - _mageRepository = mageRepository; - _mapper = mapper; - } - - public async Task AddMageAsync(MageDtoCreate dto) - { - if (dto == null) - { - throw new ArgumentNullException("The DTO received is null"); - } - var alreadyExistingMage = await GetAllMagesAsync(new MageDtoFilter { Name = dto.Name, Rank = dto.Rank, Specialisation = dto.Specialisation }); - if (alreadyExistingMage.Any()) - { - throw new AlreadyExistingException("This mage does already exists"); - } - return await _mageRepository.AddMageAsync(_mapper.Map(dto)); - } - - public async Task DeleteMageAsync(Guid id) - { - if (id == Guid.Empty) - { - throw new ArgumentNullException("The id is null"); - } - var alreadyExistingMage = await GetAllMagesAsync(new MageDtoFilter { Id = id }); - if (!alreadyExistingMage.Any()) - { - throw new NotFoundException("This mage does not exists"); - } - return await _mageRepository.DeleteMageAsync(id); - } - - public async Task> GetAllMagesAsync(MageDtoFilter filter) - { - var entities = await _mageRepository.GetAllMagesAsync(_mapper.Map(filter)); - return _mapper.Map>(entities); - } - - public async Task? GetMageByIdAsync(Guid id) - { - if (id == Guid.Empty) - { - throw new ArgumentNullException("The id is null"); - } - var alreadyExistingMage = await GetAllMagesAsync(new MageDtoFilter { Id = id }); - if (!alreadyExistingMage.Any()) - { - throw new NotFoundException("This mage does not exists"); - } - var mage = await _mageRepository.GetMageByIdAsync(id); - return _mapper.Map(mage); - } - - public async Task UpdateMageAsync(MageDtoUpdate dto, Guid id) - { - if (dto == null) - { - throw new ArgumentNullException("The DTO received is null"); - } - var alreadyExistingMage = await GetMageByIdAsync(id); - if (alreadyExistingMage == null) - { - throw new NotFoundException("This mage does not exists"); - } - return await _mageRepository.UpdateMageAsync(_mapper.Map(dto)); - } - } -} diff --git a/Liber_Incantamentum.Application/Services/Generals/SpellService.cs b/Liber_Incantamentum.Application/Services/Generals/SpellService.cs deleted file mode 100644 index b5ffcba..0000000 --- a/Liber_Incantamentum.Application/Services/Generals/SpellService.cs +++ /dev/null @@ -1,83 +0,0 @@ -using AutoMapper; -using Liber_Incantamentum.Application.DTOs.Spell; -using Liber_Incantamentum.Application.Exceptions; -using Liber_Incantamentum.Application.Interfaces; -using Liber_Incantamentum.Domain.Entities; -using Liber_Incantamentum.Domain.Filter; -using Liber_Incantamentum.Domain.Repositories; - -namespace Liber_Incantamentum.Application.Services.Generals -{ - public class SpellService : ISpellService - { - private readonly ISpellRepository _spellRepository; - private readonly IMapper _mapper; - public SpellService(ISpellRepository spellRepository, IMapper mapper) - { - _spellRepository = spellRepository; - _mapper = mapper; - } - public async Task AddSpellAsync(SpellDtoCreate dto) - { - if (dto == null) - { - throw new ArgumentNullException("The DTO received is null"); - } - var alreadyExistingSpell = await GetAllSpellsAsync(new SpellDtoFilter { Name = dto.Name, Description = dto.Description, Type = dto.Type, CreationDate = dto.CreationDate, MageId = dto.MageId }); - if (alreadyExistingSpell.Any()) - { - throw new AlreadyExistingException("This spell does already exists"); - } - return await _spellRepository.AddSpellAsync(_mapper.Map(dto)); - } - - public async Task DeleteSpellAsync(Guid id) - { - if (id == Guid.Empty) - { - throw new ArgumentNullException("The id is null"); - } - var alreadyExistingSpell = await GetAllSpellsAsync(new SpellDtoFilter { Id = id }); - if (!alreadyExistingSpell.Any()) - { - throw new AlreadyExistingException("This spell does not exists"); - } - return await _spellRepository.DeleteSpellAsync(id); - } - - public async Task> GetAllSpellsAsync(SpellDtoFilter filter) - { - var entities = await _spellRepository.GetAllSpellsAsync(_mapper.Map(filter)); - return _mapper.Map>(entities); - } - - public async Task? GetSpellByIdAsync(Guid id) - { - if (id == Guid.Empty) - { - throw new ArgumentNullException("The id is null"); - } - var alreadyExistingMage = await GetAllSpellsAsync(new SpellDtoFilter { Id = id }); - if (!alreadyExistingMage.Any()) - { - throw new NotFoundException("This spell does not exists"); - } - var mage = await _spellRepository.GetSpellByIdAsync(id); - return _mapper.Map(mage); - } - - public async Task UpdateSpellAsync(SpellDtoUpdate dto, Guid i) - { - if (dto == null) - { - throw new ArgumentNullException("The DTO received is null"); - } - var alreadyExistingSpell = await GetAllSpellsAsync(new SpellDtoFilter { Id = dto.Id, Name = dto.Name, Description = dto.Description, Type = dto.Type, CreationDate = dto.CreationDate, MageId = dto.MageId }); - if (!alreadyExistingSpell.Any()) - { - throw new NotFoundException("This spell does not exists"); - } - return await _spellRepository.UpdateSpellAsync(_mapper.Map(dto)); - } - } -} diff --git a/Liber_Incantamentum.Application/Services/Mappings/MageMappingProfile.cs b/Liber_Incantamentum.Application/Services/Mappings/MageMappingProfile.cs deleted file mode 100644 index 457db78..0000000 --- a/Liber_Incantamentum.Application/Services/Mappings/MageMappingProfile.cs +++ /dev/null @@ -1,30 +0,0 @@ -using AutoMapper; -using Liber_Incantamentum.Application.DTOs.Mage; -using Liber_Incantamentum.Domain.Entities; -using Liber_Incantamentum.Domain.Filter; - -namespace Liber_Incantamentum.Application.Services.Mappings -{ - public class MageMappingProfile : Profile - { - public MageMappingProfile() - { - CreateMap() - .ForMember(dest => dest.Id, opt => opt.Ignore()) - .ForMember(dest => dest.Spells, opt => opt.Ignore()) - .ReverseMap(); - - CreateMap() - .ForMember(dest => dest.Id, opt => opt.Ignore()) - .ReverseMap(); - - CreateMap() - .ReverseMap(); - - CreateMap() - .ForMember(dest => dest.Id, opt => opt.Ignore()) - .ReverseMap(); - - } - } -} diff --git a/Liber_Incantamentum.Application/Services/Mappings/SpellMappingProfile.cs b/Liber_Incantamentum.Application/Services/Mappings/SpellMappingProfile.cs deleted file mode 100644 index 4a72022..0000000 --- a/Liber_Incantamentum.Application/Services/Mappings/SpellMappingProfile.cs +++ /dev/null @@ -1,29 +0,0 @@ -using AutoMapper; -using Liber_Incantamentum.Application.DTOs.Spell; -using Liber_Incantamentum.Domain.Entities; -using Liber_Incantamentum.Domain.Filter; - -namespace Liber_Incantamentum.Application.Services.Mappings -{ - public class SpellMappingProfile : Profile - { - public SpellMappingProfile() - { - CreateMap() - .ForMember(x => x.Id, x => x.Ignore()) - .ReverseMap(); - - CreateMap() - .ForMember(x => x.Id, x => x.Ignore()) - .ReverseMap(); - - CreateMap() - .ReverseMap(); - - CreateMap() - .ForMember(x => x.Id, x => x.Ignore()) - .ReverseMap(); - } - } -} - diff --git a/Liber_Incantamentum.Application/Services/Validations/MageDtoCreateValidator.cs b/Liber_Incantamentum.Application/Services/Validations/MageDtoCreateValidator.cs deleted file mode 100644 index 8f63f9c..0000000 --- a/Liber_Incantamentum.Application/Services/Validations/MageDtoCreateValidator.cs +++ /dev/null @@ -1,18 +0,0 @@ -using FluentValidation; -using Liber_Incantamentum.Application.DTOs.Mage; - -namespace Liber_Incantamentum.Application.Services.Validations -{ - public class MageDtoCreateValidator : AbstractValidator - { - public MageDtoCreateValidator() - { - RuleFor(m => m.Name) - .NotEmpty().WithMessage("The name is required"); - RuleFor(m => m.Rank) - .NotEmpty().WithMessage("The Rank is required"); - RuleFor(m => m.Specialisation) - .NotEmpty().WithMessage("The specialisation is required"); - } - } -} diff --git a/Liber_Incantamentum.Application/Services/Validations/MageDtoFilterValidator.cs b/Liber_Incantamentum.Application/Services/Validations/MageDtoFilterValidator.cs deleted file mode 100644 index cbf5a97..0000000 --- a/Liber_Incantamentum.Application/Services/Validations/MageDtoFilterValidator.cs +++ /dev/null @@ -1,32 +0,0 @@ -using FluentValidation; -using Liber_Incantamentum.Application.DTOs.Mage; - -namespace Liber_Incantamentum.Application.Services.Validations -{ - public class MageDtoFilterValidator : AbstractValidator - { - public MageDtoFilterValidator() - { - When(m => m.Id.HasValue, () => - { - RuleFor(m => m.Id) - .NotEmpty().WithMessage("The id cannot be empty if provided"); - }); - When(m => !string.IsNullOrEmpty(m.Name), () => - { - RuleFor(m => m.Name) - .MinimumLength(2).WithMessage("Name must be at least 2 characters."); - }); - When(m => !string.IsNullOrEmpty(m.Rank), () => - { - RuleFor(m => m.Rank) - .MinimumLength(2).WithMessage("Name must be at least 2 characters."); - }); - When(m => !string.IsNullOrEmpty(m.Specialisation), () => - { - RuleFor(m => m.Specialisation) - .MinimumLength(2).WithMessage("Name must be at least 2 characters."); - }); - } - } -} diff --git a/Liber_Incantamentum.Application/Services/Validations/MageDtoUpdateValidator.cs b/Liber_Incantamentum.Application/Services/Validations/MageDtoUpdateValidator.cs deleted file mode 100644 index 4225257..0000000 --- a/Liber_Incantamentum.Application/Services/Validations/MageDtoUpdateValidator.cs +++ /dev/null @@ -1,20 +0,0 @@ -using FluentValidation; -using Liber_Incantamentum.Application.DTOs.Mage; - -namespace Liber_Incantamentum.Application.Services.Validations -{ - public class MageDtoUpdateValidator : AbstractValidator - { - public MageDtoUpdateValidator() - { - RuleFor(m => m.Id) - .NotEmpty().WithMessage("The Id is required"); - RuleFor(m => m.Name) - .NotEmpty().WithMessage("The Name is required"); - RuleFor(m => m.Rank) - .NotEmpty().WithMessage("The Rank is required"); - RuleFor(m => m.Specialisation) - .NotEmpty().WithMessage("The Specialisation is required"); - } - } -} diff --git a/Liber_Incantamentum.Application/Services/Validations/MageDtoValidator.cs b/Liber_Incantamentum.Application/Services/Validations/MageDtoValidator.cs deleted file mode 100644 index a00aea4..0000000 --- a/Liber_Incantamentum.Application/Services/Validations/MageDtoValidator.cs +++ /dev/null @@ -1,30 +0,0 @@ -using FluentValidation; -using Liber_Incantamentum.Application.DTOs.Mage; - -namespace Liber_Incantamentum.Application.Services.Validations -{ - public class MageDtoValidator : AbstractValidator - { - public MageDtoValidator() - { - RuleFor(m => m.Id) - .NotEmpty().WithMessage("The Id is required"); - - RuleFor(m => m.Name) - .NotEmpty().WithMessage("The Name is required"); - - RuleFor(m => m.Rank) - .NotEmpty().WithMessage("The Rank is required"); - - RuleFor(m => m.Specialisation) - .NotEmpty().WithMessage("The Specialisation is required"); - - RuleFor(m => m.Spells) - .NotNull().WithMessage("Spell collection is required") - .NotEmpty().WithMessage("At least one spell is required"); - - RuleForEach(m => m.Spells) - .SetValidator(new SpellDtoValidator()); - } - } -} diff --git a/Liber_Incantamentum.Application/Services/Validations/SpellDtoCreateValidator.cs b/Liber_Incantamentum.Application/Services/Validations/SpellDtoCreateValidator.cs deleted file mode 100644 index a27432c..0000000 --- a/Liber_Incantamentum.Application/Services/Validations/SpellDtoCreateValidator.cs +++ /dev/null @@ -1,22 +0,0 @@ -using FluentValidation; -using Liber_Incantamentum.Application.DTOs.Spell; - -namespace Liber_Incantamentum.Application.Services.Validations -{ - public class SpellDtoCreateValidator : AbstractValidator - { - public SpellDtoCreateValidator() - { - RuleFor(m => m.Name) - .NotEmpty().WithMessage("The Name is required"); - RuleFor(m => m.Description) - .NotEmpty().WithMessage("The description is required"); - RuleFor(m => m.Type) - .NotEmpty().WithMessage("The type is required"); - RuleFor(m => m.CreationDate) - .LessThanOrEqualTo(DateTime.UtcNow); - RuleFor(m => m.MageId) - .NotEmpty().WithMessage("The mage id is required"); - } - } -} diff --git a/Liber_Incantamentum.Application/Services/Validations/SpellDtoFilterValidator.cs b/Liber_Incantamentum.Application/Services/Validations/SpellDtoFilterValidator.cs deleted file mode 100644 index 227d0d4..0000000 --- a/Liber_Incantamentum.Application/Services/Validations/SpellDtoFilterValidator.cs +++ /dev/null @@ -1,22 +0,0 @@ -using FluentValidation; -using Liber_Incantamentum.Application.DTOs.Spell; - -namespace Liber_Incantamentum.Application.Services.Validations -{ - public class SpellDtoFilterValidator : AbstractValidator - { - public SpellDtoFilterValidator() - { - When(m => m.Id.HasValue, () => - { - RuleFor(m => m.Id) - .NotEmpty().WithMessage("The id cannot be empty if provided"); - }); - When(m => !string.IsNullOrEmpty(m.Name), () => - { - RuleFor(m => m.Name) - .MinimumLength(2).WithMessage("Name must be at least 2 characters."); - }); - } - } -} diff --git a/Liber_Incantamentum.Application/Services/Validations/SpellDtoUpdateValidator.cs b/Liber_Incantamentum.Application/Services/Validations/SpellDtoUpdateValidator.cs deleted file mode 100644 index ebc4598..0000000 --- a/Liber_Incantamentum.Application/Services/Validations/SpellDtoUpdateValidator.cs +++ /dev/null @@ -1,24 +0,0 @@ -using FluentValidation; -using Liber_Incantamentum.Application.DTOs.Spell; - -namespace Liber_Incantamentum.Application.Services.Validations -{ - public class SpellDtoUpdateValidator : AbstractValidator - { - public SpellDtoUpdateValidator() - { - RuleFor(m => m.Id) - .NotEmpty().WithMessage("The Id cannot be empty"); - RuleFor(m => m.Name) - .NotEmpty().WithMessage("The Name cannot be empty"); - RuleFor(m => m.Description) - .NotEmpty().WithMessage("The Description cannot be empty"); - RuleFor(m => m.Type) - .NotEmpty().WithMessage("The Type cannot be empty"); - RuleFor(m => m.CreationDate) - .LessThanOrEqualTo(DateTime.UtcNow); - RuleFor(m => m.MageId) - .NotEmpty().WithMessage("The mage id cannot be empty"); - } - } -} diff --git a/Liber_Incantamentum.Application/Services/Validations/SpellDtoValidator.cs b/Liber_Incantamentum.Application/Services/Validations/SpellDtoValidator.cs deleted file mode 100644 index 2a3c380..0000000 --- a/Liber_Incantamentum.Application/Services/Validations/SpellDtoValidator.cs +++ /dev/null @@ -1,24 +0,0 @@ -using FluentValidation; -using Liber_Incantamentum.Application.DTOs.Spell; - -namespace Liber_Incantamentum.Application.Services.Validations -{ - public class SpellDtoValidator : AbstractValidator - { - public SpellDtoValidator() - { - RuleFor(m => m.Id) - .NotEmpty().WithMessage("The Id cannot be empty"); - RuleFor(m => m.Name) - .NotEmpty().WithMessage("The Name cannot be empty"); - RuleFor(m => m.Description) - .NotEmpty().WithMessage("The Description cannot be empty"); - RuleFor(m => m.Type) - .NotEmpty().WithMessage("The Type cannot be empty"); - RuleFor(m => m.CreationDate) - .LessThanOrEqualTo(DateTime.UtcNow); - RuleFor(m => m.MageId) - .NotEmpty().WithMessage("The mage id cannot be empty"); - } - } -} diff --git a/Liber_Incantamentum.Domain/Entities/Mage.cs b/Liber_Incantamentum.Domain/Entities/Mage.cs deleted file mode 100644 index 36cd73d..0000000 --- a/Liber_Incantamentum.Domain/Entities/Mage.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Liber_Incantamentum.Domain.Entities -{ - public class Mage - { - public Guid Id { get; private set; } - public Mage() - { - Id = Guid.NewGuid(); - } - public required string Name { get; set; } - public required string Rank { get; set; } - public required string Specialisation { get; set; } - public ICollection Spells { get; set; } = new List(); - } -} diff --git a/Liber_Incantamentum.Domain/Entities/Spell.cs b/Liber_Incantamentum.Domain/Entities/Spell.cs deleted file mode 100644 index 7539e97..0000000 --- a/Liber_Incantamentum.Domain/Entities/Spell.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Liber_Incantamentum.Domain.Entities -{ - public class Spell - { - public Guid Id { get; private set; } - public Spell() - { - Id = Guid.NewGuid(); - } - public required string Name { get; set; } - public required string Description { get; set; } - public required string Type { get; set; } - public required DateTime CreationDate { get; set; } - public Guid MageId { get; set; } - public Mage Mage { get; set; } = null!; - } -} diff --git a/Liber_Incantamentum.Domain/Filter/MageFilter.cs b/Liber_Incantamentum.Domain/Filter/MageFilter.cs deleted file mode 100644 index 39354be..0000000 --- a/Liber_Incantamentum.Domain/Filter/MageFilter.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Liber_Incantamentum.Domain.Filter -{ - public class MageFilter - { - public Guid? Id { get; set; } - public string? Name { get; set; } - public string? Rank { get; set; } - public string? Specialisation { get; set; } - } -} diff --git a/Liber_Incantamentum.Domain/Filter/SpellFilter.cs b/Liber_Incantamentum.Domain/Filter/SpellFilter.cs deleted file mode 100644 index 4092d8f..0000000 --- a/Liber_Incantamentum.Domain/Filter/SpellFilter.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Liber_Incantamentum.Domain.Filter -{ - public class SpellFilter - { - public Guid? Id { get; set; } - public string? Name { get; set; } - public string? Description { get; set; } - public string? Type { get; set; } - public DateTime? CreationDate { get; set; } - public Guid? MageId { get; set; } - } -} diff --git a/Liber_Incantamentum.Domain/Liber_Incantamentum.Domain.csproj b/Liber_Incantamentum.Domain/Liber_Incantamentum.Domain.csproj deleted file mode 100644 index bb0eca4..0000000 --- a/Liber_Incantamentum.Domain/Liber_Incantamentum.Domain.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - net9.0 - enable - enable - - - - - - - - - - - - - - - diff --git a/Liber_Incantamentum.Domain/Repositories/IMageRepository.cs b/Liber_Incantamentum.Domain/Repositories/IMageRepository.cs deleted file mode 100644 index 984f116..0000000 --- a/Liber_Incantamentum.Domain/Repositories/IMageRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Liber_Incantamentum.Domain.Entities; -using Liber_Incantamentum.Domain.Filter; - -namespace Liber_Incantamentum.Domain.Repositories -{ - public interface IMageRepository - { - Task> GetAllMagesAsync(MageFilter filterEntity); - Task UpdateMageAsync(Mage entity); - Task DeleteMageAsync(Guid id); - Task AddMageAsync(Mage entity); - Task GetMageByIdAsync(Guid id); - } -} diff --git a/Liber_Incantamentum.Domain/Repositories/ISpellRepository.cs b/Liber_Incantamentum.Domain/Repositories/ISpellRepository.cs deleted file mode 100644 index 9fb1e9d..0000000 --- a/Liber_Incantamentum.Domain/Repositories/ISpellRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Liber_Incantamentum.Domain.Entities; -using Liber_Incantamentum.Domain.Filter; - -namespace Liber_Incantamentum.Domain.Repositories -{ - public interface ISpellRepository - { - Task> GetAllSpellsAsync(SpellFilter filterEntity); - Task UpdateSpellAsync(Spell entity); - Task DeleteSpellAsync(Guid id); - Task AddSpellAsync(Spell entity); - Task GetSpellByIdAsync(Guid id); - } -} diff --git a/Liber_Incantamentum.FunctionnalTests/Liber_Incantamentum.FunctionalTests.csproj b/Liber_Incantamentum.FunctionnalTests/Liber_Incantamentum.FunctionalTests.csproj new file mode 100644 index 0000000..125f4c9 --- /dev/null +++ b/Liber_Incantamentum.FunctionnalTests/Liber_Incantamentum.FunctionalTests.csproj @@ -0,0 +1,9 @@ + + + + net9.0 + enable + enable + + + diff --git a/Liber_Incantamentum.Infrastructure/DependencyInjection/DependencyInjection.cs b/Liber_Incantamentum.Infrastructure/DependencyInjection/DependencyInjection.cs deleted file mode 100644 index 8cc6275..0000000 --- a/Liber_Incantamentum.Infrastructure/DependencyInjection/DependencyInjection.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Liber_Incantamentum.Infrastructure.DependencyInjection -{ - public class DependencyInjection - { - } -} diff --git a/Liber_Incantamentum.Infrastructure/Liber_Incantamentum.Infrastructure.csproj b/Liber_Incantamentum.Infrastructure/Liber_Incantamentum.Infrastructure.csproj deleted file mode 100644 index 760b8fb..0000000 --- a/Liber_Incantamentum.Infrastructure/Liber_Incantamentum.Infrastructure.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - - net9.0 - enable - enable - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Liber_Incantamentum.Infrastructure/Persistence/AppDbContext.cs b/Liber_Incantamentum.Infrastructure/Persistence/AppDbContext.cs deleted file mode 100644 index ef65ced..0000000 --- a/Liber_Incantamentum.Infrastructure/Persistence/AppDbContext.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Liber_Incantamentum.Domain.Entities; -using Microsoft.EntityFrameworkCore; - -namespace Liber_Incantamentum.Infrastructure.Persistence -{ - public class AppDbContext : DbContext - { - public AppDbContext(DbContextOptions options) : base(options) - { - } - public DbSet Mages { get; set; } - public DbSet Spells { get; set; } - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.ApplyConfigurationsFromAssembly(typeof(AppDbContext).Assembly); - base.OnModelCreating(modelBuilder); - } - } - -} diff --git a/Liber_Incantamentum.Infrastructure/Persistence/Configurations/MageConfiguration.cs b/Liber_Incantamentum.Infrastructure/Persistence/Configurations/MageConfiguration.cs deleted file mode 100644 index 80ecd38..0000000 --- a/Liber_Incantamentum.Infrastructure/Persistence/Configurations/MageConfiguration.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Liber_Incantamentum.Domain.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - - -namespace Liber_Incantamentum.Infrastructure.Persistence.Configurations -{ - public class MageConfiguration : IEntityTypeConfiguration - { - public void Configure(EntityTypeBuilder builder) - { - builder.ToTable("Mages"); - - builder.HasKey(m => m.Id); - - builder.Property(m => m.Id) - .ValueGeneratedOnAdd(); - - builder.Property(m => m.Name) - .IsRequired() - .HasMaxLength(200); - - builder.Property(m => m.Rank) - .IsRequired() - .HasMaxLength(200); - - builder.Property(m => m.Specialisation) - .IsRequired() - .HasMaxLength(200); - } - } -} diff --git a/Liber_Incantamentum.Infrastructure/Persistence/Configurations/SpellConfiguration.cs b/Liber_Incantamentum.Infrastructure/Persistence/Configurations/SpellConfiguration.cs deleted file mode 100644 index cfdb616..0000000 --- a/Liber_Incantamentum.Infrastructure/Persistence/Configurations/SpellConfiguration.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Liber_Incantamentum.Infrastructure.Persistence.Configurations -{ - internal class SpellConfiguration - { - } -} diff --git a/Liber_Incantamentum.Infrastructure/Repositories/MageRepository.cs b/Liber_Incantamentum.Infrastructure/Repositories/MageRepository.cs deleted file mode 100644 index d23878a..0000000 --- a/Liber_Incantamentum.Infrastructure/Repositories/MageRepository.cs +++ /dev/null @@ -1,81 +0,0 @@ -using Liber_Incantamentum.Application.Exceptions; -using Liber_Incantamentum.Domain.Entities; -using Liber_Incantamentum.Domain.Filter; -using Liber_Incantamentum.Domain.Repositories; -using Liber_Incantamentum.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; - -namespace Liber_Incantamentum.Infrastructure.Repositories -{ - public class MageRepository : IMageRepository - { - private readonly AppDbContext _context; - public MageRepository(AppDbContext context) - { - _context = context; - } - public async Task AddMageAsync(Mage entity) - { - await _context.Mages.AddAsync(entity); - if (!_context.ChangeTracker.HasChanges()) return false; - return await _context.SaveChangesAsync() > 0; - } - - public async Task DeleteMageAsync(Guid id) - { - var mage = await GetMageByIdAsync(id); - _context.Mages.Remove(mage); - if (!_context.ChangeTracker.HasChanges()) return false; - return await _context.SaveChangesAsync() > 0; - } - - public async Task> GetAllMagesAsync(MageFilter filterEntity) - { - var query = _context.Mages.AsQueryable(); - - if (filterEntity.Id != Guid.Empty) - query = query.Where(m => m.Id == filterEntity.Id); - - if (!string.IsNullOrEmpty(filterEntity.Name)) - query = query.Where(m => EF.Functions.ILike(m.Name, filterEntity.Name)); - - if (!string.IsNullOrEmpty(filterEntity.Rank)) - query = query.Where(m => EF.Functions.ILike(m.Rank, filterEntity.Rank)); - - if (!string.IsNullOrEmpty(filterEntity.Specialisation)) - query = query.Where(m => EF.Functions.ILike(m.Specialisation, filterEntity.Specialisation)); - - var mages = await query.ToListAsync(); - return mages; - - } - - public async Task GetMageByIdAsync(Guid id) - { - var mage = await _context.Mages.FindAsync(id); - if (mage == null) - { - throw new NotFoundException($"No mage has been found with this id {id}"); - } - return mage; - } - - public async Task UpdateMageAsync(Mage newMageValues) - { - var mageToUpdate = await GetMageByIdAsync(newMageValues.Id); - - _context.Entry(mageToUpdate).CurrentValues.SetValues(newMageValues); - - foreach (var spell in newMageValues.Spells) - if (!mageToUpdate.Spells.Any(s => s.Id == spell.Id)) - mageToUpdate.Spells.Add(spell); - - foreach (var spell in mageToUpdate.Spells.ToList()) - if (!newMageValues.Spells.Any(s => s.Id == spell.Id)) - mageToUpdate.Spells.Remove(spell); - - if (!_context.ChangeTracker.HasChanges()) return false; - return await _context.SaveChangesAsync() > 0; - } - } -} diff --git a/Liber_Incantamentum.Infrastructure/Repositories/SpellRepository.cs b/Liber_Incantamentum.Infrastructure/Repositories/SpellRepository.cs deleted file mode 100644 index 022f00c..0000000 --- a/Liber_Incantamentum.Infrastructure/Repositories/SpellRepository.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Liber_Incantamentum.Domain.Entities; -using Liber_Incantamentum.Domain.Filter; -using Liber_Incantamentum.Domain.Repositories; -using Liber_Incantamentum.Infrastructure.Persistence; -using Microsoft.EntityFrameworkCore; -using Liber_Incantamentum.Application.Exceptions; - -namespace Liber_Incantamentum.Infrastructure.Repositories -{ - - public class SpellRepository : ISpellRepository - { - private readonly AppDbContext _context; - public SpellRepository(AppDbContext context) - { - _context = context; - } - public async Task AddSpellAsync(Spell entity) - { - await _context.Spells.AddAsync(entity); - return await _context.SaveChangesAsync() > 0; - } - - public async Task DeleteSpellAsync(Guid id) - { - var spell = await GetSpellByIdAsync(id); - _context.Spells.Remove(spell); - return await _context.SaveChangesAsync() > 0; - } - - public async Task> GetAllSpellsAsync(SpellFilter filterEntity) - { - var query = _context.Spells.AsQueryable(); - - if (filterEntity.Id != Guid.Empty) - query = query.Where(m => m.Id == filterEntity.Id); - - if (!string.IsNullOrEmpty(filterEntity.Name)) - query = query.Where(m => EF.Functions.ILike(m.Name, filterEntity.Name)); - - if (!string.IsNullOrEmpty(filterEntity.Description)) - query = query.Where(m => EF.Functions.ILike(m.Description, filterEntity.Description)); - - if (!string.IsNullOrEmpty(filterEntity.Type)) - query = query.Where(m => EF.Functions.ILike(m.Type, filterEntity.Type)); - - if (filterEntity.CreationDate != default) - query = query.Where(m => m.CreationDate == filterEntity.CreationDate); - if (filterEntity.MageId != Guid.Empty) - query = query.Where(m => m.MageId == filterEntity.MageId); - - var mages = await query.ToListAsync(); - return mages; - } - - public async Task GetSpellByIdAsync(Guid id) - { - var spell = await _context.Spells.FindAsync(id); - if (spell == null) throw new NotFoundException($"No spell has been found with the id : {id}"); - return spell; - } - - public async Task UpdateSpellAsync(Spell entity) - { - var spell = await GetSpellByIdAsync(entity.Id); - _context.Entry(spell).CurrentValues.SetValues(entity); - if (!_context.ChangeTracker.HasChanges()) return false; - return await _context.SaveChangesAsync() > 0; - } - - } -} diff --git a/Liber_Incantamentum.IntegrationTests/Liber_Incantamentum.IntegrationTests.csproj b/Liber_Incantamentum.IntegrationTests/Liber_Incantamentum.IntegrationTests.csproj new file mode 100644 index 0000000..125f4c9 --- /dev/null +++ b/Liber_Incantamentum.IntegrationTests/Liber_Incantamentum.IntegrationTests.csproj @@ -0,0 +1,9 @@ + + + + net9.0 + enable + enable + + + diff --git a/Liber_Incantamentum.Tests/Liber_Incantamentum.Tests.csproj b/Liber_Incantamentum.Tests/Liber_Incantamentum.Tests.csproj deleted file mode 100644 index 6d28c78..0000000 --- a/Liber_Incantamentum.Tests/Liber_Incantamentum.Tests.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - net9.0 - enable - enable - - - - - - - - - - - - diff --git a/Liber_Incantamentum.sln b/Liber_Incantamentum.sln index 480ae1a..d4a4ee4 100644 --- a/Liber_Incantamentum.sln +++ b/Liber_Incantamentum.sln @@ -3,15 +3,23 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.14.36109.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liber_Incantamentum.API", "Liber_Incantamentum\Liber_Incantamentum.API.csproj", "{BB761821-A9EC-4EBA-83A2-89F32C50041F}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Src", "Src", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liber_Incantamentum.Domain", "Liber_Incantamentum.Domain\Liber_Incantamentum.Domain.csproj", "{7DF16F8F-C307-455F-8389-5F0B90281347}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{93BEE101-D8F6-4622-95B6-E135AA9C066E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liber_Incantamentum.Application", "Liber_Incantamentum.Application\Liber_Incantamentum.Application.csproj", "{1307DD24-0090-4C5A-B56F-8A815DF46AB9}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liber_Incantamentum.API", "LiberIncantamentum.API\Liber_Incantamentum.API.csproj", "{8B578810-E61F-4C5D-89B0-DE62B85346F7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liber_Incantamentum.Infrastructure", "Liber_Incantamentum.Infrastructure\Liber_Incantamentum.Infrastructure.csproj", "{C80C19DC-06DA-45DD-ADEE-2BB0F670A014}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liber_Incantamentum.Domain", "LiberIncantamentum.Domain\Liber_Incantamentum.Domain.csproj", "{0B68D83C-1751-427D-840D-1285A3DB98D0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liber_Incantamentum.Tests", "Liber_Incantamentum.Tests\Liber_Incantamentum.Tests.csproj", "{4C656BB8-ED7B-422A-A984-75522021B031}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liber_Incantamentum.Infrastructure", "LiberIncantamentum.Infrastructure\Liber_Incantamentum.Infrastructure.csproj", "{8D09ADAE-591C-4487-924F-2339D29EE60D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liber_Incantamentum.Application", "LiberIncantamentum.Application\Liber_Incantamentum.Application.csproj", "{20EAEB50-C4FD-4A2D-92CC-8D0241556617}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liber_Incantamentum.UnitTests", "LiberIncantamentum.UnitTests\Liber_Incantamentum.UnitTests.csproj", "{B829A2A1-9366-422B-B372-5DDA33BD2690}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liber_Incantamentum.FunctionalTests", "Liber_Incantamentum.FunctionnalTests\Liber_Incantamentum.FunctionalTests.csproj", "{8F1D203C-1A76-4E76-AFC9-7B7477EB143E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Liber_Incantamentum.IntegrationTests", "Liber_Incantamentum.IntegrationTests\Liber_Incantamentum.IntegrationTests.csproj", "{F36ABF3F-5707-463C-BC33-DF8A261E4B5A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -19,30 +27,47 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {BB761821-A9EC-4EBA-83A2-89F32C50041F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BB761821-A9EC-4EBA-83A2-89F32C50041F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BB761821-A9EC-4EBA-83A2-89F32C50041F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BB761821-A9EC-4EBA-83A2-89F32C50041F}.Release|Any CPU.Build.0 = Release|Any CPU - {7DF16F8F-C307-455F-8389-5F0B90281347}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7DF16F8F-C307-455F-8389-5F0B90281347}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7DF16F8F-C307-455F-8389-5F0B90281347}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7DF16F8F-C307-455F-8389-5F0B90281347}.Release|Any CPU.Build.0 = Release|Any CPU - {1307DD24-0090-4C5A-B56F-8A815DF46AB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1307DD24-0090-4C5A-B56F-8A815DF46AB9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1307DD24-0090-4C5A-B56F-8A815DF46AB9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1307DD24-0090-4C5A-B56F-8A815DF46AB9}.Release|Any CPU.Build.0 = Release|Any CPU - {C80C19DC-06DA-45DD-ADEE-2BB0F670A014}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C80C19DC-06DA-45DD-ADEE-2BB0F670A014}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C80C19DC-06DA-45DD-ADEE-2BB0F670A014}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C80C19DC-06DA-45DD-ADEE-2BB0F670A014}.Release|Any CPU.Build.0 = Release|Any CPU - {4C656BB8-ED7B-422A-A984-75522021B031}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4C656BB8-ED7B-422A-A984-75522021B031}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4C656BB8-ED7B-422A-A984-75522021B031}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4C656BB8-ED7B-422A-A984-75522021B031}.Release|Any CPU.Build.0 = Release|Any CPU + {8B578810-E61F-4C5D-89B0-DE62B85346F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8B578810-E61F-4C5D-89B0-DE62B85346F7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8B578810-E61F-4C5D-89B0-DE62B85346F7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8B578810-E61F-4C5D-89B0-DE62B85346F7}.Release|Any CPU.Build.0 = Release|Any CPU + {0B68D83C-1751-427D-840D-1285A3DB98D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0B68D83C-1751-427D-840D-1285A3DB98D0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0B68D83C-1751-427D-840D-1285A3DB98D0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0B68D83C-1751-427D-840D-1285A3DB98D0}.Release|Any CPU.Build.0 = Release|Any CPU + {8D09ADAE-591C-4487-924F-2339D29EE60D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8D09ADAE-591C-4487-924F-2339D29EE60D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8D09ADAE-591C-4487-924F-2339D29EE60D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8D09ADAE-591C-4487-924F-2339D29EE60D}.Release|Any CPU.Build.0 = Release|Any CPU + {20EAEB50-C4FD-4A2D-92CC-8D0241556617}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20EAEB50-C4FD-4A2D-92CC-8D0241556617}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20EAEB50-C4FD-4A2D-92CC-8D0241556617}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20EAEB50-C4FD-4A2D-92CC-8D0241556617}.Release|Any CPU.Build.0 = Release|Any CPU + {B829A2A1-9366-422B-B372-5DDA33BD2690}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B829A2A1-9366-422B-B372-5DDA33BD2690}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B829A2A1-9366-422B-B372-5DDA33BD2690}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B829A2A1-9366-422B-B372-5DDA33BD2690}.Release|Any CPU.Build.0 = Release|Any CPU + {8F1D203C-1A76-4E76-AFC9-7B7477EB143E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8F1D203C-1A76-4E76-AFC9-7B7477EB143E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8F1D203C-1A76-4E76-AFC9-7B7477EB143E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8F1D203C-1A76-4E76-AFC9-7B7477EB143E}.Release|Any CPU.Build.0 = Release|Any CPU + {F36ABF3F-5707-463C-BC33-DF8A261E4B5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F36ABF3F-5707-463C-BC33-DF8A261E4B5A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F36ABF3F-5707-463C-BC33-DF8A261E4B5A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F36ABF3F-5707-463C-BC33-DF8A261E4B5A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {8B578810-E61F-4C5D-89B0-DE62B85346F7} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} + {0B68D83C-1751-427D-840D-1285A3DB98D0} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} + {8D09ADAE-591C-4487-924F-2339D29EE60D} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} + {20EAEB50-C4FD-4A2D-92CC-8D0241556617} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} + {B829A2A1-9366-422B-B372-5DDA33BD2690} = {93BEE101-D8F6-4622-95B6-E135AA9C066E} + {8F1D203C-1A76-4E76-AFC9-7B7477EB143E} = {93BEE101-D8F6-4622-95B6-E135AA9C066E} + {F36ABF3F-5707-463C-BC33-DF8A261E4B5A} = {93BEE101-D8F6-4622-95B6-E135AA9C066E} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B7CB31CD-9866-48CB-8A83-9F2EB1E9E53B} EndGlobalSection diff --git a/Liber_Incantamentum/Controller/Example.cs b/Liber_Incantamentum/Controller/Example.cs deleted file mode 100644 index a710f5e..0000000 --- a/Liber_Incantamentum/Controller/Example.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Microsoft.AspNetCore.Mvc; - -// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 - -namespace Liber_Incantamentum.API.Controller -{ - [Route("api/[controller]")] - [ApiController] - public class Example : ControllerBase - { - // GET: api/ - [HttpGet] - public IEnumerable Get() - { - return new string[] { "value1", "value2" }; - } - - // GET api//5 - [HttpGet("{id}")] - public string Get(int id) - { - return "value"; - } - - // POST api/ - [HttpPost] - public void Post([FromBody] string value) - { - } - - // PUT api//5 - [HttpPut("{id}")] - public void Put(int id, [FromBody] string value) - { - } - - // DELETE api//5 - [HttpDelete("{id}")] - public void Delete(int id) - { - } - } -} diff --git a/Liber_Incantamentum/Controller/MageController.cs b/Liber_Incantamentum/Controller/MageController.cs deleted file mode 100644 index e43c1a7..0000000 --- a/Liber_Incantamentum/Controller/MageController.cs +++ /dev/null @@ -1,61 +0,0 @@ -using Liber_Incantamentum.Application.DTOs.Mage; -using Liber_Incantamentum.Application.Services.Generals; -using Microsoft.AspNetCore.Http.HttpResults; -using Microsoft.AspNetCore.Mvc; -using System.Threading.Tasks; - -namespace Liber_Incantamentum.API.Controller -{ - public class MageController : ControllerBase - { - private readonly MageService _mageService; - public MageController(MageService mageService) - { - _mageService = mageService; - } - - [HttpGet("/mages")] - public async Task>> GetAllMages([FromQuery] MageDtoFilter filter) - { - var mages = await _mageService.GetAllMagesAsync(filter); - if (mages == null || mages.Any()) return Ok(mages); - return NotFound(); - } - - [HttpGet("/mages/{id}")] - public async Task> GetMage([FromRoute] Guid id) - { - var mage = await _mageService.GetMageByIdAsync(id); - if (mage != null) return Ok(mage); - return NotFound(); - } - - [HttpPost("/mages")] - public async Task CreateMage([FromBody] MageDtoCreate mage) - { - if (await _mageService.AddMageAsync(mage)) return NoContent(); - return BadRequest(); - } - - [HttpPut("/mages/{id}")] - public async Task UpdateMage([FromBody] MageDtoUpdate mage, [FromRoute] Guid id) - { - if (await _mageService.UpdateMageAsync(mage, id)) return NoContent(); - return BadRequest(); - } - - [HttpPatch("/mages/{id}")] - public async Task PatchMage([FromBody] MageDtoUpdate mage, [FromRoute] Guid id) - { - if (await _mageService.UpdateMageAsync(mage, id)) return NoContent(); - return BadRequest(); - } - - [HttpDelete("/mages/{id}")] - public async Task DeleteMage([FromRoute] Guid id) - { - if (await _mageService.DeleteMageAsync(id)) return NoContent(); - return BadRequest(); - } - } -} diff --git a/Liber_Incantamentum/Controller/SpellController.cs b/Liber_Incantamentum/Controller/SpellController.cs deleted file mode 100644 index 86a9ad4..0000000 --- a/Liber_Incantamentum/Controller/SpellController.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Liber_Incantamentum.API.Controller -{ - public class SpellController - { - - } -} diff --git a/Liber_Incantamentum/Liber_Incantamentum.API.csproj b/Liber_Incantamentum/Liber_Incantamentum.API.csproj deleted file mode 100644 index 646c96b..0000000 --- a/Liber_Incantamentum/Liber_Incantamentum.API.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - net9.0 - enable - enable - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Liber_Incantamentum/Liber_Incantamentum.http b/Liber_Incantamentum/Liber_Incantamentum.http deleted file mode 100644 index 0d48534..0000000 --- a/Liber_Incantamentum/Liber_Incantamentum.http +++ /dev/null @@ -1,6 +0,0 @@ -@Liber_Incantamentum_HostAddress = http://localhost:5225 - -GET {{Liber_Incantamentum_HostAddress}}/weatherforecast/ -Accept: application/json - -###