diff --git a/.dockerignore b/.dockerignore index 3dbbcf3..3729ff0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,10 +11,10 @@ **/*.*proj.user **/*.dbmdl **/*.jfm +**/azds.yaml **/bin **/charts **/docker-compose* -**/compose* **/Dockerfile* **/node_modules **/npm-debug.log @@ -22,4 +22,4 @@ **/secrets.dev.yaml **/values.dev.yaml LICENSE -README.md +README.md \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index caa9c93..539518a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,5 @@ - Jean Gatto (@jeangatto) jean_gatto@hotmail.com @@ -18,21 +17,4 @@ true $(NoWarn);1591 - - - - all - runtime; build; native; contentfiles; analyzers - - - - all - runtime; build; native; contentfiles; analyzers - - - all - runtime; build; native; contentfiles; analyzers - - - \ No newline at end of file diff --git a/Directory.Packages.props b/Directory.Packages.props index f0df6ce..e5ca628 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,11 +1,9 @@ - true false - @@ -54,6 +52,7 @@ + @@ -71,5 +70,4 @@ - \ No newline at end of file diff --git a/Shop.sln b/Shop.sln index b039f6f..eb82350 100644 --- a/Shop.sln +++ b/Shop.sln @@ -59,6 +59,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastru EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{9371D508-9FCA-4AED-ABCF-AF9457E743AC}" EndProject +Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{24EF58F6-CBF8-4910-A17C-E8DE7ED96A87}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -97,6 +99,10 @@ Global {7BA06288-8446-4099-9341-D213A835763C}.Debug|Any CPU.Build.0 = Debug|Any CPU {7BA06288-8446-4099-9341-D213A835763C}.Release|Any CPU.ActiveCfg = Release|Any CPU {7BA06288-8446-4099-9341-D213A835763C}.Release|Any CPU.Build.0 = Release|Any CPU + {24EF58F6-CBF8-4910-A17C-E8DE7ED96A87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {24EF58F6-CBF8-4910-A17C-E8DE7ED96A87}.Debug|Any CPU.Build.0 = Debug|Any CPU + {24EF58F6-CBF8-4910-A17C-E8DE7ED96A87}.Release|Any CPU.ActiveCfg = Release|Any CPU + {24EF58F6-CBF8-4910-A17C-E8DE7ED96A87}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/docker-compose.dcproj b/docker-compose.dcproj new file mode 100644 index 0000000..888968e --- /dev/null +++ b/docker-compose.dcproj @@ -0,0 +1,18 @@ + + + + 2.1 + Linux + 24ef58f6-cbf8-4910-a17c-e8de7ed96a87 + LaunchBrowser + {Scheme}://localhost:{ServicePort}/swagger + shop-webapi + + + + docker-compose.yml + + + + + \ No newline at end of file diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 3ae51b6..463584a 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -5,6 +5,9 @@ services: shop-webapi: environment: - ASPNETCORE_ENVIRONMENT=Docker + - ASPNETCORE_URLS=http://+:80 + ports: + - "80" volumes: - ~/.aspnet/https:/root/.aspnet/https:ro - - ~/.microsoft/usersecrets:/root/.microsoft/usersecrets:ro + - ~/.microsoft/usersecrets:/root/.microsoft/usersecrets:ro \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 384aa64..587151c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,9 +15,7 @@ services: context: . dockerfile: src/Shop.PublicApi/Dockerfile expose: - - 5072 - ports: - - "5072:5072" + - 80 links: - sqlserver - mongoserver diff --git a/launchSettings.json b/launchSettings.json new file mode 100644 index 0000000..d8e83ff --- /dev/null +++ b/launchSettings.json @@ -0,0 +1,12 @@ +{ + "profiles": { + "Docker Compose": { + "nativeDebugging": true, + "commandName": "DockerCompose", + "commandVersion": "1.0", + "serviceActions": { + "shop-webapi": "StartDebugging" + } + } + } +} \ No newline at end of file diff --git a/src/Shop.Application/Behaviors/LoggingBehavior.cs b/src/Shop.Application/Behaviors/LoggingBehavior.cs index f612659..a26a4eb 100644 --- a/src/Shop.Application/Behaviors/LoggingBehavior.cs +++ b/src/Shop.Application/Behaviors/LoggingBehavior.cs @@ -35,4 +35,4 @@ public class LoggingBehavior : IPipelineBehavior> [Required] [DataType(DataType.Date)] public DateTime DateOfBirth { get; set; } -} \ No newline at end of file +} diff --git a/src/Shop.Application/Customer/Commands/CreateCustomerCommandValidator.cs b/src/Shop.Application/Customer/Commands/CreateCustomerCommandValidator.cs index 826be68..d0acc46 100644 --- a/src/Shop.Application/Customer/Commands/CreateCustomerCommandValidator.cs +++ b/src/Shop.Application/Customer/Commands/CreateCustomerCommandValidator.cs @@ -19,4 +19,4 @@ public class CreateCustomerCommandValidator : AbstractValidator public DeleteCustomerCommand(Guid id) => Id = id; public Guid Id { get; } -} \ No newline at end of file +} diff --git a/src/Shop.Application/Customer/Commands/DeleteCustomerCommandValidator.cs b/src/Shop.Application/Customer/Commands/DeleteCustomerCommandValidator.cs index fe5b560..8099360 100644 --- a/src/Shop.Application/Customer/Commands/DeleteCustomerCommandValidator.cs +++ b/src/Shop.Application/Customer/Commands/DeleteCustomerCommandValidator.cs @@ -9,4 +9,4 @@ public class DeleteCustomerCommandValidator : AbstractValidator command.Id) .NotEmpty(); } -} \ No newline at end of file +} diff --git a/src/Shop.Application/Customer/Commands/UpdateCustomerCommand.cs b/src/Shop.Application/Customer/Commands/UpdateCustomerCommand.cs index 416e632..9789f3d 100644 --- a/src/Shop.Application/Customer/Commands/UpdateCustomerCommand.cs +++ b/src/Shop.Application/Customer/Commands/UpdateCustomerCommand.cs @@ -14,4 +14,4 @@ public class UpdateCustomerCommand : IRequest [MaxLength(200)] [DataType(DataType.EmailAddress)] public string Email { get; set; } -} \ No newline at end of file +} diff --git a/src/Shop.Application/Customer/Commands/UpdateCustomerCommandValidator.cs b/src/Shop.Application/Customer/Commands/UpdateCustomerCommandValidator.cs index 9371678..060cb59 100644 --- a/src/Shop.Application/Customer/Commands/UpdateCustomerCommandValidator.cs +++ b/src/Shop.Application/Customer/Commands/UpdateCustomerCommandValidator.cs @@ -14,4 +14,4 @@ public class UpdateCustomerCommandValidator : AbstractValidator.Success( new CreatedCustomerResponse(customer.Id), "Successfully registered!"); } -} \ No newline at end of file +} diff --git a/src/Shop.Application/Customer/Handlers/DeleteCustomerCommandHandler.cs b/src/Shop.Application/Customer/Handlers/DeleteCustomerCommandHandler.cs index 91f563b..4f962d5 100644 --- a/src/Shop.Application/Customer/Handlers/DeleteCustomerCommandHandler.cs +++ b/src/Shop.Application/Customer/Handlers/DeleteCustomerCommandHandler.cs @@ -53,4 +53,4 @@ public class DeleteCustomerCommandHandler : IRequestHandler Id = id; public Guid Id { get; } -} \ No newline at end of file +} diff --git a/src/Shop.Application/Shop.Application.csproj b/src/Shop.Application/Shop.Application.csproj index df74afa..4c34bdd 100644 --- a/src/Shop.Application/Shop.Application.csproj +++ b/src/Shop.Application/Shop.Application.csproj @@ -1,9 +1,9 @@ - - + + net7.0 - + @@ -12,10 +12,10 @@ - + - + \ No newline at end of file diff --git a/src/Shop.Core/AppSettings/CacheOptions.cs b/src/Shop.Core/AppSettings/CacheOptions.cs index 2365493..5b38e41 100644 --- a/src/Shop.Core/AppSettings/CacheOptions.cs +++ b/src/Shop.Core/AppSettings/CacheOptions.cs @@ -8,4 +8,4 @@ public sealed class CacheOptions : IAppOptions public int AbsoluteExpirationInHours { get; private init; } public int SlidingExpirationInSeconds { get; private init; } -} \ No newline at end of file +} diff --git a/src/Shop.Core/AppSettings/ConnectionOptions.cs b/src/Shop.Core/AppSettings/ConnectionOptions.cs index 75580c4..7136098 100644 --- a/src/Shop.Core/AppSettings/ConnectionOptions.cs +++ b/src/Shop.Core/AppSettings/ConnectionOptions.cs @@ -19,4 +19,4 @@ public sealed class ConnectionOptions : IAppOptions public bool CacheConnectionInMemory() => CacheConnection.Equals("InMemory", StringComparison.InvariantCultureIgnoreCase); -} \ No newline at end of file +} diff --git a/src/Shop.Core/Extensions/AssemblyExtensions.cs b/src/Shop.Core/Extensions/AssemblyExtensions.cs index 7a0920f..b2666c7 100644 --- a/src/Shop.Core/Extensions/AssemblyExtensions.cs +++ b/src/Shop.Core/Extensions/AssemblyExtensions.cs @@ -21,4 +21,4 @@ public static class AssemblyExtensions .Where(type => type.IsClass && !type.IsAbstract && !type.IsInterface && isAssignableToTInterface(type)) .ToList(); } -} \ No newline at end of file +} diff --git a/src/Shop.Core/Extensions/ConfigurationExtensions.cs b/src/Shop.Core/Extensions/ConfigurationExtensions.cs index 815d184..40b441b 100644 --- a/src/Shop.Core/Extensions/ConfigurationExtensions.cs +++ b/src/Shop.Core/Extensions/ConfigurationExtensions.cs @@ -18,4 +18,4 @@ public static class ConfigurationExtensions .GetRequiredSection(TOptions.ConfigSectionPath) .Get(options => options.BindNonPublicProperties = true); } -} \ No newline at end of file +} diff --git a/src/Shop.Core/Extensions/GenericTypeExtensions.cs b/src/Shop.Core/Extensions/GenericTypeExtensions.cs index 4cc297a..4574673 100644 --- a/src/Shop.Core/Extensions/GenericTypeExtensions.cs +++ b/src/Shop.Core/Extensions/GenericTypeExtensions.cs @@ -23,4 +23,4 @@ public static class GenericTypeExtensions // Remove the backtick and append the generic arguments to the type name return $"{type.Name.Remove(type.Name.IndexOf('`'))}<{genericTypes}>"; } -} \ No newline at end of file +} diff --git a/src/Shop.Core/Extensions/JsonExtensions.cs b/src/Shop.Core/Extensions/JsonExtensions.cs index a68f8e6..d264466 100644 --- a/src/Shop.Core/Extensions/JsonExtensions.cs +++ b/src/Shop.Core/Extensions/JsonExtensions.cs @@ -68,4 +68,4 @@ internal sealed class PrivateConstructorContractResolver : DefaultJsonTypeInfoRe return jsonTypeInfo; } -} \ No newline at end of file +} diff --git a/src/Shop.Core/Extensions/ServiceProviderExtensions.cs b/src/Shop.Core/Extensions/ServiceProviderExtensions.cs index d88bfcd..cb5ce58 100644 --- a/src/Shop.Core/Extensions/ServiceProviderExtensions.cs +++ b/src/Shop.Core/Extensions/ServiceProviderExtensions.cs @@ -18,4 +18,4 @@ public static class ServiceProviderExtensions { return serviceProvider.GetRequiredService>().Value; } -} \ No newline at end of file +} diff --git a/src/Shop.Core/RegexPatterns.cs b/src/Shop.Core/RegexPatterns.cs index 39a34f2..9e7f4be 100644 --- a/src/Shop.Core/RegexPatterns.cs +++ b/src/Shop.Core/RegexPatterns.cs @@ -13,4 +13,4 @@ public static partial class RegexPatterns @"^([0-9a-zA-Z]([+\-_.][0-9a-zA-Z]+)*)+@(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]*\.)+[a-zA-Z0-9]{2,17})$", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.CultureInvariant)] private static partial Regex EmailRegexPatternAttr(); -} \ No newline at end of file +} diff --git a/src/Shop.Core/SharedKernel/BaseEvent.cs b/src/Shop.Core/SharedKernel/BaseEvent.cs index 51bd789..55f39c4 100644 --- a/src/Shop.Core/SharedKernel/BaseEvent.cs +++ b/src/Shop.Core/SharedKernel/BaseEvent.cs @@ -22,4 +22,4 @@ public abstract class BaseEvent : INotification /// Gets the date and time when the event occurred. /// public DateTime OccurredOn { get; private init; } = DateTime.Now; -} \ No newline at end of file +} diff --git a/src/Shop.Core/SharedKernel/Correlation/CorrelationIdGenerator.cs b/src/Shop.Core/SharedKernel/Correlation/CorrelationIdGenerator.cs index 41a728d..a378020 100644 --- a/src/Shop.Core/SharedKernel/Correlation/CorrelationIdGenerator.cs +++ b/src/Shop.Core/SharedKernel/Correlation/CorrelationIdGenerator.cs @@ -9,4 +9,4 @@ public class CorrelationIdGenerator : ICorrelationIdGenerator public string Get() => _correlationId; public void Set(string correlationId) => _correlationId = correlationId; -} \ No newline at end of file +} diff --git a/src/Shop.Core/SharedKernel/Correlation/ICorrelationIdGenerator.cs b/src/Shop.Core/SharedKernel/Correlation/ICorrelationIdGenerator.cs index d759f1f..a0fab90 100644 --- a/src/Shop.Core/SharedKernel/Correlation/ICorrelationIdGenerator.cs +++ b/src/Shop.Core/SharedKernel/Correlation/ICorrelationIdGenerator.cs @@ -16,4 +16,4 @@ public interface ICorrelationIdGenerator /// /// The correlation ID to set. void Set(string correlationId); -} \ No newline at end of file +} diff --git a/src/Shop.Core/SharedKernel/EventStore.cs b/src/Shop.Core/SharedKernel/EventStore.cs index f017533..863d934 100644 --- a/src/Shop.Core/SharedKernel/EventStore.cs +++ b/src/Shop.Core/SharedKernel/EventStore.cs @@ -36,4 +36,4 @@ public class EventStore : BaseEvent /// Gets or sets the data. /// public string Data { get; private init; } -} \ No newline at end of file +} diff --git a/src/Shop.Core/SharedKernel/IAggregateRoot.cs b/src/Shop.Core/SharedKernel/IAggregateRoot.cs index cb19f41..0f27630 100644 --- a/src/Shop.Core/SharedKernel/IAggregateRoot.cs +++ b/src/Shop.Core/SharedKernel/IAggregateRoot.cs @@ -5,4 +5,4 @@ namespace Shop.Core.SharedKernel; /// public interface IAggregateRoot { -} \ No newline at end of file +} diff --git a/src/Shop.Core/SharedKernel/IAppOptions.cs b/src/Shop.Core/SharedKernel/IAppOptions.cs index b8b2687..5ab3f83 100644 --- a/src/Shop.Core/SharedKernel/IAppOptions.cs +++ b/src/Shop.Core/SharedKernel/IAppOptions.cs @@ -9,4 +9,4 @@ public interface IAppOptions /// The configuration section path. /// static abstract string ConfigSectionPath { get; } -} \ No newline at end of file +} diff --git a/src/Shop.Core/SharedKernel/ICacheService.cs b/src/Shop.Core/SharedKernel/ICacheService.cs index 1e12b2b..e30fba9 100644 --- a/src/Shop.Core/SharedKernel/ICacheService.cs +++ b/src/Shop.Core/SharedKernel/ICacheService.cs @@ -30,4 +30,4 @@ public interface ICacheService /// The keys of the items to remove from the cache. /// A task representing the asynchronous removal operation. Task RemoveAsync(params string[] cacheKeys); -} \ No newline at end of file +} diff --git a/src/Shop.Core/SharedKernel/IEntity.cs b/src/Shop.Core/SharedKernel/IEntity.cs index 67019b0..b83c88c 100644 --- a/src/Shop.Core/SharedKernel/IEntity.cs +++ b/src/Shop.Core/SharedKernel/IEntity.cs @@ -19,4 +19,4 @@ public interface IEntity : IEntity where TKey : IEquatable /// Gets the ID of the entity. /// TKey Id { get; } -} \ No newline at end of file +} diff --git a/src/Shop.Core/SharedKernel/IEventStoreRepository.cs b/src/Shop.Core/SharedKernel/IEventStoreRepository.cs index 5d63d79..8b4fe19 100644 --- a/src/Shop.Core/SharedKernel/IEventStoreRepository.cs +++ b/src/Shop.Core/SharedKernel/IEventStoreRepository.cs @@ -15,4 +15,4 @@ public interface IEventStoreRepository : IDisposable /// The event stores to store. /// A task representing the asynchronous operation. Task StoreAsync(IEnumerable eventStores); -} \ No newline at end of file +} diff --git a/src/Shop.Core/SharedKernel/IResponse.cs b/src/Shop.Core/SharedKernel/IResponse.cs index 006b715..383e657 100644 --- a/src/Shop.Core/SharedKernel/IResponse.cs +++ b/src/Shop.Core/SharedKernel/IResponse.cs @@ -2,4 +2,4 @@ namespace Shop.Core.SharedKernel; public interface IResponse { -} \ No newline at end of file +} diff --git a/src/Shop.Core/SharedKernel/IUnitOfWork.cs b/src/Shop.Core/SharedKernel/IUnitOfWork.cs index 4d835f4..44a1f03 100644 --- a/src/Shop.Core/SharedKernel/IUnitOfWork.cs +++ b/src/Shop.Core/SharedKernel/IUnitOfWork.cs @@ -13,4 +13,4 @@ public interface IUnitOfWork : IDisposable /// /// A task representing the asynchronous operation. Task SaveChangesAsync(); -} \ No newline at end of file +} diff --git a/src/Shop.Core/SharedKernel/IWriteOnlyRepository.cs b/src/Shop.Core/SharedKernel/IWriteOnlyRepository.cs index f9cd291..65c254a 100644 --- a/src/Shop.Core/SharedKernel/IWriteOnlyRepository.cs +++ b/src/Shop.Core/SharedKernel/IWriteOnlyRepository.cs @@ -36,4 +36,4 @@ public interface IWriteOnlyRepository : IDisposable /// The ID of the entity to retrieve. /// The retrieved entity. Task GetByIdAsync(TKey id); -} \ No newline at end of file +} diff --git a/src/Shop.Core/Shop.Core.csproj b/src/Shop.Core/Shop.Core.csproj index a6a918f..1ccf23f 100644 --- a/src/Shop.Core/Shop.Core.csproj +++ b/src/Shop.Core/Shop.Core.csproj @@ -1,9 +1,9 @@ - - + + net7.0 - + @@ -22,5 +22,5 @@ - + \ No newline at end of file diff --git a/src/Shop.Domain/Entities/CustomerAggregate/Customer.cs b/src/Shop.Domain/Entities/CustomerAggregate/Customer.cs index 7a55a74..6c3cb29 100644 --- a/src/Shop.Domain/Entities/CustomerAggregate/Customer.cs +++ b/src/Shop.Domain/Entities/CustomerAggregate/Customer.cs @@ -85,4 +85,4 @@ public class Customer : BaseEntity, IAggregateRoot _isDeleted = true; AddDomainEvent(new CustomerDeletedEvent(Id, FirstName, LastName, Gender, Email.Address, DateOfBirth)); } -} \ No newline at end of file +} diff --git a/src/Shop.Domain/Entities/CustomerAggregate/EGender.cs b/src/Shop.Domain/Entities/CustomerAggregate/EGender.cs index a368120..27497c6 100644 --- a/src/Shop.Domain/Entities/CustomerAggregate/EGender.cs +++ b/src/Shop.Domain/Entities/CustomerAggregate/EGender.cs @@ -12,4 +12,4 @@ public enum EGender [Description("Feminino")] Female = 2 -} \ No newline at end of file +} diff --git a/src/Shop.Domain/Entities/CustomerAggregate/Events/CustomerBaseEvent.cs b/src/Shop.Domain/Entities/CustomerAggregate/Events/CustomerBaseEvent.cs index 9a026f7..eb06e58 100644 --- a/src/Shop.Domain/Entities/CustomerAggregate/Events/CustomerBaseEvent.cs +++ b/src/Shop.Domain/Entities/CustomerAggregate/Events/CustomerBaseEvent.cs @@ -28,4 +28,4 @@ public abstract class CustomerBaseEvent : BaseEvent public EGender Gender { get; private init; } public string Email { get; private init; } public DateTime DateOfBirth { get; private init; } -} \ No newline at end of file +} diff --git a/src/Shop.Domain/Entities/CustomerAggregate/Events/CustomerCreatedEvent.cs b/src/Shop.Domain/Entities/CustomerAggregate/Events/CustomerCreatedEvent.cs index 993461b..f97d91b 100644 --- a/src/Shop.Domain/Entities/CustomerAggregate/Events/CustomerCreatedEvent.cs +++ b/src/Shop.Domain/Entities/CustomerAggregate/Events/CustomerCreatedEvent.cs @@ -13,4 +13,4 @@ public class CustomerCreatedEvent : CustomerBaseEvent DateTime dateOfBirth) : base(id, firstName, lastName, gender, email, dateOfBirth) { } -} \ No newline at end of file +} diff --git a/src/Shop.Domain/Entities/CustomerAggregate/Events/CustomerDeletedEvent.cs b/src/Shop.Domain/Entities/CustomerAggregate/Events/CustomerDeletedEvent.cs index 388e637..e4d6697 100644 --- a/src/Shop.Domain/Entities/CustomerAggregate/Events/CustomerDeletedEvent.cs +++ b/src/Shop.Domain/Entities/CustomerAggregate/Events/CustomerDeletedEvent.cs @@ -13,4 +13,4 @@ public class CustomerDeletedEvent : CustomerBaseEvent DateTime dateOfBirth) : base(id, firstName, lastName, gender, email, dateOfBirth) { } -} \ No newline at end of file +} diff --git a/src/Shop.Domain/Entities/CustomerAggregate/Events/CustomerUpdatedEvent.cs b/src/Shop.Domain/Entities/CustomerAggregate/Events/CustomerUpdatedEvent.cs index 93c100b..bae5134 100644 --- a/src/Shop.Domain/Entities/CustomerAggregate/Events/CustomerUpdatedEvent.cs +++ b/src/Shop.Domain/Entities/CustomerAggregate/Events/CustomerUpdatedEvent.cs @@ -13,4 +13,4 @@ public class CustomerUpdatedEvent : CustomerBaseEvent DateTime dateOfBirth) : base(id, firstName, lastName, gender, email, dateOfBirth) { } -} \ No newline at end of file +} diff --git a/src/Shop.Domain/Entities/CustomerAggregate/ICustomerWriteOnlyRepository.cs b/src/Shop.Domain/Entities/CustomerAggregate/ICustomerWriteOnlyRepository.cs index d78c90d..c71bd90 100644 --- a/src/Shop.Domain/Entities/CustomerAggregate/ICustomerWriteOnlyRepository.cs +++ b/src/Shop.Domain/Entities/CustomerAggregate/ICustomerWriteOnlyRepository.cs @@ -21,4 +21,4 @@ public interface ICustomerWriteOnlyRepository : IWriteOnlyRepositoryThe current ID of the customer to exclude from the check. /// True if a customer with the email and current ID exists, false otherwise. Task ExistsByEmailAsync(Email email, Guid currentId); -} \ No newline at end of file +} diff --git a/src/Shop.Domain/Factories/CustomerFactory.cs b/src/Shop.Domain/Factories/CustomerFactory.cs index b9e9f92..dded096 100644 --- a/src/Shop.Domain/Factories/CustomerFactory.cs +++ b/src/Shop.Domain/Factories/CustomerFactory.cs @@ -23,4 +23,4 @@ public static class CustomerFactory public static Customer Create(string firstName, string lastName, EGender gender, Email email, DateTime dateOfBirth) => new(firstName, lastName, gender, email, dateOfBirth); -} \ No newline at end of file +} diff --git a/src/Shop.Domain/Shop.Domain.csproj b/src/Shop.Domain/Shop.Domain.csproj index 2f3db6a..f587fc1 100644 --- a/src/Shop.Domain/Shop.Domain.csproj +++ b/src/Shop.Domain/Shop.Domain.csproj @@ -1,15 +1,15 @@ - - + + net7.0 - + - + - + \ No newline at end of file diff --git a/src/Shop.Infrastructure/Data/Extensions/EntityTypeBuilderExtensions.cs b/src/Shop.Infrastructure/Data/Extensions/EntityTypeBuilderExtensions.cs index d2496e5..552961e 100644 --- a/src/Shop.Infrastructure/Data/Extensions/EntityTypeBuilderExtensions.cs +++ b/src/Shop.Infrastructure/Data/Extensions/EntityTypeBuilderExtensions.cs @@ -27,4 +27,4 @@ internal static class EntityTypeBuilderExtensions builder .Ignore(entity => entity.DomainEvents); } -} \ No newline at end of file +} diff --git a/src/Shop.Infrastructure/Data/Extensions/ModelBuilderExtensions.cs b/src/Shop.Infrastructure/Data/Extensions/ModelBuilderExtensions.cs index 4b07f4e..b4e2f33 100644 --- a/src/Shop.Infrastructure/Data/Extensions/ModelBuilderExtensions.cs +++ b/src/Shop.Infrastructure/Data/Extensions/ModelBuilderExtensions.cs @@ -22,4 +22,4 @@ internal static class ModelBuilderExtensions foreach (var fk in foreignKeys) fk.DeleteBehavior = DeleteBehavior.Restrict; } -} \ No newline at end of file +} diff --git a/src/Shop.Infrastructure/Data/Repositories/Common/BaseWriteOnlyRepository.cs b/src/Shop.Infrastructure/Data/Repositories/Common/BaseWriteOnlyRepository.cs index 8a86c37..f94f4aa 100644 --- a/src/Shop.Infrastructure/Data/Repositories/Common/BaseWriteOnlyRepository.cs +++ b/src/Shop.Infrastructure/Data/Repositories/Common/BaseWriteOnlyRepository.cs @@ -64,4 +64,4 @@ internal abstract class BaseWriteOnlyRepository : IWriteOnlyRepos } #endregion -} \ No newline at end of file +} diff --git a/src/Shop.Infrastructure/Data/Repositories/CustomerWriteOnlyRepository.cs b/src/Shop.Infrastructure/Data/Repositories/CustomerWriteOnlyRepository.cs index 240fa46..90ff99b 100644 --- a/src/Shop.Infrastructure/Data/Repositories/CustomerWriteOnlyRepository.cs +++ b/src/Shop.Infrastructure/Data/Repositories/CustomerWriteOnlyRepository.cs @@ -23,4 +23,4 @@ internal class CustomerWriteOnlyRepository : BaseWriteOnlyRepository customer.Email.Address == email.Address && customer.Id != currentId); -} \ No newline at end of file +} diff --git a/src/Shop.Infrastructure/Data/Repositories/EventStoreRepository.cs b/src/Shop.Infrastructure/Data/Repositories/EventStoreRepository.cs index 3e748ee..4b9063f 100644 --- a/src/Shop.Infrastructure/Data/Repositories/EventStoreRepository.cs +++ b/src/Shop.Infrastructure/Data/Repositories/EventStoreRepository.cs @@ -48,4 +48,4 @@ internal sealed class EventStoreRepository : IEventStoreRepository } #endregion -} \ No newline at end of file +} diff --git a/src/Shop.Infrastructure/Data/Services/DistributedCacheService.cs b/src/Shop.Infrastructure/Data/Services/DistributedCacheService.cs index 0b19f48..b1bfa94 100644 --- a/src/Shop.Infrastructure/Data/Services/DistributedCacheService.cs +++ b/src/Shop.Infrastructure/Data/Services/DistributedCacheService.cs @@ -89,4 +89,4 @@ internal class DistributedCacheService : ICacheService await _distributedCache.RemoveAsync(cacheKey); } } -} \ No newline at end of file +} diff --git a/src/Shop.Infrastructure/Data/Services/MemoryCacheService.cs b/src/Shop.Infrastructure/Data/Services/MemoryCacheService.cs index 6810ff5..d2fc4fe 100644 --- a/src/Shop.Infrastructure/Data/Services/MemoryCacheService.cs +++ b/src/Shop.Infrastructure/Data/Services/MemoryCacheService.cs @@ -91,4 +91,4 @@ internal class MemoryCacheService : ICacheService return Task.CompletedTask; } -} \ No newline at end of file +} diff --git a/src/Shop.Infrastructure/Data/UnitOfWork.cs b/src/Shop.Infrastructure/Data/UnitOfWork.cs index c013e13..7cacb94 100644 --- a/src/Shop.Infrastructure/Data/UnitOfWork.cs +++ b/src/Shop.Infrastructure/Data/UnitOfWork.cs @@ -167,4 +167,4 @@ internal sealed class UnitOfWork : IUnitOfWork } #endregion -} \ No newline at end of file +} diff --git a/src/Shop.Infrastructure/Shop.Infrastructure.csproj b/src/Shop.Infrastructure/Shop.Infrastructure.csproj index 5abdece..73c6c31 100644 --- a/src/Shop.Infrastructure/Shop.Infrastructure.csproj +++ b/src/Shop.Infrastructure/Shop.Infrastructure.csproj @@ -1,9 +1,9 @@ - - + + net7.0 - + @@ -19,15 +19,15 @@ - + - + - + - + \ No newline at end of file diff --git a/src/Shop.PublicApi/Controllers/v1/CustomersController.cs b/src/Shop.PublicApi/Controllers/v1/CustomersController.cs index 6f62da4..df15bd8 100644 --- a/src/Shop.PublicApi/Controllers/v1/CustomersController.cs +++ b/src/Shop.PublicApi/Controllers/v1/CustomersController.cs @@ -127,4 +127,4 @@ public class CustomersController : ControllerBase [ProducesResponseType(typeof(ApiResponse), StatusCodes.Status500InternalServerError)] public async Task GetAll() => (await _mediator.Send(new GetAllCustomerQuery())).ToActionResult(); -} \ No newline at end of file +} diff --git a/src/Shop.PublicApi/Dockerfile b/src/Shop.PublicApi/Dockerfile index 051583e..475dd4a 100644 --- a/src/Shop.PublicApi/Dockerfile +++ b/src/Shop.PublicApi/Dockerfile @@ -1,37 +1,32 @@ -# https://hub.docker.com/_/microsoft-dotnet-sdk/ -ARG sdk_version=7.0-bookworm-slim - -FROM mcr.microsoft.com/dotnet/aspnet:$sdk_version AS base +FROM mcr.microsoft.com/dotnet/aspnet:7.0-bookworm-slim AS base WORKDIR /app -EXPOSE 5072 +EXPOSE 80 +EXPOSE 443 -ENV ASPNETCORE_URLS=http://+:5072 ENV DOTNET_NOLOGO=1 ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 -ENV DOTNET_EnableDiagnostics=0 -FROM mcr.microsoft.com/dotnet/sdk:$sdk_version AS build -ARG configuration=Release +FROM mcr.microsoft.com/dotnet/sdk:7.0-bookworm-slim AS build WORKDIR /src -COPY ["Directory.Build.props", "src/"] -COPY ["Directory.Packages.props", "src/"] +COPY ["Directory.Packages.props", "."] +COPY ["Directory.Build.props", "."] +COPY ["nuget.config", "."] COPY ["src/Shop.PublicApi/Shop.PublicApi.csproj", "src/Shop.PublicApi/"] -COPY ["src/Shop.Infrastructure/Shop.Infrastructure.csproj", "src/Shop.Infrastructure/"] +COPY ["src/Shop.Application/Shop.Application.csproj", "src/Shop.Application/"] COPY ["src/Shop.Domain/Shop.Domain.csproj", "src/Shop.Domain/"] COPY ["src/Shop.Core/Shop.Core.csproj", "src/Shop.Core/"] -COPY ["src/Shop.Application/Shop.Application.csproj", "src/Shop.Application/"] +COPY ["src/Shop.Infrastructure/Shop.Infrastructure.csproj", "src/Shop.Infrastructure/"] COPY ["src/Shop.Query/Shop.Query.csproj", "src/Shop.Query/"] RUN dotnet restore "src/Shop.PublicApi/Shop.PublicApi.csproj" COPY . . WORKDIR "/src/src/Shop.PublicApi" -RUN dotnet build "Shop.PublicApi.csproj" --configuration $configuration --no-restore --nologo --output /app/build +RUN dotnet build "Shop.PublicApi.csproj" --configuration Release --no-restore --nologo --output /app/build FROM build AS publish -ARG configuration=Release -RUN dotnet publish "Shop.PublicApi.csproj" --configuration $configuration --no-restore --nologo --self-contained true --output /app/publish +RUN dotnet publish "Shop.PublicApi.csproj" --configuration Release --no-restore --nologo --self-contained true --output /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "Shop.PublicApi.dll"] +ENTRYPOINT ["dotnet", "Shop.PublicApi.dll"] \ No newline at end of file diff --git a/src/Shop.PublicApi/Dockerfile.original b/src/Shop.PublicApi/Dockerfile.original new file mode 100644 index 0000000..051583e --- /dev/null +++ b/src/Shop.PublicApi/Dockerfile.original @@ -0,0 +1,37 @@ +# https://hub.docker.com/_/microsoft-dotnet-sdk/ +ARG sdk_version=7.0-bookworm-slim + +FROM mcr.microsoft.com/dotnet/aspnet:$sdk_version AS base +WORKDIR /app +EXPOSE 5072 + +ENV ASPNETCORE_URLS=http://+:5072 +ENV DOTNET_NOLOGO=1 +ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 +ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 +ENV DOTNET_EnableDiagnostics=0 + +FROM mcr.microsoft.com/dotnet/sdk:$sdk_version AS build +ARG configuration=Release +WORKDIR /src +COPY ["Directory.Build.props", "src/"] +COPY ["Directory.Packages.props", "src/"] +COPY ["src/Shop.PublicApi/Shop.PublicApi.csproj", "src/Shop.PublicApi/"] +COPY ["src/Shop.Infrastructure/Shop.Infrastructure.csproj", "src/Shop.Infrastructure/"] +COPY ["src/Shop.Domain/Shop.Domain.csproj", "src/Shop.Domain/"] +COPY ["src/Shop.Core/Shop.Core.csproj", "src/Shop.Core/"] +COPY ["src/Shop.Application/Shop.Application.csproj", "src/Shop.Application/"] +COPY ["src/Shop.Query/Shop.Query.csproj", "src/Shop.Query/"] +RUN dotnet restore "src/Shop.PublicApi/Shop.PublicApi.csproj" +COPY . . +WORKDIR "/src/src/Shop.PublicApi" +RUN dotnet build "Shop.PublicApi.csproj" --configuration $configuration --no-restore --nologo --output /app/build + +FROM build AS publish +ARG configuration=Release +RUN dotnet publish "Shop.PublicApi.csproj" --configuration $configuration --no-restore --nologo --self-contained true --output /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Shop.PublicApi.dll"] diff --git a/src/Shop.PublicApi/Extensions/MiddlewareExtensions.cs b/src/Shop.PublicApi/Extensions/MiddlewareExtensions.cs index 05b8127..a8c4e57 100644 --- a/src/Shop.PublicApi/Extensions/MiddlewareExtensions.cs +++ b/src/Shop.PublicApi/Extensions/MiddlewareExtensions.cs @@ -10,4 +10,4 @@ internal static class MiddlewareExtensions public static void UseErrorHandling(this IApplicationBuilder builder) => builder.UseMiddleware(); -} \ No newline at end of file +} diff --git a/src/Shop.PublicApi/Extensions/ResultExtensions.cs b/src/Shop.PublicApi/Extensions/ResultExtensions.cs index de0dddb..097833e 100644 --- a/src/Shop.PublicApi/Extensions/ResultExtensions.cs +++ b/src/Shop.PublicApi/Extensions/ResultExtensions.cs @@ -55,4 +55,4 @@ internal static class ResultExtensions return new BadRequestObjectResult(ApiResponse.BadRequest(errors)); } } -} \ No newline at end of file +} diff --git a/src/Shop.PublicApi/Extensions/ServicesCollectionExtensions.cs b/src/Shop.PublicApi/Extensions/ServicesCollectionExtensions.cs index c9dde0f..6ae18fd 100644 --- a/src/Shop.PublicApi/Extensions/ServicesCollectionExtensions.cs +++ b/src/Shop.PublicApi/Extensions/ServicesCollectionExtensions.cs @@ -29,18 +29,7 @@ internal static class ServicesCollectionExtensions { Version = "v1", Title = "Shop (e-commerce)", - Description = "ASP.NET Core C# CQRS Event Sourcing, REST API, DDD, SOLID Principles and Clean Architecture", - Contact = new OpenApiContact - { - Name = "Jean Gatto", - Email = "jean_gatto@hotmail.com", - Url = new Uri(configuration.GetValue("Urls:LinkedIn")) - }, - License = new OpenApiLicense - { - Name = "MIT License", - Url = new Uri(configuration.GetValue("Urls:Github")) - } + Description = "ASP.NET Core C# CQRS Event Sourcing, REST API, DDD, SOLID Principles and Clean Architecture" }); var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; @@ -138,4 +127,4 @@ internal static class ServicesCollectionExtensions optionsBuilder.EnableSensitiveDataLogging(); } } -} \ No newline at end of file +} diff --git a/src/Shop.PublicApi/Extensions/WebApplicationExtensions.cs b/src/Shop.PublicApi/Extensions/WebApplicationExtensions.cs index aa0a0df..41f6312 100644 --- a/src/Shop.PublicApi/Extensions/WebApplicationExtensions.cs +++ b/src/Shop.PublicApi/Extensions/WebApplicationExtensions.cs @@ -92,4 +92,4 @@ internal static class WebApplicationExtensions app.Logger.LogInformation("----- MongoDB: collections were created successfully!"); } -} \ No newline at end of file +} diff --git a/src/Shop.PublicApi/Middlewares/CorrelationIdMiddleware.cs b/src/Shop.PublicApi/Middlewares/CorrelationIdMiddleware.cs index 6013842..7ca1440 100644 --- a/src/Shop.PublicApi/Middlewares/CorrelationIdMiddleware.cs +++ b/src/Shop.PublicApi/Middlewares/CorrelationIdMiddleware.cs @@ -38,4 +38,4 @@ public class CorrelationIdMiddleware return Task.CompletedTask; }); } -} \ No newline at end of file +} diff --git a/src/Shop.PublicApi/Middlewares/ErrorHandlingMiddleware.cs b/src/Shop.PublicApi/Middlewares/ErrorHandlingMiddleware.cs index f1432e5..09d17a9 100644 --- a/src/Shop.PublicApi/Middlewares/ErrorHandlingMiddleware.cs +++ b/src/Shop.PublicApi/Middlewares/ErrorHandlingMiddleware.cs @@ -52,4 +52,4 @@ public class ErrorHandlingMiddleware } } } -} \ No newline at end of file +} diff --git a/src/Shop.PublicApi/Migrations/20230207164309_Initial.cs b/src/Shop.PublicApi/Migrations/20230207164309_Initial.cs index 81e07d2..03cf107 100644 --- a/src/Shop.PublicApi/Migrations/20230207164309_Initial.cs +++ b/src/Shop.PublicApi/Migrations/20230207164309_Initial.cs @@ -36,4 +36,4 @@ public partial class Initial : Migration migrationBuilder.DropTable( name: "Customers"); } -} \ No newline at end of file +} diff --git a/src/Shop.PublicApi/Migrations/EventStoreDb/20230226145437_EventStore.cs b/src/Shop.PublicApi/Migrations/EventStoreDb/20230226145437_EventStore.cs index 8fb765d..28e7050 100644 --- a/src/Shop.PublicApi/Migrations/EventStoreDb/20230226145437_EventStore.cs +++ b/src/Shop.PublicApi/Migrations/EventStoreDb/20230226145437_EventStore.cs @@ -28,4 +28,4 @@ public partial class EventStore : Migration migrationBuilder.DropTable( name: "EventStores"); } -} \ No newline at end of file +} diff --git a/src/Shop.PublicApi/Models/ApiResponse.cs b/src/Shop.PublicApi/Models/ApiResponse.cs index 51b1bee..6dd8caa 100644 --- a/src/Shop.PublicApi/Models/ApiResponse.cs +++ b/src/Shop.PublicApi/Models/ApiResponse.cs @@ -110,4 +110,4 @@ public sealed class ApiResponse : ApiResponse public static ApiResponse Ok(T result, string successMessage) => new() { Success = true, StatusCode = StatusCodes.Status200OK, Result = result, SuccessMessage = successMessage }; -} \ No newline at end of file +} diff --git a/src/Shop.PublicApi/Properties/launchSettings.json b/src/Shop.PublicApi/Properties/launchSettings.json index 4983e18..6355f3c 100644 --- a/src/Shop.PublicApi/Properties/launchSettings.json +++ b/src/Shop.PublicApi/Properties/launchSettings.json @@ -1,4 +1,47 @@ -{ +{ + "profiles": { + "http": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "hotReloadEnabled": true, + "applicationUrl": "http://localhost:5072" + }, + "https": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "hotReloadEnabled": true, + "applicationUrl": "https://localhost:7225;" + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "hotReloadEnabled": true + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "environmentVariables": { + "ASPNETCORE_URLS": "https://+:443;http://+:80" + }, + "publishAllPorts": true, + "useSSL": true + } + }, "$schema": "https://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, @@ -7,38 +50,5 @@ "applicationUrl": "http://localhost:6452", "sslPort": 44331 } - }, - "profiles": { - "http": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "hotReloadEnabled": true, - "launchUrl": "swagger", - "applicationUrl": "http://localhost:5072", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "https": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "hotReloadEnabled": true, - "launchUrl": "swagger", - "applicationUrl": "https://localhost:7225;", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "hotReloadEnabled": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } } -} +} \ No newline at end of file diff --git a/src/Shop.PublicApi/Shop.PublicApi.csproj b/src/Shop.PublicApi/Shop.PublicApi.csproj index 6bf90ca..187dc2f 100644 --- a/src/Shop.PublicApi/Shop.PublicApi.csproj +++ b/src/Shop.PublicApi/Shop.PublicApi.csproj @@ -1,16 +1,15 @@ - - + + net7.0 true true Linux - Linux - linux-arm64;linux-x64 - true - true + 7d8d0af0-7540-48a6-b160-d34c988a1ad6 + ..\.. + ..\..\docker-compose.dcproj - + @@ -35,21 +34,22 @@ + - + - + - + \ No newline at end of file diff --git a/src/Shop.PublicApi/appsettings.Development.json b/src/Shop.PublicApi/appsettings.Development.json index c913a1c..79982c8 100644 --- a/src/Shop.PublicApi/appsettings.Development.json +++ b/src/Shop.PublicApi/appsettings.Development.json @@ -6,17 +6,13 @@ "Microsoft.Hosting.Lifetime": "Information" } }, - "Urls": { - "LinkedIn": "https://www.linkedin.com/in/jeangatto/", - "Github": "https://github.com/jeangatto/ASP.NET-Core-Clean-Architecture-CQRS-Event-Sourcing/blob/main/LICENSE" - }, "ConnectionStrings": { "SqlConnection": "", "NoSqlConnection": "", "CacheConnection": "" }, "CacheOptions": { - "AbsoluteExpirationInHours": 0, - "SlidingExpirationInSeconds": 0 + "AbsoluteExpirationInHours": 2, + "SlidingExpirationInSeconds": 60 } } diff --git a/src/Shop.PublicApi/appsettings.Docker.json b/src/Shop.PublicApi/appsettings.Docker.json index 6961579..40a1ecd 100644 --- a/src/Shop.PublicApi/appsettings.Docker.json +++ b/src/Shop.PublicApi/appsettings.Docker.json @@ -6,10 +6,6 @@ "Microsoft.Hosting.Lifetime": "Information" } }, - "Urls": { - "LinkedIn": "https://www.linkedin.com/in/jeangatto/", - "Github": "https://github.com/jeangatto/ASP.NET-Core-Clean-Architecture-CQRS-Event-Sourcing/blob/main/LICENSE" - }, "ConnectionStrings": { "SqlConnection": "Server=sqlserver;Integrated Security=true;Initial Catalog=ShopContext;User Id=sa;Password=pMA63033n6tF;Trusted_Connection=false;MultipleActiveResultSets=true;Encrypt=True;TrustServerCertificate=True;", "NoSqlConnection": "mongodb://mongoserver", diff --git a/src/Shop.Query/Abstractions/IQueryModel.cs b/src/Shop.Query/Abstractions/IQueryModel.cs index 9f303a6..fb2e395 100644 --- a/src/Shop.Query/Abstractions/IQueryModel.cs +++ b/src/Shop.Query/Abstractions/IQueryModel.cs @@ -19,4 +19,4 @@ public interface IQueryModel : IQueryModel where TKey : IEquatable TKey Id { get; } -} \ No newline at end of file +} diff --git a/src/Shop.Query/Abstractions/IReadDbContext.cs b/src/Shop.Query/Abstractions/IReadDbContext.cs index 494ff2d..34c6f43 100644 --- a/src/Shop.Query/Abstractions/IReadDbContext.cs +++ b/src/Shop.Query/Abstractions/IReadDbContext.cs @@ -25,4 +25,4 @@ public interface IReadDbContext /// /// A task representing the asynchronous creation of collections. Task CreateCollectionsAsync(); -} \ No newline at end of file +} diff --git a/src/Shop.Query/Abstractions/IReadDbMapping.cs b/src/Shop.Query/Abstractions/IReadDbMapping.cs index be0933a..c13cfbb 100644 --- a/src/Shop.Query/Abstractions/IReadDbMapping.cs +++ b/src/Shop.Query/Abstractions/IReadDbMapping.cs @@ -9,4 +9,4 @@ public interface IReadDbMapping /// Configures the mappings for reading from the database. /// void Configure(); -} \ No newline at end of file +} diff --git a/src/Shop.Query/Abstractions/IReadOnlyRepository.cs b/src/Shop.Query/Abstractions/IReadOnlyRepository.cs index ef8fa98..a242413 100644 --- a/src/Shop.Query/Abstractions/IReadOnlyRepository.cs +++ b/src/Shop.Query/Abstractions/IReadOnlyRepository.cs @@ -18,4 +18,4 @@ public interface IReadOnlyRepository /// The ID of the query model. /// The task representing the asynchronous operation, returning the query model. Task GetByIdAsync(TKey id); -} \ No newline at end of file +} diff --git a/src/Shop.Query/Abstractions/ISynchronizeDb.cs b/src/Shop.Query/Abstractions/ISynchronizeDb.cs index 546bf75..e38e718 100644 --- a/src/Shop.Query/Abstractions/ISynchronizeDb.cs +++ b/src/Shop.Query/Abstractions/ISynchronizeDb.cs @@ -27,4 +27,4 @@ public interface ISynchronizeDb /// A task representing the asynchronous delete operation. Task DeleteAsync(Expression> deleteFilter) where TQueryModel : IQueryModel; -} \ No newline at end of file +} diff --git a/src/Shop.Query/Application/Customer/Handlers/GetAllCustomerQueryHandler.cs b/src/Shop.Query/Application/Customer/Handlers/GetAllCustomerQueryHandler.cs index 63a9254..2879207 100644 --- a/src/Shop.Query/Application/Customer/Handlers/GetAllCustomerQueryHandler.cs +++ b/src/Shop.Query/Application/Customer/Handlers/GetAllCustomerQueryHandler.cs @@ -31,4 +31,4 @@ public class GetAllCustomerQueryHandler : IRequestHandler>.Success( await _cacheService.GetOrCreateAsync(CacheKey, _readOnlyRepository.GetAllAsync)); } -} \ No newline at end of file +} diff --git a/src/Shop.Query/Application/Customer/Handlers/GetCustomerByIdQueryHandler.cs b/src/Shop.Query/Application/Customer/Handlers/GetCustomerByIdQueryHandler.cs index d1a9b2d..af3649e 100644 --- a/src/Shop.Query/Application/Customer/Handlers/GetCustomerByIdQueryHandler.cs +++ b/src/Shop.Query/Application/Customer/Handlers/GetCustomerByIdQueryHandler.cs @@ -52,4 +52,4 @@ public class GetCustomerByIdQueryHandler : IRequestHandler.NotFound($"No customer found by Id: {request.Id}") : Result.Success(customer); } -} \ No newline at end of file +} diff --git a/src/Shop.Query/Application/Customer/Queries/GetAllCustomerQuery.cs b/src/Shop.Query/Application/Customer/Queries/GetAllCustomerQuery.cs index 6a2945d..6d4b3b8 100644 --- a/src/Shop.Query/Application/Customer/Queries/GetAllCustomerQuery.cs +++ b/src/Shop.Query/Application/Customer/Queries/GetAllCustomerQuery.cs @@ -7,4 +7,4 @@ namespace Shop.Query.Application.Customer.Queries; public class GetAllCustomerQuery : IRequest>> { -} \ No newline at end of file +} diff --git a/src/Shop.Query/Application/Customer/Queries/GetCustomerByIdQuery.cs b/src/Shop.Query/Application/Customer/Queries/GetCustomerByIdQuery.cs index 7ba5436..8005a2f 100644 --- a/src/Shop.Query/Application/Customer/Queries/GetCustomerByIdQuery.cs +++ b/src/Shop.Query/Application/Customer/Queries/GetCustomerByIdQuery.cs @@ -10,4 +10,4 @@ public class GetCustomerByIdQuery : IRequest> public GetCustomerByIdQuery(Guid id) => Id = id; public Guid Id { get; } -} \ No newline at end of file +} diff --git a/src/Shop.Query/Application/Customer/Queries/GetCustomerByIdQueryValidator.cs b/src/Shop.Query/Application/Customer/Queries/GetCustomerByIdQueryValidator.cs index 962e341..bc10364 100644 --- a/src/Shop.Query/Application/Customer/Queries/GetCustomerByIdQueryValidator.cs +++ b/src/Shop.Query/Application/Customer/Queries/GetCustomerByIdQueryValidator.cs @@ -9,4 +9,4 @@ public class GetCustomerByIdQueryValidator : AbstractValidator command.Id) .NotEmpty(); } -} \ No newline at end of file +} diff --git a/src/Shop.Query/Data/Context/NoSqlDbContext.cs b/src/Shop.Query/Data/Context/NoSqlDbContext.cs index 9993a25..759a6e0 100644 --- a/src/Shop.Query/Data/Context/NoSqlDbContext.cs +++ b/src/Shop.Query/Data/Context/NoSqlDbContext.cs @@ -144,4 +144,4 @@ public sealed class NoSqlDbContext : IReadDbContext, ISynchronizeDb } #endregion -} \ No newline at end of file +} diff --git a/src/Shop.Query/Data/Mappings/CustomerMap.cs b/src/Shop.Query/Data/Mappings/CustomerMap.cs index 9c12c01..6dc0f27 100644 --- a/src/Shop.Query/Data/Mappings/CustomerMap.cs +++ b/src/Shop.Query/Data/Mappings/CustomerMap.cs @@ -38,4 +38,4 @@ public class CustomerMap : IReadDbMapping classMap.UnmapMember(customer => customer.FullName); }); } -} \ No newline at end of file +} diff --git a/src/Shop.Query/Data/Repositories/Abstractions/ICustomerReadOnlyRepository.cs b/src/Shop.Query/Data/Repositories/Abstractions/ICustomerReadOnlyRepository.cs index 9873264..ac49c0c 100644 --- a/src/Shop.Query/Data/Repositories/Abstractions/ICustomerReadOnlyRepository.cs +++ b/src/Shop.Query/Data/Repositories/Abstractions/ICustomerReadOnlyRepository.cs @@ -9,4 +9,4 @@ namespace Shop.Query.Data.Repositories.Abstractions; public interface ICustomerReadOnlyRepository : IReadOnlyRepository { Task> GetAllAsync(); -} \ No newline at end of file +} diff --git a/src/Shop.Query/Data/Repositories/BaseReadOnlyRepository.cs b/src/Shop.Query/Data/Repositories/BaseReadOnlyRepository.cs index 767c483..0a25897 100644 --- a/src/Shop.Query/Data/Repositories/BaseReadOnlyRepository.cs +++ b/src/Shop.Query/Data/Repositories/BaseReadOnlyRepository.cs @@ -30,4 +30,4 @@ internal abstract class BaseReadOnlyRepository : IReadOnlyRep /// The query model. public async Task GetByIdAsync(Tkey id) => await Collection.Find(queryModel => queryModel.Id.Equals(id)).FirstOrDefaultAsync(); -} \ No newline at end of file +} diff --git a/src/Shop.Query/Data/Repositories/CustomerReadOnlyRepository.cs b/src/Shop.Query/Data/Repositories/CustomerReadOnlyRepository.cs index 3209a00..e62e0de 100644 --- a/src/Shop.Query/Data/Repositories/CustomerReadOnlyRepository.cs +++ b/src/Shop.Query/Data/Repositories/CustomerReadOnlyRepository.cs @@ -18,4 +18,4 @@ internal class CustomerReadOnlyRepository : BaseReadOnlyRepository customer.FirstName) .ThenBy(customer => customer.DateOfBirth) .ToListAsync(); -} \ No newline at end of file +} diff --git a/src/Shop.Query/EventHandlers/CustomerEventHandler.cs b/src/Shop.Query/EventHandlers/CustomerEventHandler.cs index 4c0d68d..05033a8 100644 --- a/src/Shop.Query/EventHandlers/CustomerEventHandler.cs +++ b/src/Shop.Query/EventHandlers/CustomerEventHandler.cs @@ -68,4 +68,4 @@ public class CustomerEventHandler : private void LogEvent(TEvent @event) where TEvent : CustomerBaseEvent => _logger.LogInformation("----- Triggering the event {EventName}, model: {EventModel}", typeof(TEvent).Name, @event.ToJson()); -} \ No newline at end of file +} diff --git a/src/Shop.Query/Profiles/EventToQueryModelProfile.cs b/src/Shop.Query/Profiles/EventToQueryModelProfile.cs index 9c021ef..06c9c74 100644 --- a/src/Shop.Query/Profiles/EventToQueryModelProfile.cs +++ b/src/Shop.Query/Profiles/EventToQueryModelProfile.cs @@ -22,4 +22,4 @@ public class EventToQueryModelProfile : Profile private static CustomerQueryModel CreateCustomerQueryModel(TEvent @event) where TEvent : CustomerBaseEvent => new(@event.Id, @event.FirstName, @event.LastName, @event.Gender.ToString(), @event.Email, @event.DateOfBirth); -} \ No newline at end of file +} diff --git a/src/Shop.Query/QueriesModel/CustomerQueryModel.cs b/src/Shop.Query/QueriesModel/CustomerQueryModel.cs index cda6dda..4e0f4f8 100644 --- a/src/Shop.Query/QueriesModel/CustomerQueryModel.cs +++ b/src/Shop.Query/QueriesModel/CustomerQueryModel.cs @@ -33,4 +33,4 @@ public class CustomerQueryModel : IQueryModel public DateTime DateOfBirth { get; private init; } public string FullName => (FirstName + " " + LastName).Trim(); -} \ No newline at end of file +} diff --git a/src/Shop.Query/Shop.Query.csproj b/src/Shop.Query/Shop.Query.csproj index d895cd5..06095a1 100644 --- a/src/Shop.Query/Shop.Query.csproj +++ b/src/Shop.Query/Shop.Query.csproj @@ -1,9 +1,9 @@ - - + + net7.0 - + @@ -17,15 +17,15 @@ - + - + - + \ No newline at end of file diff --git a/tests/Shop.IntegrationTests/Controllers/V1/CustomersControllerTests.cs b/tests/Shop.IntegrationTests/Controllers/V1/CustomersControllerTests.cs index 64f06a9..5027d3a 100644 --- a/tests/Shop.IntegrationTests/Controllers/V1/CustomersControllerTests.cs +++ b/tests/Shop.IntegrationTests/Controllers/V1/CustomersControllerTests.cs @@ -474,9 +474,6 @@ public class CustomersControllerTests : IAsyncLifetime return new WebApplicationFactory() .WithWebHostBuilder(hostBuilder => { - hostBuilder.UseSetting("Urls:LinkedIn", "https://www.linkedin.com/in/jeangatto/"); - hostBuilder.UseSetting("Urls:Github", "https://github.com/jeangatto/ASP.NET-Core-Clean-Architecture-CQRS-Event-Sourcing/blob/main/LICENSE"); - hostBuilder.UseSetting("ConnectionStrings:SqlConnection", "InMemory"); hostBuilder.UseSetting("ConnectionStrings:NoSqlConnection", "InMemory"); hostBuilder.UseSetting("ConnectionStrings:CacheConnection", "InMemory"); @@ -528,4 +525,4 @@ public class CustomersControllerTests : IAsyncLifetime private static WebApplicationFactoryClientOptions CreateClientOptions() => new() { AllowAutoRedirect = false }; #endregion -} \ No newline at end of file +} diff --git a/tests/Shop.IntegrationTests/Extensions/FakerExtensions.cs b/tests/Shop.IntegrationTests/Extensions/FakerExtensions.cs index 3d6e975..f1be29d 100644 --- a/tests/Shop.IntegrationTests/Extensions/FakerExtensions.cs +++ b/tests/Shop.IntegrationTests/Extensions/FakerExtensions.cs @@ -7,4 +7,4 @@ internal static class FakerExtensions { public static Faker UsePrivateConstructor(this Faker faker) where T : class => faker.CustomInstantiator(_ => Activator.CreateInstance(typeof(T), nonPublic: true) as T); -} \ No newline at end of file +} diff --git a/tests/Shop.IntegrationTests/Shop.IntegrationTests.csproj b/tests/Shop.IntegrationTests/Shop.IntegrationTests.csproj index 9e29b03..d790ac1 100644 --- a/tests/Shop.IntegrationTests/Shop.IntegrationTests.csproj +++ b/tests/Shop.IntegrationTests/Shop.IntegrationTests.csproj @@ -1,11 +1,11 @@ - - + + net7.0 false true - + @@ -37,15 +37,15 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + - + Always - + \ No newline at end of file diff --git a/tests/Shop.UnitTests/Application/Customer/Handlers/CreateCustomerCommandHandlerTests.cs b/tests/Shop.UnitTests/Application/Customer/Handlers/CreateCustomerCommandHandlerTests.cs index 85aef1b..4bac408 100644 --- a/tests/Shop.UnitTests/Application/Customer/Handlers/CreateCustomerCommandHandlerTests.cs +++ b/tests/Shop.UnitTests/Application/Customer/Handlers/CreateCustomerCommandHandlerTests.cs @@ -118,4 +118,4 @@ public class CreateCustomerCommandHandlerTests : IClassFixture act.IsSuccess.Should().BeFalse(); act.ValidationErrors.Should().NotBeNullOrEmpty().And.OnlyHaveUniqueItems(); } -} \ No newline at end of file +} diff --git a/tests/Shop.UnitTests/Application/Customer/Handlers/DeleteCustomerCommandHandlerTests.cs b/tests/Shop.UnitTests/Application/Customer/Handlers/DeleteCustomerCommandHandlerTests.cs index 972201e..2fc8f2f 100644 --- a/tests/Shop.UnitTests/Application/Customer/Handlers/DeleteCustomerCommandHandlerTests.cs +++ b/tests/Shop.UnitTests/Application/Customer/Handlers/DeleteCustomerCommandHandlerTests.cs @@ -108,4 +108,4 @@ public class DeleteCustomerCommandHandlerTests : IClassFixture act.IsSuccess.Should().BeFalse(); act.ValidationErrors.Should().NotBeNullOrEmpty().And.OnlyHaveUniqueItems(); } -} \ No newline at end of file +} diff --git a/tests/Shop.UnitTests/Application/Customer/Handlers/UpdateCustomerCommandHandlerTest.cs b/tests/Shop.UnitTests/Application/Customer/Handlers/UpdateCustomerCommandHandlerTest.cs index d4a4677..4c22679 100644 --- a/tests/Shop.UnitTests/Application/Customer/Handlers/UpdateCustomerCommandHandlerTest.cs +++ b/tests/Shop.UnitTests/Application/Customer/Handlers/UpdateCustomerCommandHandlerTest.cs @@ -155,4 +155,4 @@ public class UpdateCustomerCommandHandlerTest : IClassFixture act.IsSuccess.Should().BeFalse(); act.ValidationErrors.Should().NotBeNullOrEmpty().And.OnlyHaveUniqueItems(); } -} \ No newline at end of file +} diff --git a/tests/Shop.UnitTests/Core/Extensions/ConfigurationExtensionsTests.cs b/tests/Shop.UnitTests/Core/Extensions/ConfigurationExtensionsTests.cs index b695574..e2f1e1d 100644 --- a/tests/Shop.UnitTests/Core/Extensions/ConfigurationExtensionsTests.cs +++ b/tests/Shop.UnitTests/Core/Extensions/ConfigurationExtensionsTests.cs @@ -35,4 +35,4 @@ public class ConfigurationExtensionsTests act.AbsoluteExpirationInHours.Should().Be(absoluteExpirationInHours); act.SlidingExpirationInSeconds.Should().Be(slidingExpirationInSeconds); } -} \ No newline at end of file +} diff --git a/tests/Shop.UnitTests/Core/Extensions/JsonExtensionsTests.cs b/tests/Shop.UnitTests/Core/Extensions/JsonExtensionsTests.cs index 90819bf..b8f5c2a 100644 --- a/tests/Shop.UnitTests/Core/Extensions/JsonExtensionsTests.cs +++ b/tests/Shop.UnitTests/Core/Extensions/JsonExtensionsTests.cs @@ -78,4 +78,4 @@ public class JsonExtensionsTests public string UserName { get; } = UserName; public EStatus Status { get; } = Status; } -} \ No newline at end of file +} diff --git a/tests/Shop.UnitTests/Core/Extensions/ServicesCollectionExtensionsTests.cs b/tests/Shop.UnitTests/Core/Extensions/ServicesCollectionExtensionsTests.cs index 556e54d..7ce0f1e 100644 --- a/tests/Shop.UnitTests/Core/Extensions/ServicesCollectionExtensionsTests.cs +++ b/tests/Shop.UnitTests/Core/Extensions/ServicesCollectionExtensionsTests.cs @@ -42,4 +42,4 @@ public class ServicesCollectionExtensionsTests act.AbsoluteExpirationInHours.Should().Be(absoluteExpirationInHours); act.SlidingExpirationInSeconds.Should().Be(slidingExpirationInSeconds); } -} \ No newline at end of file +} diff --git a/tests/Shop.UnitTests/Domain/Entities/CustomerAggregate/CustomerTests.cs b/tests/Shop.UnitTests/Domain/Entities/CustomerAggregate/CustomerTests.cs index b9f457c..2ec0908 100644 --- a/tests/Shop.UnitTests/Domain/Entities/CustomerAggregate/CustomerTests.cs +++ b/tests/Shop.UnitTests/Domain/Entities/CustomerAggregate/CustomerTests.cs @@ -83,4 +83,4 @@ public class CustomerTests .And.OnlyHaveUniqueItems() .And.ContainItemsAssignableTo(); } -} \ No newline at end of file +} diff --git a/tests/Shop.UnitTests/Domain/ValueObjects/EmailTests.cs b/tests/Shop.UnitTests/Domain/ValueObjects/EmailTests.cs index 748adc5..3b31ad7 100644 --- a/tests/Shop.UnitTests/Domain/ValueObjects/EmailTests.cs +++ b/tests/Shop.UnitTests/Domain/ValueObjects/EmailTests.cs @@ -79,4 +79,4 @@ public class EmailTests .And.HaveCount(1) .And.Satisfy(message => message == "The e-mail address must be provided."); } -} \ No newline at end of file +} diff --git a/tests/Shop.UnitTests/Fixtures/EfSqliteFixture.cs b/tests/Shop.UnitTests/Fixtures/EfSqliteFixture.cs index 7cf779f..42d97de 100644 --- a/tests/Shop.UnitTests/Fixtures/EfSqliteFixture.cs +++ b/tests/Shop.UnitTests/Fixtures/EfSqliteFixture.cs @@ -66,4 +66,4 @@ public class EfSqliteFixture : IAsyncLifetime, IDisposable } #endregion -} \ No newline at end of file +} diff --git a/tests/Shop.UnitTests/Query/Profiles/AutoMapperTests.cs b/tests/Shop.UnitTests/Query/Profiles/AutoMapperTests.cs index 4e57430..606c4e1 100644 --- a/tests/Shop.UnitTests/Query/Profiles/AutoMapperTests.cs +++ b/tests/Shop.UnitTests/Query/Profiles/AutoMapperTests.cs @@ -22,4 +22,4 @@ public class AutoMapperTests // Assert act.Should().NotThrow(); } -} \ No newline at end of file +} diff --git a/tests/Shop.UnitTests/Shop.UnitTests.csproj b/tests/Shop.UnitTests/Shop.UnitTests.csproj index 1d1d9ff..e54ffde 100644 --- a/tests/Shop.UnitTests/Shop.UnitTests.csproj +++ b/tests/Shop.UnitTests/Shop.UnitTests.csproj @@ -1,12 +1,12 @@ - - + + net7.0 false true True - + @@ -35,7 +35,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + @@ -44,11 +44,11 @@ - + Always - + \ No newline at end of file