diff --git a/.drone.yml b/.drone.yml index d5b9121..49e0b2b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -19,6 +19,8 @@ steps: commands: - dotnet pack LiteCharms.Features/LiteCharms.Features.csproj -c Release -p:PackageVersion=$VERSION -o dist/ - dotnet nuget push dist/LiteCharms.Features.$VERSION.nupkg --api-key $NEXUS_KEY --source $NEXUS_URL + - dotnet pack LiteCharms.Features.TechShop/LiteCharms.Features.TechShop.csproj -c Release -p:PackageVersion=$VERSION -o dist/ + - dotnet nuget push dist/LiteCharms.Features.TechShop.$VERSION.nupkg --api-key $NEXUS_KEY --source $NEXUS_URL - name: gitea-tag-release image: alpine/git @@ -41,7 +43,7 @@ steps: \"tag_name\": \"$VERSION\", \"target_commitish\": \"${DRONE_COMMIT_SHA}\", \"name\": \"Library Suite $VERSION\", - \"body\": \"### Published NuGet Packages\nAll packages versioned as **$VERSION**:\n* LiteCharms.Features\n\n[View in Nexus](https://nexus.khongisa.co.za/repository/nuget-group/)\", + \"body\": \"### Published NuGet Packages\nAll packages versioned as **$VERSION**:\n* LiteCharms.Features\n* LiteCharms.Features.TechShop\n\n[View in Nexus](https://nexus.khongisa.co.za/repository/nuget-group/)\", \"draft\": false, \"prerelease\": false }" diff --git a/LiteCharms.Features.TechShop.Tests/Fixture.cs b/LiteCharms.Features.TechShop.Tests/Fixture.cs new file mode 100644 index 0000000..eadca78 --- /dev/null +++ b/LiteCharms.Features.TechShop.Tests/Fixture.cs @@ -0,0 +1,38 @@ +using LiteCharms.Features.Extensions; +using LiteCharms.Features.TechShop.Extensions; + +namespace LiteCharms.Features.TechShop.Tests; + +public class Fixture : IDisposable +{ + public IConfiguration Configuration { get; set; } + + public IServiceProvider Services { get; set; } + + public IMediator Mediator { get; set; } + + public Fixture() + { + Configuration = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddUserSecrets() + .AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json"), optional: true, reloadOnChange: true) + .AddEnvironmentVariables() + .Build(); + + Services = new ServiceCollection() + .AddMediator() + .AddLogging() + .AddTechShopServices() + .AddEmailServiceBus() + .AddGarageS3(Configuration) + .AddTechShopDatabase(Configuration) + .AddEmailServices(Configuration) + .AddSingleton(Configuration) + .BuildServiceProvider(); + + Mediator = Services.GetRequiredService(); + } + + public void Dispose() { } +} diff --git a/LiteCharms.Features.TechShop.Tests/LiteCharms.Features.TechShop.Tests.csproj b/LiteCharms.Features.TechShop.Tests/LiteCharms.Features.TechShop.Tests.csproj new file mode 100644 index 0000000..5c64f32 --- /dev/null +++ b/LiteCharms.Features.TechShop.Tests/LiteCharms.Features.TechShop.Tests.csproj @@ -0,0 +1,57 @@ + + + + net10.0 + enable + enable + false + fa06c1a6-2ba8-4c47-b19b-11e0f78e7b92 + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + + + + + + + + Always + + + + + + Always + + + + \ No newline at end of file diff --git a/LiteCharms.Features.Tests/NotificationsFeatureTests.cs b/LiteCharms.Features.TechShop.Tests/NotificationsFeatureTests.cs similarity index 75% rename from LiteCharms.Features.Tests/NotificationsFeatureTests.cs rename to LiteCharms.Features.TechShop.Tests/NotificationsFeatureTests.cs index 2b500e8..6a447fa 100644 --- a/LiteCharms.Features.Tests/NotificationsFeatureTests.cs +++ b/LiteCharms.Features.TechShop.Tests/NotificationsFeatureTests.cs @@ -1,24 +1,24 @@ using LiteCharms.Features.Models; -using LiteCharms.Features.Shop.Notifications; -using LiteCharms.Features.Shop.Notifications.Events; +using LiteCharms.Features.TechShop.Notifications; +using LiteCharms.Features.TechShop.Notifications.Events; using static LiteCharms.Features.Extensions.Email; -namespace LiteCharms.Features.Tests; +namespace LiteCharms.Features.TechShop.Tests; -public class NotificationsFeatureTests(CommonFixture fixture, ITestOutputHelper output) : IClassFixture +public class NotificationsFeatureTests(Fixture fixture, ITestOutputHelper output) : IClassFixture { private readonly NotificationService notificationService = fixture.Services.GetRequiredService(); [Fact] public async Task CreateNotificationCommand_ShouldSucceed() { - Shop.Notifications.Models.CreateNotification request = new() + Notifications.Models.CreateNotification request = new() { CorrelationId = Guid.CreateVersion7().ToString(), - CorrelationIdType = Shop.CorrelationIdTypes.None, - Direction = Shop.NotificationDirection.Outgoing, - Platform = Shop.NotificationPlatforms.Email, - Priority = Shop.Priorities.Medium, + CorrelationIdType = CorrelationIdTypes.None, + Direction = NotificationDirection.Outgoing, + Platform = NotificationPlatforms.Email, + Priority = Priorities.Medium, Sender = "xUnit Test", SenderAddress = "khwezi@mngoma.africa", Recipient = $"{ShopEmailFromName} [Test]", diff --git a/LiteCharms.Features.Tests/ProductsFeatureTests.cs b/LiteCharms.Features.TechShop.Tests/ProductsFeatureTests.cs similarity index 66% rename from LiteCharms.Features.Tests/ProductsFeatureTests.cs rename to LiteCharms.Features.TechShop.Tests/ProductsFeatureTests.cs index 1aee1cf..2386847 100644 --- a/LiteCharms.Features.Tests/ProductsFeatureTests.cs +++ b/LiteCharms.Features.TechShop.Tests/ProductsFeatureTests.cs @@ -1,8 +1,8 @@ -using LiteCharms.Features.Shop.Products; +using LiteCharms.Features.TechShop.Products; -namespace LiteCharms.Features.Tests; +namespace LiteCharms.Features.TechShop.Tests; -public class ProductsFeatureTests(CommonFixture fixture, ITestOutputHelper output) : IClassFixture +public class ProductsFeatureTests(Fixture fixture, ITestOutputHelper output) : IClassFixture { [Fact] public async Task GetProductsAsync_ReturnsProducts() diff --git a/LiteCharms.Features.TechShop.Tests/appsettings.json b/LiteCharms.Features.TechShop.Tests/appsettings.json new file mode 100644 index 0000000..1066af9 --- /dev/null +++ b/LiteCharms.Features.TechShop.Tests/appsettings.json @@ -0,0 +1,34 @@ +{ + "BookshopS3Settings": { + "ServiceUrl": "http://192.168.1.177:30900", + "Region": "garage", + "BucketName": "bookshop", + "CdnBaseUrl": "https://bookshop.cdn.khongisa.co.za" + }, + "BookshopQuotesS3Settings": { + "ServiceUrl": "http://192.168.1.177:30900", + "Region": "garage", + "BucketName": "bookshop.quotes", + "CdnBaseUrl": "https://bookshop.quotes.cdn.khongisa.co.za" + }, + "Email": { + "Credentials": { + "Username": "shop@litecharms.co.za" + }, + "Port": 465, + "Host": "mail.litecharms.co.za", + "UseSsl": true + }, + "Monitoring": { + "ApiKey": "", + "Address": "http://aspire-dashboard-service.aspire.svc.cluster.local:18889", + "ServiceName": "LiteCharms.LeadGenerator" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/LiteCharms.Features/Shop/CartPackages/Entities/Package.cs b/LiteCharms.Features.TechShop/CartPackages/Entities/Package.cs similarity index 72% rename from LiteCharms.Features/Shop/CartPackages/Entities/Package.cs rename to LiteCharms.Features.TechShop/CartPackages/Entities/Package.cs index 3e4d210..147b6f0 100644 --- a/LiteCharms.Features/Shop/CartPackages/Entities/Package.cs +++ b/LiteCharms.Features.TechShop/CartPackages/Entities/Package.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.CartPackages.Entities; +namespace LiteCharms.Features.TechShop.CartPackages.Entities; [EntityTypeConfiguration] public class Package : Models.Package diff --git a/LiteCharms.Features/Shop/CartPackages/Entities/PackageConfirguration.cs b/LiteCharms.Features.TechShop/CartPackages/Entities/PackageConfirguration.cs similarity index 91% rename from LiteCharms.Features/Shop/CartPackages/Entities/PackageConfirguration.cs rename to LiteCharms.Features.TechShop/CartPackages/Entities/PackageConfirguration.cs index cfc89ff..3f1b9dd 100644 --- a/LiteCharms.Features/Shop/CartPackages/Entities/PackageConfirguration.cs +++ b/LiteCharms.Features.TechShop/CartPackages/Entities/PackageConfirguration.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.CartPackages.Entities; +namespace LiteCharms.Features.TechShop.CartPackages.Entities; public class PackageConfirguration : IEntityTypeConfiguration { diff --git a/LiteCharms.Features/Shop/CartPackages/Entities/PackageItem.cs b/LiteCharms.Features.TechShop/CartPackages/Entities/PackageItem.cs similarity index 65% rename from LiteCharms.Features/Shop/CartPackages/Entities/PackageItem.cs rename to LiteCharms.Features.TechShop/CartPackages/Entities/PackageItem.cs index 306975e..8a8715f 100644 --- a/LiteCharms.Features/Shop/CartPackages/Entities/PackageItem.cs +++ b/LiteCharms.Features.TechShop/CartPackages/Entities/PackageItem.cs @@ -1,6 +1,6 @@ -using LiteCharms.Features.Shop.Products.Entities; +using LiteCharms.Features.TechShop.Products.Entities; -namespace LiteCharms.Features.Shop.CartPackages.Entities; +namespace LiteCharms.Features.TechShop.CartPackages.Entities; [EntityTypeConfiguration] public class PackageItem : Models.PackageItem diff --git a/LiteCharms.Features/Shop/CartPackages/Entities/PackageItemConfiguration.cs b/LiteCharms.Features.TechShop/CartPackages/Entities/PackageItemConfiguration.cs similarity index 93% rename from LiteCharms.Features/Shop/CartPackages/Entities/PackageItemConfiguration.cs rename to LiteCharms.Features.TechShop/CartPackages/Entities/PackageItemConfiguration.cs index c6f1009..c77222a 100644 --- a/LiteCharms.Features/Shop/CartPackages/Entities/PackageItemConfiguration.cs +++ b/LiteCharms.Features.TechShop/CartPackages/Entities/PackageItemConfiguration.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.CartPackages.Entities; +namespace LiteCharms.Features.TechShop.CartPackages.Entities; public class PackageItemConfiguration : IEntityTypeConfiguration { diff --git a/LiteCharms.Features/Shop/CartPackages/Models/Package.cs b/LiteCharms.Features.TechShop/CartPackages/Models/Package.cs similarity index 85% rename from LiteCharms.Features/Shop/CartPackages/Models/Package.cs rename to LiteCharms.Features.TechShop/CartPackages/Models/Package.cs index 9d2e8b0..10f8224 100644 --- a/LiteCharms.Features/Shop/CartPackages/Models/Package.cs +++ b/LiteCharms.Features.TechShop/CartPackages/Models/Package.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.CartPackages.Models; +namespace LiteCharms.Features.TechShop.CartPackages.Models; public class Package { diff --git a/LiteCharms.Features/Shop/CartPackages/Models/PackageItem.cs b/LiteCharms.Features.TechShop/CartPackages/Models/PackageItem.cs similarity index 79% rename from LiteCharms.Features/Shop/CartPackages/Models/PackageItem.cs rename to LiteCharms.Features.TechShop/CartPackages/Models/PackageItem.cs index ff81c0a..795b759 100644 --- a/LiteCharms.Features/Shop/CartPackages/Models/PackageItem.cs +++ b/LiteCharms.Features.TechShop/CartPackages/Models/PackageItem.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.CartPackages.Models; +namespace LiteCharms.Features.TechShop.CartPackages.Models; public class PackageItem { diff --git a/LiteCharms.Features/Shop/CartPackages/PackageService.cs b/LiteCharms.Features.TechShop/CartPackages/PackageService.cs similarity index 97% rename from LiteCharms.Features/Shop/CartPackages/PackageService.cs rename to LiteCharms.Features.TechShop/CartPackages/PackageService.cs index f2aeda5..da2f986 100644 --- a/LiteCharms.Features/Shop/CartPackages/PackageService.cs +++ b/LiteCharms.Features.TechShop/CartPackages/PackageService.cs @@ -1,9 +1,10 @@ using LiteCharms.Features.Extensions; using LiteCharms.Features.Models; -using LiteCharms.Features.Shop.CartPackages.Models; -using LiteCharms.Features.Shop.Postgres; +using LiteCharms.Features.TechShop.CartPackages.Models; +using LiteCharms.Features.TechShop.Extensions; +using LiteCharms.Features.TechShop.Postgres; -namespace LiteCharms.Features.Shop.CartPackages; +namespace LiteCharms.Features.TechShop.CartPackages; public class PackageService(IDbContextFactory contextFactory) { diff --git a/LiteCharms.Features/Shop/Customers/CustomerService.cs b/LiteCharms.Features.TechShop/Customers/CustomerService.cs similarity index 96% rename from LiteCharms.Features/Shop/Customers/CustomerService.cs rename to LiteCharms.Features.TechShop/Customers/CustomerService.cs index 531ecfe..c8ea2cd 100644 --- a/LiteCharms.Features/Shop/Customers/CustomerService.cs +++ b/LiteCharms.Features.TechShop/Customers/CustomerService.cs @@ -1,9 +1,10 @@ using LiteCharms.Features.Extensions; using LiteCharms.Features.Models; -using LiteCharms.Features.Shop.Customers.Models; -using LiteCharms.Features.Shop.Postgres; +using LiteCharms.Features.TechShop.Customers.Models; +using LiteCharms.Features.TechShop.Extensions; +using LiteCharms.Features.TechShop.Postgres; -namespace LiteCharms.Features.Shop.Customers; +namespace LiteCharms.Features.TechShop.Customers; public class CustomerService(IDbContextFactory contextFactory) { diff --git a/LiteCharms.Features/Shop/Customers/Entities/Customer.cs b/LiteCharms.Features.TechShop/Customers/Entities/Customer.cs similarity index 56% rename from LiteCharms.Features/Shop/Customers/Entities/Customer.cs rename to LiteCharms.Features.TechShop/Customers/Entities/Customer.cs index 7b78bc8..d021a92 100644 --- a/LiteCharms.Features/Shop/Customers/Entities/Customer.cs +++ b/LiteCharms.Features.TechShop/Customers/Entities/Customer.cs @@ -1,9 +1,9 @@ -using LiteCharms.Features.Shop.Leads.Entities; -using LiteCharms.Features.Shop.Orders.Entities; -using LiteCharms.Features.Shop.Quotes.Entities; -using LiteCharms.Features.Shop.ShoppingCarts.Entities; +using LiteCharms.Features.TechShop.Leads.Entities; +using LiteCharms.Features.TechShop.Orders.Entities; +using LiteCharms.Features.TechShop.Quotes.Entities; +using LiteCharms.Features.TechShop.ShoppingCarts.Entities; -namespace LiteCharms.Features.Shop.Customers.Entities; +namespace LiteCharms.Features.TechShop.Customers.Entities; [EntityTypeConfiguration] public class Customer : Models.Customer diff --git a/LiteCharms.Features/Shop/Customers/Entities/CustomerConfiguration.cs b/LiteCharms.Features.TechShop/Customers/Entities/CustomerConfiguration.cs similarity index 94% rename from LiteCharms.Features/Shop/Customers/Entities/CustomerConfiguration.cs rename to LiteCharms.Features.TechShop/Customers/Entities/CustomerConfiguration.cs index f5ce014..e6a23a0 100644 --- a/LiteCharms.Features/Shop/Customers/Entities/CustomerConfiguration.cs +++ b/LiteCharms.Features.TechShop/Customers/Entities/CustomerConfiguration.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Customers.Entities; +namespace LiteCharms.Features.TechShop.Customers.Entities; public class CustomerConfiguration : IEntityTypeConfiguration { diff --git a/LiteCharms.Features/Shop/Customers/Models/Customer.cs b/LiteCharms.Features.TechShop/Customers/Models/Customer.cs similarity index 93% rename from LiteCharms.Features/Shop/Customers/Models/Customer.cs rename to LiteCharms.Features.TechShop/Customers/Models/Customer.cs index d4cec8c..2904a3e 100644 --- a/LiteCharms.Features/Shop/Customers/Models/Customer.cs +++ b/LiteCharms.Features.TechShop/Customers/Models/Customer.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Customers.Models; +namespace LiteCharms.Features.TechShop.Customers.Models; public class Customer { diff --git a/LiteCharms.Features/Shop/Customers/Models/Records.cs b/LiteCharms.Features.TechShop/Customers/Models/Records.cs similarity index 96% rename from LiteCharms.Features/Shop/Customers/Models/Records.cs rename to LiteCharms.Features.TechShop/Customers/Models/Records.cs index 0b4c788..35c8e45 100644 --- a/LiteCharms.Features/Shop/Customers/Models/Records.cs +++ b/LiteCharms.Features.TechShop/Customers/Models/Records.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Customers.Models; +namespace LiteCharms.Features.TechShop.Customers.Models; public record CreateCustomer { diff --git a/LiteCharms.Features/Shop/Enums.cs b/LiteCharms.Features.TechShop/Enums.cs similarity index 71% rename from LiteCharms.Features/Shop/Enums.cs rename to LiteCharms.Features.TechShop/Enums.cs index 6f25546..d228c10 100644 --- a/LiteCharms.Features/Shop/Enums.cs +++ b/LiteCharms.Features.TechShop/Enums.cs @@ -1,16 +1,4 @@ -namespace LiteCharms.Features.Shop; - -public enum EmailStatuses : int -{ - GeneralError = 0, - AuthenticationError = 1, - ProtocolError = 2, - Connected = 3, - Disconnected = 4, - TooManyConnections = 5, - ConnectionAborted = 6, - Success = 7 -} +namespace LiteCharms.Features.TechShop; public enum CorrelationIdTypes : int { @@ -27,13 +15,6 @@ public enum CorrelationIdTypes : int LinkedIn = 10 } -public enum Priorities : int -{ - Low = 0, - Medium = 1, - High = 2, -} - public enum NotificationPlatforms : int { Email = 1, diff --git a/LiteCharms.Features.TechShop/Extensions/HealthChecks.cs b/LiteCharms.Features.TechShop/Extensions/HealthChecks.cs new file mode 100644 index 0000000..ee2a4a4 --- /dev/null +++ b/LiteCharms.Features.TechShop/Extensions/HealthChecks.cs @@ -0,0 +1,22 @@ +using LiteCharms.Features.TechShop.HealthChecks; +using static LiteCharms.Features.TechShop.Extensions.Postgres; + +namespace LiteCharms.Features.TechShop.Extensions; + +public static class HealthChecks +{ + public static IServiceCollection AddShopQuartzHealthCheck(this IServiceCollection services) + { + services.AddHealthChecks().AddCheck("ShopQuartz"); + + return services; + } + + + public static IServiceCollection AddShopPostgresHealthCheck(this IServiceCollection services) + { + services.AddHealthChecks().AddCheck(ShopDbConfigName); + + return services; + } +} diff --git a/LiteCharms.Features/Extensions/EntityModeMappers.cs b/LiteCharms.Features.TechShop/Extensions/Mappers.cs similarity index 75% rename from LiteCharms.Features/Extensions/EntityModeMappers.cs rename to LiteCharms.Features.TechShop/Extensions/Mappers.cs index 9dce6e8..2190f0e 100644 --- a/LiteCharms.Features/Extensions/EntityModeMappers.cs +++ b/LiteCharms.Features.TechShop/Extensions/Mappers.cs @@ -1,17 +1,18 @@ -using LiteCharms.Features.Shop.CartPackages.Models; -using LiteCharms.Features.Shop.Customers.Models; -using LiteCharms.Features.Shop.Leads.Models; -using LiteCharms.Features.Shop.Notifications.Models; -using LiteCharms.Features.Shop.Orders.Models; -using LiteCharms.Features.Shop.Products.Models; -using LiteCharms.Features.Shop.Quotes.Models; -using LiteCharms.Features.Shop.ShoppingCarts.Models; +using LiteCharms.Features.TechShop.CartPackages.Models; +using LiteCharms.Features.TechShop.Customers.Models; +using LiteCharms.Features.TechShop.Leads.Models; +using LiteCharms.Features.TechShop.Notifications.Models; +using LiteCharms.Features.TechShop.Orders.Models; +using LiteCharms.Features.TechShop.Products.Entities; +using LiteCharms.Features.TechShop.Products.Models; +using LiteCharms.Features.TechShop.Quotes.Models; +using LiteCharms.Features.TechShop.ShoppingCarts.Models; -namespace LiteCharms.Features.Extensions; +namespace LiteCharms.Features.TechShop.Extensions; -public static class EntityModeMappers +public static class Mappers { - public static ShoppingCartPackage ToModel(this Features.Shop.ShoppingCarts.Entities.ShoppingCartPackage entity) => + public static ShoppingCartPackage ToModel(this ShoppingCarts.Entities.ShoppingCartPackage entity) => new() { Id = entity.Id, @@ -20,7 +21,7 @@ public static class EntityModeMappers ShoppingCartId = entity.ShoppingCartId }; - public static PackageItem ToModel(this Features.Shop.CartPackages.Entities.PackageItem entity) => + public static PackageItem ToModel(this CartPackages.Entities.PackageItem entity) => new() { Id = entity.Id, @@ -30,7 +31,7 @@ public static class EntityModeMappers ProductPriceId = entity.ProductPriceId }; - public static Package ToModel(this Features.Shop.CartPackages.Entities.Package entity) => + public static Package ToModel(this CartPackages.Entities.Package entity) => new() { Id = entity.Id, @@ -43,7 +44,7 @@ public static class EntityModeMappers Summary = entity.Summary }; - public static ShoppingCartItem ToModel(this Features.Shop.ShoppingCarts.Entities.ShoppingCartItem entity) => + public static ShoppingCartItem ToModel(this ShoppingCarts.Entities.ShoppingCartItem entity) => new() { Id = entity.Id, @@ -54,7 +55,7 @@ public static class EntityModeMappers ShoppingCartId = entity.ShoppingCartId }; - public static ShoppingCart ToModel(this Features.Shop.ShoppingCarts.Entities.ShoppingCart entity) => + public static ShoppingCart ToModel(this ShoppingCarts.Entities.ShoppingCart entity) => new() { Id = entity.Id, @@ -64,7 +65,7 @@ public static class EntityModeMappers OrderId = entity.OrderId }; - public static Quote ToModel(this Features.Shop.Quotes.Entities.Quote entity) => + public static Quote ToModel(this Quotes.Entities.Quote entity) => new() { Id = entity.Id, @@ -79,7 +80,7 @@ public static class EntityModeMappers OrderId = entity.OrderId }; - public static Notification ToModel(this Features.Shop.Notifications.Entities.Notification entity) => + public static Notification ToModel(this Notifications.Entities.Notification entity) => new() { Id = entity.Id, @@ -103,7 +104,7 @@ public static class EntityModeMappers Errors = entity.Errors }; - public static Customer ToModel(this Features.Shop.Customers.Entities.Customer entity) => + public static Customer ToModel(this Customers.Entities.Customer entity) => new() { Id = entity.Id, @@ -128,7 +129,7 @@ public static class EntityModeMappers Whatsapp = entity.Whatsapp }; - public static Lead ToModel(this Features.Shop.Leads.Entities.Lead entity) => + public static Lead ToModel(this Leads.Entities.Lead entity) => new() { Id = entity.Id, @@ -149,7 +150,7 @@ public static class EntityModeMappers Status = entity.Status }; - public static Order ToModel(this Features.Shop.Orders.Entities.Order entity) => + public static Order ToModel(this Orders.Entities.Order entity) => new() { Id = entity.Id, @@ -163,7 +164,7 @@ public static class EntityModeMappers InvoiceUrl = entity.InvoiceUrl }; - public static OrderRefund ToModel(this Features.Shop.Orders.Entities.OrderRefund entity) => + public static OrderRefund ToModel(this Orders.Entities.OrderRefund entity) => new() { Id = entity.Id, @@ -173,7 +174,7 @@ public static class EntityModeMappers Amount = entity.Amount }; - public static Product ToModel(this Features.Shop.Products.Entities.Product entity) => + public static Products.Models.Product ToModel(this Products.Entities.Product entity) => new() { Id = entity.Id, @@ -187,7 +188,7 @@ public static class EntityModeMappers Metadata = entity.Metadata, }; - public static ProductPrice ToModel(this Features.Shop.Products.Entities.ProductPrice entity) => + public static Products.Models.ProductPrice ToModel(this Products.Entities.ProductPrice entity) => new() { Id = entity.Id, diff --git a/LiteCharms.Features.TechShop/Extensions/Postgres.cs b/LiteCharms.Features.TechShop/Extensions/Postgres.cs new file mode 100644 index 0000000..a264fa2 --- /dev/null +++ b/LiteCharms.Features.TechShop/Extensions/Postgres.cs @@ -0,0 +1,16 @@ +using LiteCharms.Features.TechShop.Postgres; + +namespace LiteCharms.Features.TechShop.Extensions; + +public static class Postgres +{ + public const string ShopDbConfigName = "PostgresShop"; + + public static IServiceCollection AddTechShopDatabase(this IServiceCollection services, IConfiguration configuration) + { + services.AddPooledDbContextFactory(options => + options.UseNpgsql(configuration.GetConnectionString(ShopDbConfigName))); + + return services; + } +} diff --git a/LiteCharms.Features.TechShop/Extensions/Shop.cs b/LiteCharms.Features.TechShop/Extensions/Shop.cs new file mode 100644 index 0000000..fd96fc6 --- /dev/null +++ b/LiteCharms.Features.TechShop/Extensions/Shop.cs @@ -0,0 +1,27 @@ +using LiteCharms.Features.TechShop.CartPackages; +using LiteCharms.Features.TechShop.Customers; +using LiteCharms.Features.TechShop.Leads; +using LiteCharms.Features.TechShop.Notifications; +using LiteCharms.Features.TechShop.Orders; +using LiteCharms.Features.TechShop.Products; +using LiteCharms.Features.TechShop.Quotes; +using LiteCharms.Features.TechShop.ShoppingCarts; + +namespace LiteCharms.Features.TechShop.Extensions; + +public static class Shop +{ + public static IServiceCollection AddTechShopServices(this IServiceCollection services) + { + services.AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton() + .AddSingleton(); + + return services; + } +} diff --git a/LiteCharms.Features/HealthChecks/PostgresShopHealthCheck.cs b/LiteCharms.Features.TechShop/HealthChecks/PostgresShopHealthCheck.cs similarity index 88% rename from LiteCharms.Features/HealthChecks/PostgresShopHealthCheck.cs rename to LiteCharms.Features.TechShop/HealthChecks/PostgresShopHealthCheck.cs index 4a65640..db55287 100644 --- a/LiteCharms.Features/HealthChecks/PostgresShopHealthCheck.cs +++ b/LiteCharms.Features.TechShop/HealthChecks/PostgresShopHealthCheck.cs @@ -1,6 +1,6 @@ -using static LiteCharms.Features.Extensions.Postgres; +using static LiteCharms.Features.TechShop.Extensions.Postgres; -namespace LiteCharms.Features.HealthChecks; +namespace LiteCharms.Features.TechShop.HealthChecks; public class PostgresShopHealthCheck(IConfiguration configuration) : IHealthCheck { diff --git a/LiteCharms.Features/HealthChecks/ShopQuartzHealthCheck.cs b/LiteCharms.Features.TechShop/HealthChecks/ShopQuartzHealthCheck.cs similarity index 95% rename from LiteCharms.Features/HealthChecks/ShopQuartzHealthCheck.cs rename to LiteCharms.Features.TechShop/HealthChecks/ShopQuartzHealthCheck.cs index 0ccae12..5599d26 100644 --- a/LiteCharms.Features/HealthChecks/ShopQuartzHealthCheck.cs +++ b/LiteCharms.Features.TechShop/HealthChecks/ShopQuartzHealthCheck.cs @@ -1,6 +1,6 @@ using static LiteCharms.Features.Extensions.Quartz; -namespace LiteCharms.Features.HealthChecks; +namespace LiteCharms.Features.TechShop.HealthChecks; public class ShopQuartzHealthCheck(ISchedulerFactory schedulerFactory) : IHealthCheck { diff --git a/LiteCharms.Features/Shop/Leads/Entities/Lead.cs b/LiteCharms.Features.TechShop/Leads/Entities/Lead.cs similarity index 55% rename from LiteCharms.Features/Shop/Leads/Entities/Lead.cs rename to LiteCharms.Features.TechShop/Leads/Entities/Lead.cs index cbb4ec1..8ce5357 100644 --- a/LiteCharms.Features/Shop/Leads/Entities/Lead.cs +++ b/LiteCharms.Features.TechShop/Leads/Entities/Lead.cs @@ -1,6 +1,6 @@ -using LiteCharms.Features.Shop.Customers.Entities; +using LiteCharms.Features.TechShop.Customers.Entities; -namespace LiteCharms.Features.Shop.Leads.Entities; +namespace LiteCharms.Features.TechShop.Leads.Entities; [EntityTypeConfiguration] public class Lead : Models.Lead diff --git a/LiteCharms.Features/Shop/Leads/Entities/LeadConfiguration.cs b/LiteCharms.Features.TechShop/Leads/Entities/LeadConfiguration.cs similarity index 95% rename from LiteCharms.Features/Shop/Leads/Entities/LeadConfiguration.cs rename to LiteCharms.Features.TechShop/Leads/Entities/LeadConfiguration.cs index e24839e..c5beca0 100644 --- a/LiteCharms.Features/Shop/Leads/Entities/LeadConfiguration.cs +++ b/LiteCharms.Features.TechShop/Leads/Entities/LeadConfiguration.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Leads.Entities; +namespace LiteCharms.Features.TechShop.Leads.Entities; public class LeadConfiguration : IEntityTypeConfiguration { diff --git a/LiteCharms.Features/Shop/Leads/LeadService.cs b/LiteCharms.Features.TechShop/Leads/LeadService.cs similarity index 96% rename from LiteCharms.Features/Shop/Leads/LeadService.cs rename to LiteCharms.Features.TechShop/Leads/LeadService.cs index 18c5063..79c9858 100644 --- a/LiteCharms.Features/Shop/Leads/LeadService.cs +++ b/LiteCharms.Features.TechShop/Leads/LeadService.cs @@ -1,10 +1,11 @@ using LiteCharms.Features.Extensions; using LiteCharms.Features.Models; -using LiteCharms.Features.Shop.Leads.Models; -using LiteCharms.Features.Shop.Postgres; +using LiteCharms.Features.TechShop.Extensions; +using LiteCharms.Features.TechShop.Leads.Models; +using LiteCharms.Features.TechShop.Postgres; using static LiteCharms.Features.Extensions.Hash; -namespace LiteCharms.Features.Shop.Leads; +namespace LiteCharms.Features.TechShop.Leads; public class LeadService(IDbContextFactory contextFactory) { diff --git a/LiteCharms.Features/Shop/Leads/Models/Lead.cs b/LiteCharms.Features.TechShop/Leads/Models/Lead.cs similarity index 92% rename from LiteCharms.Features/Shop/Leads/Models/Lead.cs rename to LiteCharms.Features.TechShop/Leads/Models/Lead.cs index adfb1ba..71bd6b7 100644 --- a/LiteCharms.Features/Shop/Leads/Models/Lead.cs +++ b/LiteCharms.Features.TechShop/Leads/Models/Lead.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Leads.Models; +namespace LiteCharms.Features.TechShop.Leads.Models; public class Lead { diff --git a/LiteCharms.Features/Shop/Leads/Models/Records.cs b/LiteCharms.Features.TechShop/Leads/Models/Records.cs similarity index 91% rename from LiteCharms.Features/Shop/Leads/Models/Records.cs rename to LiteCharms.Features.TechShop/Leads/Models/Records.cs index 9037942..0d84a14 100644 --- a/LiteCharms.Features/Shop/Leads/Models/Records.cs +++ b/LiteCharms.Features.TechShop/Leads/Models/Records.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Leads.Models; +namespace LiteCharms.Features.TechShop.Leads.Models; public record CreateLead { diff --git a/LiteCharms.Features.TechShop/LiteCharms.Features.TechShop.csproj b/LiteCharms.Features.TechShop/LiteCharms.Features.TechShop.csproj new file mode 100644 index 0000000..a8478ad --- /dev/null +++ b/LiteCharms.Features.TechShop/LiteCharms.Features.TechShop.csproj @@ -0,0 +1,166 @@ + + + + net10.0 + enable + enable + True + ..\LiteCharms.snk + fbd8f4a2-0420-44e2-baff-4678d9e7eee1 + + + + + LiteCharms.Features.TechShop + 1.0.20 + Khwezi Mngoma + Lite Charms (PTY) Ltd + TechShop feature components for Lite Charms applications. + https://gitea.khongisa.co.za/litecharms/components + https://gitea.khongisa.co.za/litecharms/components.git + git + LICENSE + utility;dotnet + icon.png + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + + diff --git a/LiteCharms.Features/Shop/Notifications/Entities/Notification.cs b/LiteCharms.Features.TechShop/Notifications/Entities/Notification.cs similarity index 63% rename from LiteCharms.Features/Shop/Notifications/Entities/Notification.cs rename to LiteCharms.Features.TechShop/Notifications/Entities/Notification.cs index 36a7dbc..b94b428 100644 --- a/LiteCharms.Features/Shop/Notifications/Entities/Notification.cs +++ b/LiteCharms.Features.TechShop/Notifications/Entities/Notification.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Notifications.Entities; +namespace LiteCharms.Features.TechShop.Notifications.Entities; [EntityTypeConfiguration] public class Notification : Models.Notification; diff --git a/LiteCharms.Features/Shop/Notifications/Entities/NotificationConfiguration.cs b/LiteCharms.Features.TechShop/Notifications/Entities/NotificationConfiguration.cs similarity index 95% rename from LiteCharms.Features/Shop/Notifications/Entities/NotificationConfiguration.cs rename to LiteCharms.Features.TechShop/Notifications/Entities/NotificationConfiguration.cs index 7139d0d..089e749 100644 --- a/LiteCharms.Features/Shop/Notifications/Entities/NotificationConfiguration.cs +++ b/LiteCharms.Features.TechShop/Notifications/Entities/NotificationConfiguration.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Notifications.Entities; +namespace LiteCharms.Features.TechShop.Notifications.Entities; public class NotificationConfiguration : IEntityTypeConfiguration { diff --git a/LiteCharms.Features/Shop/Notifications/Events/Handlers/ProcessEmailNotificationsEventHandler.cs b/LiteCharms.Features.TechShop/Notifications/Events/Handlers/ProcessEmailNotificationsEventHandler.cs similarity index 94% rename from LiteCharms.Features/Shop/Notifications/Events/Handlers/ProcessEmailNotificationsEventHandler.cs rename to LiteCharms.Features.TechShop/Notifications/Events/Handlers/ProcessEmailNotificationsEventHandler.cs index 6917777..5a2cdd2 100644 --- a/LiteCharms.Features/Shop/Notifications/Events/Handlers/ProcessEmailNotificationsEventHandler.cs +++ b/LiteCharms.Features.TechShop/Notifications/Events/Handlers/ProcessEmailNotificationsEventHandler.cs @@ -1,9 +1,8 @@ -using k8s.KubeConfigModels; -using LiteCharms.Features.Email; -using LiteCharms.Features.Shop.Notifications.Models; -using LiteCharms.Features.Shop.Postgres; +using LiteCharms.Features.Email; +using LiteCharms.Features.TechShop.Notifications.Models; +using LiteCharms.Features.TechShop.Postgres; -namespace LiteCharms.Features.Shop.Notifications.Events.Handlers; +namespace LiteCharms.Features.TechShop.Notifications.Events.Handlers; public class ProcessEmailNotificationsEventHandler(IDbContextFactory contextFactory, ILogger logger, EmailService emailService) : INotificationHandler diff --git a/LiteCharms.Features/Email/Events/Handlers/SendShopEmailEnquiryEventHandler.cs b/LiteCharms.Features.TechShop/Notifications/Events/Handlers/SendShopEmailEnquiryEventHandler.cs similarity index 75% rename from LiteCharms.Features/Email/Events/Handlers/SendShopEmailEnquiryEventHandler.cs rename to LiteCharms.Features.TechShop/Notifications/Events/Handlers/SendShopEmailEnquiryEventHandler.cs index 1b7fda9..c6bc984 100644 --- a/LiteCharms.Features/Email/Events/Handlers/SendShopEmailEnquiryEventHandler.cs +++ b/LiteCharms.Features.TechShop/Notifications/Events/Handlers/SendShopEmailEnquiryEventHandler.cs @@ -1,14 +1,12 @@ -using LiteCharms.Features.Shop; -using LiteCharms.Features.Shop.Notifications; -using static LiteCharms.Features.Extensions.Email; +using static LiteCharms.Features.Extensions.Email; -namespace LiteCharms.Features.Email.Events.Handlers; +namespace LiteCharms.Features.TechShop.Notifications.Events.Handlers; public class SendShopEmailEnquiryEventHandler(NotificationService notificationService) : INotificationHandler { public async ValueTask Handle(SendShopEmailEnquiryEvent notification, CancellationToken cancellationToken) => - await notificationService.CreateNotificationAsync(new Shop.Notifications.Models.CreateNotification + await notificationService.CreateNotificationAsync(new Models.CreateNotification { CorrelationId = notification.CorrelationId, CorrelationIdType = CorrelationIdTypes.None, diff --git a/LiteCharms.Features/Shop/Notifications/Events/ProcessEmailNotificationsEvent.cs b/LiteCharms.Features.TechShop/Notifications/Events/ProcessEmailNotificationsEvent.cs similarity index 89% rename from LiteCharms.Features/Shop/Notifications/Events/ProcessEmailNotificationsEvent.cs rename to LiteCharms.Features.TechShop/Notifications/Events/ProcessEmailNotificationsEvent.cs index 366332f..06a7029 100644 --- a/LiteCharms.Features/Shop/Notifications/Events/ProcessEmailNotificationsEvent.cs +++ b/LiteCharms.Features.TechShop/Notifications/Events/ProcessEmailNotificationsEvent.cs @@ -1,6 +1,6 @@ using LiteCharms.Features.Abstractions; -namespace LiteCharms.Features.Shop.Notifications.Events; +namespace LiteCharms.Features.TechShop.Notifications.Events; public class ProcessEmailNotificationsEvent : EventBase, IEvent { diff --git a/LiteCharms.Features/Email/Events/SendShopEmailEnquiryEvent.cs b/LiteCharms.Features.TechShop/Notifications/Events/SendShopEmailEnquiryEvent.cs similarity index 94% rename from LiteCharms.Features/Email/Events/SendShopEmailEnquiryEvent.cs rename to LiteCharms.Features.TechShop/Notifications/Events/SendShopEmailEnquiryEvent.cs index 3377b44..246f433 100644 --- a/LiteCharms.Features/Email/Events/SendShopEmailEnquiryEvent.cs +++ b/LiteCharms.Features.TechShop/Notifications/Events/SendShopEmailEnquiryEvent.cs @@ -1,7 +1,6 @@ using LiteCharms.Features.Abstractions; -using LiteCharms.Features.Shop; -namespace LiteCharms.Features.Email.Events; +namespace LiteCharms.Features.TechShop.Notifications.Events; public class SendShopEmailEnquiryEvent : EventBase, IEvent { diff --git a/LiteCharms.Features/Shop/Notifications/Models/Notification.cs b/LiteCharms.Features.TechShop/Notifications/Models/Notification.cs similarity index 89% rename from LiteCharms.Features/Shop/Notifications/Models/Notification.cs rename to LiteCharms.Features.TechShop/Notifications/Models/Notification.cs index fd085a1..71ca0b3 100644 --- a/LiteCharms.Features/Shop/Notifications/Models/Notification.cs +++ b/LiteCharms.Features.TechShop/Notifications/Models/Notification.cs @@ -1,4 +1,6 @@ -namespace LiteCharms.Features.Shop.Notifications.Models; +using LiteCharms.Features.TechShop; + +namespace LiteCharms.Features.TechShop.Notifications.Models; public class Notification { diff --git a/LiteCharms.Features/Shop/Notifications/Models/Records.cs b/LiteCharms.Features.TechShop/Notifications/Models/Records.cs similarity index 93% rename from LiteCharms.Features/Shop/Notifications/Models/Records.cs rename to LiteCharms.Features.TechShop/Notifications/Models/Records.cs index 6d41f26..d72e5e7 100644 --- a/LiteCharms.Features/Shop/Notifications/Models/Records.cs +++ b/LiteCharms.Features.TechShop/Notifications/Models/Records.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Notifications.Models; +namespace LiteCharms.Features.TechShop.Notifications.Models; public record CreateNotification { diff --git a/LiteCharms.Features/Shop/Notifications/NotificationService.cs b/LiteCharms.Features.TechShop/Notifications/NotificationService.cs similarity index 95% rename from LiteCharms.Features/Shop/Notifications/NotificationService.cs rename to LiteCharms.Features.TechShop/Notifications/NotificationService.cs index 928a131..8826294 100644 --- a/LiteCharms.Features/Shop/Notifications/NotificationService.cs +++ b/LiteCharms.Features.TechShop/Notifications/NotificationService.cs @@ -1,9 +1,10 @@ using LiteCharms.Features.Extensions; using LiteCharms.Features.Models; -using LiteCharms.Features.Shop.Notifications.Models; -using LiteCharms.Features.Shop.Postgres; +using LiteCharms.Features.TechShop.Extensions; +using LiteCharms.Features.TechShop.Notifications.Models; +using LiteCharms.Features.TechShop.Postgres; -namespace LiteCharms.Features.Shop.Notifications; +namespace LiteCharms.Features.TechShop.Notifications; public class NotificationService(IDbContextFactory contextFactory) { diff --git a/LiteCharms.Features/Shop/Orders/Entities/Order.cs b/LiteCharms.Features.TechShop/Orders/Entities/Order.cs similarity index 58% rename from LiteCharms.Features/Shop/Orders/Entities/Order.cs rename to LiteCharms.Features.TechShop/Orders/Entities/Order.cs index f5dd1d0..3996795 100644 --- a/LiteCharms.Features/Shop/Orders/Entities/Order.cs +++ b/LiteCharms.Features.TechShop/Orders/Entities/Order.cs @@ -1,8 +1,8 @@ -using LiteCharms.Features.Shop.Customers.Entities; -using LiteCharms.Features.Shop.Quotes.Entities; -using LiteCharms.Features.Shop.ShoppingCarts.Entities; +using LiteCharms.Features.TechShop.Customers.Entities; +using LiteCharms.Features.TechShop.Quotes.Entities; +using LiteCharms.Features.TechShop.ShoppingCarts.Entities; -namespace LiteCharms.Features.Shop.Orders.Entities; +namespace LiteCharms.Features.TechShop.Orders.Entities; [EntityTypeConfiguration] public class Order : Models.Order diff --git a/LiteCharms.Features/Shop/Orders/Entities/OrderConfiguration.cs b/LiteCharms.Features.TechShop/Orders/Entities/OrderConfiguration.cs similarity index 94% rename from LiteCharms.Features/Shop/Orders/Entities/OrderConfiguration.cs rename to LiteCharms.Features.TechShop/Orders/Entities/OrderConfiguration.cs index 848aaed..187c916 100644 --- a/LiteCharms.Features/Shop/Orders/Entities/OrderConfiguration.cs +++ b/LiteCharms.Features.TechShop/Orders/Entities/OrderConfiguration.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Orders.Entities; +namespace LiteCharms.Features.TechShop.Orders.Entities; public class OrderConfiguration : IEntityTypeConfiguration { diff --git a/LiteCharms.Features/Shop/Orders/Entities/OrderRefund.cs b/LiteCharms.Features.TechShop/Orders/Entities/OrderRefund.cs similarity index 73% rename from LiteCharms.Features/Shop/Orders/Entities/OrderRefund.cs rename to LiteCharms.Features.TechShop/Orders/Entities/OrderRefund.cs index 8f7e462..e832b46 100644 --- a/LiteCharms.Features/Shop/Orders/Entities/OrderRefund.cs +++ b/LiteCharms.Features.TechShop/Orders/Entities/OrderRefund.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Orders.Entities; +namespace LiteCharms.Features.TechShop.Orders.Entities; [EntityTypeConfiguration] public class OrderRefund : Models.OrderRefund diff --git a/LiteCharms.Features/Shop/Orders/Entities/OrderRefundConfiguration.cs b/LiteCharms.Features.TechShop/Orders/Entities/OrderRefundConfiguration.cs similarity index 92% rename from LiteCharms.Features/Shop/Orders/Entities/OrderRefundConfiguration.cs rename to LiteCharms.Features.TechShop/Orders/Entities/OrderRefundConfiguration.cs index b33c2ee..33a336b 100644 --- a/LiteCharms.Features/Shop/Orders/Entities/OrderRefundConfiguration.cs +++ b/LiteCharms.Features.TechShop/Orders/Entities/OrderRefundConfiguration.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Orders.Entities; +namespace LiteCharms.Features.TechShop.Orders.Entities; public class OrderRefundConfiguration : IEntityTypeConfiguration { diff --git a/LiteCharms.Features/Shop/Orders/Models/Order.cs b/LiteCharms.Features.TechShop/Orders/Models/Order.cs similarity index 81% rename from LiteCharms.Features/Shop/Orders/Models/Order.cs rename to LiteCharms.Features.TechShop/Orders/Models/Order.cs index 30bb75d..2146423 100644 --- a/LiteCharms.Features/Shop/Orders/Models/Order.cs +++ b/LiteCharms.Features.TechShop/Orders/Models/Order.cs @@ -1,4 +1,6 @@ -namespace LiteCharms.Features.Shop.Orders.Models; +using LiteCharms.Features.TechShop; + +namespace LiteCharms.Features.TechShop.Orders.Models; public class Order { diff --git a/LiteCharms.Features/Shop/Orders/Models/OrderRefund.cs b/LiteCharms.Features.TechShop/Orders/Models/OrderRefund.cs similarity index 80% rename from LiteCharms.Features/Shop/Orders/Models/OrderRefund.cs rename to LiteCharms.Features.TechShop/Orders/Models/OrderRefund.cs index 1463afd..b8ac3fb 100644 --- a/LiteCharms.Features/Shop/Orders/Models/OrderRefund.cs +++ b/LiteCharms.Features.TechShop/Orders/Models/OrderRefund.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Orders.Models; +namespace LiteCharms.Features.TechShop.Orders.Models; public class OrderRefund { diff --git a/LiteCharms.Features/Shop/Orders/Models/Records.cs b/LiteCharms.Features.TechShop/Orders/Models/Records.cs similarity index 89% rename from LiteCharms.Features/Shop/Orders/Models/Records.cs rename to LiteCharms.Features.TechShop/Orders/Models/Records.cs index 21dde34..1325c97 100644 --- a/LiteCharms.Features/Shop/Orders/Models/Records.cs +++ b/LiteCharms.Features.TechShop/Orders/Models/Records.cs @@ -1,4 +1,6 @@ -namespace LiteCharms.Features.Shop.Orders.Models; +using LiteCharms.Features.TechShop; + +namespace LiteCharms.Features.TechShop.Orders.Models; public record CreateOrder { diff --git a/LiteCharms.Features/Shop/Orders/OrderService.cs b/LiteCharms.Features.TechShop/Orders/OrderService.cs similarity index 98% rename from LiteCharms.Features/Shop/Orders/OrderService.cs rename to LiteCharms.Features.TechShop/Orders/OrderService.cs index ff6d571..9d5299b 100644 --- a/LiteCharms.Features/Shop/Orders/OrderService.cs +++ b/LiteCharms.Features.TechShop/Orders/OrderService.cs @@ -1,9 +1,10 @@ using LiteCharms.Features.Extensions; using LiteCharms.Features.Models; -using LiteCharms.Features.Shop.Orders.Models; -using LiteCharms.Features.Shop.Postgres; +using LiteCharms.Features.TechShop.Extensions; +using LiteCharms.Features.TechShop.Orders.Models; +using LiteCharms.Features.TechShop.Postgres; -namespace LiteCharms.Features.Shop.Orders; +namespace LiteCharms.Features.TechShop.Orders; public class OrderService(IDbContextFactory contextFactory) { diff --git a/LiteCharms.Features/Shop/Postgres/Migrations/20260512065421_Init.Designer.cs b/LiteCharms.Features.TechShop/Postgres/Migrations/20260512065421_Init.Designer.cs similarity index 99% rename from LiteCharms.Features/Shop/Postgres/Migrations/20260512065421_Init.Designer.cs rename to LiteCharms.Features.TechShop/Postgres/Migrations/20260512065421_Init.Designer.cs index 5900074..f7407e8 100644 --- a/LiteCharms.Features/Shop/Postgres/Migrations/20260512065421_Init.Designer.cs +++ b/LiteCharms.Features.TechShop/Postgres/Migrations/20260512065421_Init.Designer.cs @@ -1,6 +1,6 @@ // using System; -using LiteCharms.Features.Shop.Postgres; +using LiteCharms.Features.TechShop.Postgres; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; @@ -9,7 +9,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace LiteCharms.Features.Shop.Postgres.Migrations +namespace LiteCharms.Features.TechShop.Postgres.Migrations { [DbContext(typeof(ShopDbContext))] [Migration("20260512065421_Init")] diff --git a/LiteCharms.Features/Shop/Postgres/Migrations/20260512065421_Init.cs b/LiteCharms.Features.TechShop/Postgres/Migrations/20260512065421_Init.cs similarity index 99% rename from LiteCharms.Features/Shop/Postgres/Migrations/20260512065421_Init.cs rename to LiteCharms.Features.TechShop/Postgres/Migrations/20260512065421_Init.cs index 1220ecc..201f8d5 100644 --- a/LiteCharms.Features/Shop/Postgres/Migrations/20260512065421_Init.cs +++ b/LiteCharms.Features.TechShop/Postgres/Migrations/20260512065421_Init.cs @@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace LiteCharms.Features.Shop.Postgres.Migrations +namespace LiteCharms.Features.TechShop.Postgres.Migrations { /// public partial class Init : Migration diff --git a/LiteCharms.Features/Shop/Postgres/Migrations/20260514004002_UsedStringTableNames.Designer.cs b/LiteCharms.Features.TechShop/Postgres/Migrations/20260514004002_UsedStringTableNames.Designer.cs similarity index 99% rename from LiteCharms.Features/Shop/Postgres/Migrations/20260514004002_UsedStringTableNames.Designer.cs rename to LiteCharms.Features.TechShop/Postgres/Migrations/20260514004002_UsedStringTableNames.Designer.cs index b0185a2..275d93a 100644 --- a/LiteCharms.Features/Shop/Postgres/Migrations/20260514004002_UsedStringTableNames.Designer.cs +++ b/LiteCharms.Features.TechShop/Postgres/Migrations/20260514004002_UsedStringTableNames.Designer.cs @@ -1,6 +1,6 @@ // using System; -using LiteCharms.Features.Shop.Postgres; +using LiteCharms.Features.TechShop.Postgres; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; @@ -9,7 +9,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace LiteCharms.Features.Shop.Postgres.Migrations +namespace LiteCharms.Features.TechShop.Postgres.Migrations { [DbContext(typeof(ShopDbContext))] [Migration("20260514004002_UsedStringTableNames")] diff --git a/LiteCharms.Features/Shop/Postgres/Migrations/20260514004002_UsedStringTableNames.cs b/LiteCharms.Features.TechShop/Postgres/Migrations/20260514004002_UsedStringTableNames.cs similarity index 99% rename from LiteCharms.Features/Shop/Postgres/Migrations/20260514004002_UsedStringTableNames.cs rename to LiteCharms.Features.TechShop/Postgres/Migrations/20260514004002_UsedStringTableNames.cs index 234f04a..22dc364 100644 --- a/LiteCharms.Features/Shop/Postgres/Migrations/20260514004002_UsedStringTableNames.cs +++ b/LiteCharms.Features.TechShop/Postgres/Migrations/20260514004002_UsedStringTableNames.cs @@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace LiteCharms.Features.Shop.Postgres.Migrations +namespace LiteCharms.Features.TechShop.Postgres.Migrations { /// public partial class UsedStringTableNames : Migration diff --git a/LiteCharms.Features/Shop/Postgres/Migrations/20260515055221_FixedLeadCustomerRelationship.Designer.cs b/LiteCharms.Features.TechShop/Postgres/Migrations/20260515055221_FixedLeadCustomerRelationship.Designer.cs similarity index 99% rename from LiteCharms.Features/Shop/Postgres/Migrations/20260515055221_FixedLeadCustomerRelationship.Designer.cs rename to LiteCharms.Features.TechShop/Postgres/Migrations/20260515055221_FixedLeadCustomerRelationship.Designer.cs index 9789b91..74a6cba 100644 --- a/LiteCharms.Features/Shop/Postgres/Migrations/20260515055221_FixedLeadCustomerRelationship.Designer.cs +++ b/LiteCharms.Features.TechShop/Postgres/Migrations/20260515055221_FixedLeadCustomerRelationship.Designer.cs @@ -1,6 +1,6 @@ // using System; -using LiteCharms.Features.Shop.Postgres; +using LiteCharms.Features.TechShop.Postgres; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; @@ -9,7 +9,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace LiteCharms.Features.Shop.Postgres.Migrations +namespace LiteCharms.Features.TechShop.Postgres.Migrations { [DbContext(typeof(ShopDbContext))] [Migration("20260515055221_FixedLeadCustomerRelationship")] diff --git a/LiteCharms.Features/Shop/Postgres/Migrations/20260515055221_FixedLeadCustomerRelationship.cs b/LiteCharms.Features.TechShop/Postgres/Migrations/20260515055221_FixedLeadCustomerRelationship.cs similarity index 99% rename from LiteCharms.Features/Shop/Postgres/Migrations/20260515055221_FixedLeadCustomerRelationship.cs rename to LiteCharms.Features.TechShop/Postgres/Migrations/20260515055221_FixedLeadCustomerRelationship.cs index 1d701f8..a15cd6f 100644 --- a/LiteCharms.Features/Shop/Postgres/Migrations/20260515055221_FixedLeadCustomerRelationship.cs +++ b/LiteCharms.Features.TechShop/Postgres/Migrations/20260515055221_FixedLeadCustomerRelationship.cs @@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace LiteCharms.Features.Shop.Postgres.Migrations +namespace LiteCharms.Features.TechShop.Postgres.Migrations { /// public partial class FixedLeadCustomerRelationship : Migration diff --git a/LiteCharms.Features/Shop/Postgres/Migrations/20260520191059_AddedProductMetadata.Designer.cs b/LiteCharms.Features.TechShop/Postgres/Migrations/20260520191059_AddedProductMetadata.Designer.cs similarity index 99% rename from LiteCharms.Features/Shop/Postgres/Migrations/20260520191059_AddedProductMetadata.Designer.cs rename to LiteCharms.Features.TechShop/Postgres/Migrations/20260520191059_AddedProductMetadata.Designer.cs index 7ac8666..82a7a0c 100644 --- a/LiteCharms.Features/Shop/Postgres/Migrations/20260520191059_AddedProductMetadata.Designer.cs +++ b/LiteCharms.Features.TechShop/Postgres/Migrations/20260520191059_AddedProductMetadata.Designer.cs @@ -1,7 +1,7 @@ // using System; -using LiteCharms.Features.Shop.Postgres; -using LiteCharms.Features.Shop.Products.Models; +using LiteCharms.Features.TechShop.Postgres; +using LiteCharms.Features.TechShop.Products.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; @@ -10,7 +10,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace LiteCharms.Features.Shop.Postgres.Migrations +namespace LiteCharms.Features.TechShop.Postgres.Migrations { [DbContext(typeof(ShopDbContext))] [Migration("20260520191059_AddedProductMetadata")] diff --git a/LiteCharms.Features/Shop/Postgres/Migrations/20260520191059_AddedProductMetadata.cs b/LiteCharms.Features.TechShop/Postgres/Migrations/20260520191059_AddedProductMetadata.cs similarity index 94% rename from LiteCharms.Features/Shop/Postgres/Migrations/20260520191059_AddedProductMetadata.cs rename to LiteCharms.Features.TechShop/Postgres/Migrations/20260520191059_AddedProductMetadata.cs index 142f394..64abe3b 100644 --- a/LiteCharms.Features/Shop/Postgres/Migrations/20260520191059_AddedProductMetadata.cs +++ b/LiteCharms.Features.TechShop/Postgres/Migrations/20260520191059_AddedProductMetadata.cs @@ -1,10 +1,10 @@ using System; -using LiteCharms.Features.Shop.Products.Models; +using LiteCharms.Features.TechShop.Products.Models; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable -namespace LiteCharms.Features.Shop.Postgres.Migrations +namespace LiteCharms.Features.TechShop.Postgres.Migrations { /// public partial class AddedProductMetadata : Migration diff --git a/LiteCharms.Features/Shop/Postgres/Migrations/ShopDbContextModelSnapshot.cs b/LiteCharms.Features.TechShop/Postgres/Migrations/ShopDbContextModelSnapshot.cs similarity index 99% rename from LiteCharms.Features/Shop/Postgres/Migrations/ShopDbContextModelSnapshot.cs rename to LiteCharms.Features.TechShop/Postgres/Migrations/ShopDbContextModelSnapshot.cs index 55c8c90..7fd9a00 100644 --- a/LiteCharms.Features/Shop/Postgres/Migrations/ShopDbContextModelSnapshot.cs +++ b/LiteCharms.Features.TechShop/Postgres/Migrations/ShopDbContextModelSnapshot.cs @@ -1,7 +1,7 @@ // using System; -using LiteCharms.Features.Shop.Postgres; -using LiteCharms.Features.Shop.Products.Models; +using LiteCharms.Features.TechShop.Postgres; +using LiteCharms.Features.TechShop.Products.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; @@ -9,7 +9,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace LiteCharms.Features.Shop.Postgres.Migrations +namespace LiteCharms.Features.TechShop.Postgres.Migrations { [DbContext(typeof(ShopDbContext))] partial class ShopDbContextModelSnapshot : ModelSnapshot diff --git a/LiteCharms.Features.TechShop/Postgres/ShopDbContext.cs b/LiteCharms.Features.TechShop/Postgres/ShopDbContext.cs new file mode 100644 index 0000000..d88c141 --- /dev/null +++ b/LiteCharms.Features.TechShop/Postgres/ShopDbContext.cs @@ -0,0 +1,39 @@ +using LiteCharms.Features.TechShop.CartPackages.Entities; +using LiteCharms.Features.TechShop.Customers.Entities; +using LiteCharms.Features.TechShop.Leads.Entities; +using LiteCharms.Features.TechShop.Notifications.Entities; +using LiteCharms.Features.TechShop.Orders.Entities; +using LiteCharms.Features.TechShop.Products.Entities; +using LiteCharms.Features.TechShop.Quotes.Entities; +using LiteCharms.Features.TechShop.ShoppingCarts.Entities; + +namespace LiteCharms.Features.TechShop.Postgres; + +public class ShopDbContext(DbContextOptions options) : DbContext(options) +{ + public DbSet Customers { get; set; } + + public DbSet Leads { get; set; } + + public DbSet Orders { get; set; } + + public DbSet OrderRefunds { get; set; } + + public DbSet Products { get; set; } + + public DbSet ProductPrices { get; set; } + + public DbSet Notifications { get; set; } + + public DbSet Quotes { get; set; } + + public DbSet ShoppingCarts { get; set; } + + public DbSet ShoppingCartItems { get; set; } + + public DbSet Packages { get; set; } + + public DbSet PackageItems { get; set; } + + public DbSet ShoppingCartPackages { get; set; } +} diff --git a/LiteCharms.Features/Shop/Postgres/ShopDbContextFactory.cs b/LiteCharms.Features.TechShop/Postgres/ShopDbContextFactory.cs similarity index 85% rename from LiteCharms.Features/Shop/Postgres/ShopDbContextFactory.cs rename to LiteCharms.Features.TechShop/Postgres/ShopDbContextFactory.cs index b8e61dc..e1e64fd 100644 --- a/LiteCharms.Features/Shop/Postgres/ShopDbContextFactory.cs +++ b/LiteCharms.Features.TechShop/Postgres/ShopDbContextFactory.cs @@ -1,6 +1,6 @@ -using static LiteCharms.Features.Extensions.Postgres; +using static LiteCharms.Features.TechShop.Extensions.Postgres; -namespace LiteCharms.Features.Shop.Postgres; +namespace LiteCharms.Features.TechShop.Postgres; public class ShopDbContextFactory : IDesignTimeDbContextFactory { diff --git a/LiteCharms.Features/Shop/Products/Entities/Product.cs b/LiteCharms.Features.TechShop/Products/Entities/Product.cs similarity index 74% rename from LiteCharms.Features/Shop/Products/Entities/Product.cs rename to LiteCharms.Features.TechShop/Products/Entities/Product.cs index a48774b..2131272 100644 --- a/LiteCharms.Features/Shop/Products/Entities/Product.cs +++ b/LiteCharms.Features.TechShop/Products/Entities/Product.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Products.Entities; +namespace LiteCharms.Features.TechShop.Products.Entities; [EntityTypeConfiguration] public class Product : Models.Product diff --git a/LiteCharms.Features/Shop/Products/Entities/ProductConfiguration.cs b/LiteCharms.Features.TechShop/Products/Entities/ProductConfiguration.cs similarity index 93% rename from LiteCharms.Features/Shop/Products/Entities/ProductConfiguration.cs rename to LiteCharms.Features.TechShop/Products/Entities/ProductConfiguration.cs index 6449acb..b35bbd1 100644 --- a/LiteCharms.Features/Shop/Products/Entities/ProductConfiguration.cs +++ b/LiteCharms.Features.TechShop/Products/Entities/ProductConfiguration.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Products.Entities; +namespace LiteCharms.Features.TechShop.Products.Entities; public class ProductConfiguration : IEntityTypeConfiguration { diff --git a/LiteCharms.Features/Shop/Products/Entities/ProductPrice.cs b/LiteCharms.Features.TechShop/Products/Entities/ProductPrice.cs similarity index 73% rename from LiteCharms.Features/Shop/Products/Entities/ProductPrice.cs rename to LiteCharms.Features.TechShop/Products/Entities/ProductPrice.cs index a711cae..cca5817 100644 --- a/LiteCharms.Features/Shop/Products/Entities/ProductPrice.cs +++ b/LiteCharms.Features.TechShop/Products/Entities/ProductPrice.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Products.Entities; +namespace LiteCharms.Features.TechShop.Products.Entities; [EntityTypeConfiguration] public class ProductPrice : Models.ProductPrice diff --git a/LiteCharms.Features/Shop/Products/Entities/ProductPriceConfiguration.cs b/LiteCharms.Features.TechShop/Products/Entities/ProductPriceConfiguration.cs similarity index 93% rename from LiteCharms.Features/Shop/Products/Entities/ProductPriceConfiguration.cs rename to LiteCharms.Features.TechShop/Products/Entities/ProductPriceConfiguration.cs index 265dc6a..658bd90 100644 --- a/LiteCharms.Features/Shop/Products/Entities/ProductPriceConfiguration.cs +++ b/LiteCharms.Features.TechShop/Products/Entities/ProductPriceConfiguration.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Products.Entities; +namespace LiteCharms.Features.TechShop.Products.Entities; public class ProductPriceConfiguration : IEntityTypeConfiguration { diff --git a/LiteCharms.Features/Shop/Products/Models/CreateProductModel.cs b/LiteCharms.Features.TechShop/Products/Models/CreateProductModel.cs similarity index 96% rename from LiteCharms.Features/Shop/Products/Models/CreateProductModel.cs rename to LiteCharms.Features.TechShop/Products/Models/CreateProductModel.cs index 355347e..c8bf92a 100644 --- a/LiteCharms.Features/Shop/Products/Models/CreateProductModel.cs +++ b/LiteCharms.Features.TechShop/Products/Models/CreateProductModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace LiteCharms.Features.Shop.Products.Models; +namespace LiteCharms.Features.TechShop.Products.Models; public class CreateProductModel { diff --git a/LiteCharms.Features/Shop/Products/Models/Product.cs b/LiteCharms.Features.TechShop/Products/Models/Product.cs similarity index 88% rename from LiteCharms.Features/Shop/Products/Models/Product.cs rename to LiteCharms.Features.TechShop/Products/Models/Product.cs index e4e10d2..b5fd71b 100644 --- a/LiteCharms.Features/Shop/Products/Models/Product.cs +++ b/LiteCharms.Features.TechShop/Products/Models/Product.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Products.Models; +namespace LiteCharms.Features.TechShop.Products.Models; public class Product { diff --git a/LiteCharms.Features/Shop/Products/Models/ProductMetadata.cs b/LiteCharms.Features.TechShop/Products/Models/ProductMetadata.cs similarity index 79% rename from LiteCharms.Features/Shop/Products/Models/ProductMetadata.cs rename to LiteCharms.Features.TechShop/Products/Models/ProductMetadata.cs index da56f1a..168f2bd 100644 --- a/LiteCharms.Features/Shop/Products/Models/ProductMetadata.cs +++ b/LiteCharms.Features.TechShop/Products/Models/ProductMetadata.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Products.Models; +namespace LiteCharms.Features.TechShop.Products.Models; public class ProductMetadata { diff --git a/LiteCharms.Features/Shop/Products/Models/ProductPrice.cs b/LiteCharms.Features.TechShop/Products/Models/ProductPrice.cs similarity index 84% rename from LiteCharms.Features/Shop/Products/Models/ProductPrice.cs rename to LiteCharms.Features.TechShop/Products/Models/ProductPrice.cs index fc1860c..0464df1 100644 --- a/LiteCharms.Features/Shop/Products/Models/ProductPrice.cs +++ b/LiteCharms.Features.TechShop/Products/Models/ProductPrice.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Products.Models; +namespace LiteCharms.Features.TechShop.Products.Models; public class ProductPrice { diff --git a/LiteCharms.Features/Shop/Products/Models/Records.cs b/LiteCharms.Features.TechShop/Products/Models/Records.cs similarity index 84% rename from LiteCharms.Features/Shop/Products/Models/Records.cs rename to LiteCharms.Features.TechShop/Products/Models/Records.cs index 8027e18..22b7dfb 100644 --- a/LiteCharms.Features/Shop/Products/Models/Records.cs +++ b/LiteCharms.Features.TechShop/Products/Models/Records.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Products.Models; +namespace LiteCharms.Features.TechShop.Products.Models; public record CreateProduct { diff --git a/LiteCharms.Features/Shop/Products/ProductService.cs b/LiteCharms.Features.TechShop/Products/ProductService.cs similarity index 98% rename from LiteCharms.Features/Shop/Products/ProductService.cs rename to LiteCharms.Features.TechShop/Products/ProductService.cs index 685fb5c..7c9eb83 100644 --- a/LiteCharms.Features/Shop/Products/ProductService.cs +++ b/LiteCharms.Features.TechShop/Products/ProductService.cs @@ -1,8 +1,8 @@ -using LiteCharms.Features.Extensions; -using LiteCharms.Features.Shop.Postgres; -using LiteCharms.Features.Shop.Products.Models; +using LiteCharms.Features.TechShop.Extensions; +using LiteCharms.Features.TechShop.Postgres; +using LiteCharms.Features.TechShop.Products.Models; -namespace LiteCharms.Features.Shop.Products; +namespace LiteCharms.Features.TechShop.Products; public class ProductService(IDbContextFactory contextFactory) { diff --git a/LiteCharms.Features/Shop/Quotes/Entities/Quote.cs b/LiteCharms.Features.TechShop/Quotes/Entities/Quote.cs similarity index 52% rename from LiteCharms.Features/Shop/Quotes/Entities/Quote.cs rename to LiteCharms.Features.TechShop/Quotes/Entities/Quote.cs index 4ea6dab..aa4ada3 100644 --- a/LiteCharms.Features/Shop/Quotes/Entities/Quote.cs +++ b/LiteCharms.Features.TechShop/Quotes/Entities/Quote.cs @@ -1,8 +1,8 @@ -using LiteCharms.Features.Shop.Customers.Entities; -using LiteCharms.Features.Shop.Orders.Entities; -using LiteCharms.Features.Shop.ShoppingCarts.Entities; +using LiteCharms.Features.TechShop.Customers.Entities; +using LiteCharms.Features.TechShop.Orders.Entities; +using LiteCharms.Features.TechShop.ShoppingCarts.Entities; -namespace LiteCharms.Features.Shop.Quotes.Entities; +namespace LiteCharms.Features.TechShop.Quotes.Entities; [EntityTypeConfiguration] public class Quote : Models.Quote diff --git a/LiteCharms.Features/Shop/Quotes/Entities/QuoteConfiguration.cs b/LiteCharms.Features.TechShop/Quotes/Entities/QuoteConfiguration.cs similarity index 95% rename from LiteCharms.Features/Shop/Quotes/Entities/QuoteConfiguration.cs rename to LiteCharms.Features.TechShop/Quotes/Entities/QuoteConfiguration.cs index 1363973..3dfdc12 100644 --- a/LiteCharms.Features/Shop/Quotes/Entities/QuoteConfiguration.cs +++ b/LiteCharms.Features.TechShop/Quotes/Entities/QuoteConfiguration.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Quotes.Entities; +namespace LiteCharms.Features.TechShop.Quotes.Entities; public class QuoteConfiguration : IEntityTypeConfiguration { diff --git a/LiteCharms.Features/Shop/Quotes/Models/Quote.cs b/LiteCharms.Features.TechShop/Quotes/Models/Quote.cs similarity index 88% rename from LiteCharms.Features/Shop/Quotes/Models/Quote.cs rename to LiteCharms.Features.TechShop/Quotes/Models/Quote.cs index 0b5ecaf..3effe97 100644 --- a/LiteCharms.Features/Shop/Quotes/Models/Quote.cs +++ b/LiteCharms.Features.TechShop/Quotes/Models/Quote.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.Quotes.Models; +namespace LiteCharms.Features.TechShop.Quotes.Models; public class Quote { diff --git a/LiteCharms.Features/Shop/Quotes/QuoteService.cs b/LiteCharms.Features.TechShop/Quotes/QuoteService.cs similarity index 96% rename from LiteCharms.Features/Shop/Quotes/QuoteService.cs rename to LiteCharms.Features.TechShop/Quotes/QuoteService.cs index c3de336..4e08bb8 100644 --- a/LiteCharms.Features/Shop/Quotes/QuoteService.cs +++ b/LiteCharms.Features.TechShop/Quotes/QuoteService.cs @@ -1,9 +1,10 @@ using LiteCharms.Features.Extensions; using LiteCharms.Features.Models; -using LiteCharms.Features.Shop.Postgres; -using LiteCharms.Features.Shop.Quotes.Models; +using LiteCharms.Features.TechShop.Extensions; +using LiteCharms.Features.TechShop.Postgres; +using LiteCharms.Features.TechShop.Quotes.Models; -namespace LiteCharms.Features.Shop.Quotes; +namespace LiteCharms.Features.TechShop.Quotes; public class QuoteService(IDbContextFactory contextFactory) { diff --git a/LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCart.cs b/LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCart.cs similarity index 66% rename from LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCart.cs rename to LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCart.cs index cfb4bd5..153962e 100644 --- a/LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCart.cs +++ b/LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCart.cs @@ -1,8 +1,8 @@ -using LiteCharms.Features.Shop.Customers.Entities; -using LiteCharms.Features.Shop.Orders.Entities; -using LiteCharms.Features.Shop.Quotes.Entities; +using LiteCharms.Features.TechShop.Customers.Entities; +using LiteCharms.Features.TechShop.Orders.Entities; +using LiteCharms.Features.TechShop.Quotes.Entities; -namespace LiteCharms.Features.Shop.ShoppingCarts.Entities; +namespace LiteCharms.Features.TechShop.ShoppingCarts.Entities; [EntityTypeConfiguration] public class ShoppingCart : Models.ShoppingCart diff --git a/LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCartConfiguration.cs b/LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCartConfiguration.cs similarity index 93% rename from LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCartConfiguration.cs rename to LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCartConfiguration.cs index 1609973..a59b01d 100644 --- a/LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCartConfiguration.cs +++ b/LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCartConfiguration.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.ShoppingCarts.Entities; +namespace LiteCharms.Features.TechShop.ShoppingCarts.Entities; public class ShoppingCartConfiguration : IEntityTypeConfiguration { diff --git a/LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCartItem.cs b/LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCartItem.cs similarity index 68% rename from LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCartItem.cs rename to LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCartItem.cs index b93d7da..5171b61 100644 --- a/LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCartItem.cs +++ b/LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCartItem.cs @@ -1,6 +1,6 @@ -using LiteCharms.Features.Shop.Products.Entities; +using LiteCharms.Features.TechShop.Products.Entities; -namespace LiteCharms.Features.Shop.ShoppingCarts.Entities; +namespace LiteCharms.Features.TechShop.ShoppingCarts.Entities; [EntityTypeConfiguration] public class ShoppingCartItem : Models.ShoppingCartItem diff --git a/LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCartItemConfiguration.cs b/LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCartItemConfiguration.cs similarity index 94% rename from LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCartItemConfiguration.cs rename to LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCartItemConfiguration.cs index 5670346..1e7b18a 100644 --- a/LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCartItemConfiguration.cs +++ b/LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCartItemConfiguration.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.ShoppingCarts.Entities; +namespace LiteCharms.Features.TechShop.ShoppingCarts.Entities; public class ShoppingCartItemConfiguration : IEntityTypeConfiguration { diff --git a/LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCartPackage.cs b/LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCartPackage.cs similarity index 67% rename from LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCartPackage.cs rename to LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCartPackage.cs index 4adf983..7745f4d 100644 --- a/LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCartPackage.cs +++ b/LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCartPackage.cs @@ -1,6 +1,6 @@ -using LiteCharms.Features.Shop.CartPackages.Entities; +using LiteCharms.Features.TechShop.CartPackages.Entities; -namespace LiteCharms.Features.Shop.ShoppingCarts.Entities; +namespace LiteCharms.Features.TechShop.ShoppingCarts.Entities; [EntityTypeConfiguration] public class ShoppingCartPackage : Models.ShoppingCartPackage diff --git a/LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCartPackageConfiguration.cs b/LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCartPackageConfiguration.cs similarity index 93% rename from LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCartPackageConfiguration.cs rename to LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCartPackageConfiguration.cs index d6dc310..43f88a6 100644 --- a/LiteCharms.Features/Shop/ShoppingCarts/Entities/ShoppingCartPackageConfiguration.cs +++ b/LiteCharms.Features.TechShop/ShoppingCarts/Entities/ShoppingCartPackageConfiguration.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.ShoppingCarts.Entities; +namespace LiteCharms.Features.TechShop.ShoppingCarts.Entities; public class ShoppingCartPackageConfiguration : IEntityTypeConfiguration { diff --git a/LiteCharms.Features/Shop/ShoppingCarts/Models/ShoppingCart.cs b/LiteCharms.Features.TechShop/ShoppingCarts/Models/ShoppingCart.cs similarity index 78% rename from LiteCharms.Features/Shop/ShoppingCarts/Models/ShoppingCart.cs rename to LiteCharms.Features.TechShop/ShoppingCarts/Models/ShoppingCart.cs index 46c52d0..0894a52 100644 --- a/LiteCharms.Features/Shop/ShoppingCarts/Models/ShoppingCart.cs +++ b/LiteCharms.Features.TechShop/ShoppingCarts/Models/ShoppingCart.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.ShoppingCarts.Models; +namespace LiteCharms.Features.TechShop.ShoppingCarts.Models; public class ShoppingCart { diff --git a/LiteCharms.Features/Shop/ShoppingCarts/Models/ShoppingCartItem.cs b/LiteCharms.Features.TechShop/ShoppingCarts/Models/ShoppingCartItem.cs similarity index 81% rename from LiteCharms.Features/Shop/ShoppingCarts/Models/ShoppingCartItem.cs rename to LiteCharms.Features.TechShop/ShoppingCarts/Models/ShoppingCartItem.cs index 99eeef6..e3760e4 100644 --- a/LiteCharms.Features/Shop/ShoppingCarts/Models/ShoppingCartItem.cs +++ b/LiteCharms.Features.TechShop/ShoppingCarts/Models/ShoppingCartItem.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.ShoppingCarts.Models; +namespace LiteCharms.Features.TechShop.ShoppingCarts.Models; public class ShoppingCartItem { diff --git a/LiteCharms.Features/Shop/ShoppingCarts/Models/ShoppingCartPackage.cs b/LiteCharms.Features.TechShop/ShoppingCarts/Models/ShoppingCartPackage.cs similarity index 76% rename from LiteCharms.Features/Shop/ShoppingCarts/Models/ShoppingCartPackage.cs rename to LiteCharms.Features.TechShop/ShoppingCarts/Models/ShoppingCartPackage.cs index a633be2..c040c5e 100644 --- a/LiteCharms.Features/Shop/ShoppingCarts/Models/ShoppingCartPackage.cs +++ b/LiteCharms.Features.TechShop/ShoppingCarts/Models/ShoppingCartPackage.cs @@ -1,4 +1,4 @@ -namespace LiteCharms.Features.Shop.ShoppingCarts.Models; +namespace LiteCharms.Features.TechShop.ShoppingCarts.Models; public class ShoppingCartPackage { diff --git a/LiteCharms.Features/Shop/ShoppingCarts/ShoppingCartService.cs b/LiteCharms.Features.TechShop/ShoppingCarts/ShoppingCartService.cs similarity index 98% rename from LiteCharms.Features/Shop/ShoppingCarts/ShoppingCartService.cs rename to LiteCharms.Features.TechShop/ShoppingCarts/ShoppingCartService.cs index d7eaf16..c8413a8 100644 --- a/LiteCharms.Features/Shop/ShoppingCarts/ShoppingCartService.cs +++ b/LiteCharms.Features.TechShop/ShoppingCarts/ShoppingCartService.cs @@ -1,8 +1,8 @@ -using LiteCharms.Features.Extensions; -using LiteCharms.Features.Shop.Postgres; -using LiteCharms.Features.Shop.ShoppingCarts.Models; +using LiteCharms.Features.TechShop.Extensions; +using LiteCharms.Features.TechShop.Postgres; +using LiteCharms.Features.TechShop.ShoppingCarts.Models; -namespace LiteCharms.Features.Shop.ShoppingCarts; +namespace LiteCharms.Features.TechShop.ShoppingCarts; public class ShoppingCartService(IDbContextFactory contextFactory) { diff --git a/LiteCharms.Features.TechShop/appsettings.json b/LiteCharms.Features.TechShop/appsettings.json new file mode 100644 index 0000000..aec5c2e --- /dev/null +++ b/LiteCharms.Features.TechShop/appsettings.json @@ -0,0 +1,22 @@ +{ + "Email": { + "Credentials": { + "Username": "shop@litecharms.co.za" + }, + "Port": 465, + "Host": "mail.litecharms.co.za", + "UseSsl": true + }, + "Monitoring": { + "ApiKey": "", + "Address": "http://aspire-dashboard-service.aspire.svc.cluster.local:18889", + "ServiceName": "LiteCharms.LeadGenerator" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/LiteCharms.Features.Tests/CommonFixture.cs b/LiteCharms.Features.Tests/Fixture.cs similarity index 81% rename from LiteCharms.Features.Tests/CommonFixture.cs rename to LiteCharms.Features.Tests/Fixture.cs index b9085c4..466d0a0 100644 --- a/LiteCharms.Features.Tests/CommonFixture.cs +++ b/LiteCharms.Features.Tests/Fixture.cs @@ -2,7 +2,7 @@ namespace LiteCharms.Features.Tests; -public class CommonFixture : IDisposable +public class Fixture : IDisposable { public IConfiguration Configuration { get; set; } @@ -10,22 +10,20 @@ public class CommonFixture : IDisposable public IMediator Mediator { get; set; } - public CommonFixture() + public Fixture() { Configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) - .AddUserSecrets() + .AddUserSecrets() .AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json"), optional: true, reloadOnChange: true) .AddEnvironmentVariables() .Build(); Services = new ServiceCollection() .AddMediator() - .AddLogging() - .AddShopServices() + .AddLogging() .AddEmailServiceBus() .AddGarageS3(Configuration) - .AddShopDatabase(Configuration) .AddEmailServices(Configuration) .AddSingleton(Configuration) .BuildServiceProvider(); diff --git a/LiteCharms.Features.Tests/S3ServiceFeatureTests.cs b/LiteCharms.Features.Tests/S3ServiceFeatureTests.cs index 3697a7a..8af9a34 100644 --- a/LiteCharms.Features.Tests/S3ServiceFeatureTests.cs +++ b/LiteCharms.Features.Tests/S3ServiceFeatureTests.cs @@ -2,7 +2,7 @@ namespace LiteCharms.Features.Tests; -public class S3ServiceFeatureTests(CommonFixture fixture, ITestOutputHelper output) : IClassFixture +public class S3ServiceFeatureTests(Fixture fixture, ITestOutputHelper output) : IClassFixture { [Fact] public async Task BookshopS3Service_MustReturnUrl() diff --git a/LiteCharms.Features/Email/EmailService.cs b/LiteCharms.Features/Email/EmailService.cs index 72c5665..28c38e0 100644 --- a/LiteCharms.Features/Email/EmailService.cs +++ b/LiteCharms.Features/Email/EmailService.cs @@ -1,7 +1,6 @@ using LiteCharms.Features.Email.Configuration; using LiteCharms.Features.Email.Extensions; using LiteCharms.Features.Email.Models; -using LiteCharms.Features.Shop; namespace LiteCharms.Features.Email; diff --git a/LiteCharms.Features/Email/Models/Response.cs b/LiteCharms.Features/Email/Models/Response.cs index 4474d9e..6bc1c49 100644 --- a/LiteCharms.Features/Email/Models/Response.cs +++ b/LiteCharms.Features/Email/Models/Response.cs @@ -1,6 +1,4 @@ -using LiteCharms.Features.Shop; - -namespace LiteCharms.Features.Email.Models; +namespace LiteCharms.Features.Email.Models; public class Response { diff --git a/LiteCharms.Features/Enums.cs b/LiteCharms.Features/Enums.cs new file mode 100644 index 0000000..29a915f --- /dev/null +++ b/LiteCharms.Features/Enums.cs @@ -0,0 +1,20 @@ +namespace LiteCharms.Features; + +public enum EmailStatuses : int +{ + GeneralError = 0, + AuthenticationError = 1, + ProtocolError = 2, + Connected = 3, + Disconnected = 4, + TooManyConnections = 5, + ConnectionAborted = 6, + Success = 7 +} + +public enum Priorities : int +{ + Low = 0, + Medium = 1, + High = 2, +} \ No newline at end of file diff --git a/LiteCharms.Features/Extensions/HealthChecks.cs b/LiteCharms.Features/Extensions/HealthChecks.cs index f27502a..2b9ab08 100644 --- a/LiteCharms.Features/Extensions/HealthChecks.cs +++ b/LiteCharms.Features/Extensions/HealthChecks.cs @@ -5,13 +5,6 @@ namespace LiteCharms.Features.Extensions; public static class HealthChecks { - public static IServiceCollection AddShopQuartzHealthCheck(this IServiceCollection services) - { - services.AddHealthChecks().AddCheck("ShopQuartz"); - - return services; - } - public static IServiceCollection AddMidrandShopQuartzHealthCheck(this IServiceCollection services) { services.AddHealthChecks().AddCheck("MidrandShopQuartz"); @@ -19,13 +12,6 @@ public static class HealthChecks return services; } - public static IServiceCollection AddShopPostgresHealthCheck(this IServiceCollection services) - { - services.AddHealthChecks().AddCheck(ShopDbConfigName); - - return services; - } - public static IServiceCollection AddMidrandShopPostgresHealthCheck(this IServiceCollection services) { services.AddHealthChecks().AddCheck(MidrandShopDbConfigName); diff --git a/LiteCharms.Features/Extensions/Postgres.cs b/LiteCharms.Features/Extensions/Postgres.cs index 982f5f9..549c5a0 100644 --- a/LiteCharms.Features/Extensions/Postgres.cs +++ b/LiteCharms.Features/Extensions/Postgres.cs @@ -1,22 +1,12 @@ using LiteCharms.Features.MidrandShop.Postgres; -using LiteCharms.Features.Shop.Postgres; namespace LiteCharms.Features.Extensions; public static class Postgres { public const string MidrandShopDbConfigName = "PostgresMidrandShop"; - public const string ShopDbConfigName = "PostgresShop"; public const string SchedulerDbConfigName = "PostgresScheduler"; - public static IServiceCollection AddShopDatabase(this IServiceCollection services, IConfiguration configuration) - { - services.AddPooledDbContextFactory(options => - options.UseNpgsql(configuration.GetConnectionString(ShopDbConfigName))); - - return services; - } - public static IServiceCollection AddMidrandShopDatabase(this IServiceCollection services, IConfiguration configuration) { services.AddPooledDbContextFactory(options => diff --git a/LiteCharms.Features/Extensions/Shop.cs b/LiteCharms.Features/Extensions/Shop.cs deleted file mode 100644 index 78502de..0000000 --- a/LiteCharms.Features/Extensions/Shop.cs +++ /dev/null @@ -1,27 +0,0 @@ -using LiteCharms.Features.Shop.CartPackages; -using LiteCharms.Features.Shop.Customers; -using LiteCharms.Features.Shop.Leads; -using LiteCharms.Features.Shop.Notifications; -using LiteCharms.Features.Shop.Orders; -using LiteCharms.Features.Shop.Products; -using LiteCharms.Features.Shop.Quotes; -using LiteCharms.Features.Shop.ShoppingCarts; - -namespace LiteCharms.Features.Extensions; - -public static class Shop -{ - public static IServiceCollection AddShopServices(this IServiceCollection services) - { - services.AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton(); - - return services; - } -} diff --git a/LiteCharms.Features/LiteCharms.Features.csproj b/LiteCharms.Features/LiteCharms.Features.csproj index 99f18de..41d7dcf 100644 --- a/LiteCharms.Features/LiteCharms.Features.csproj +++ b/LiteCharms.Features/LiteCharms.Features.csproj @@ -160,8 +160,5 @@ PreserveNewest - - - diff --git a/LiteCharms.Features/Shop/Postgres/ShopDbContext.cs b/LiteCharms.Features/Shop/Postgres/ShopDbContext.cs deleted file mode 100644 index b8d7cc9..0000000 --- a/LiteCharms.Features/Shop/Postgres/ShopDbContext.cs +++ /dev/null @@ -1,69 +0,0 @@ -using LiteCharms.Features.Shop.CartPackages.Entities; -using LiteCharms.Features.Shop.Customers.Entities; -using LiteCharms.Features.Shop.Leads.Entities; -using LiteCharms.Features.Shop.Notifications.Entities; -using LiteCharms.Features.Shop.Orders.Entities; -using LiteCharms.Features.Shop.Products.Entities; -using LiteCharms.Features.Shop.Quotes.Entities; -using LiteCharms.Features.Shop.ShoppingCarts.Entities; - -namespace LiteCharms.Features.Shop.Postgres; - -public class ShopDbContext(DbContextOptions options) : DbContext(options) -{ - public DbSet Customers { get; set; } - - public DbSet Leads { get; set; } - - public DbSet Orders { get; set; } - - public DbSet OrderRefunds { get; set; } - - public DbSet Products { get; set; } - - public DbSet ProductPrices { get; set; } - - public DbSet Notifications { get; set; } - - public DbSet Quotes { get; set; } - - public DbSet ShoppingCarts { get; set; } - - public DbSet ShoppingCartItems { get; set; } - - public DbSet Packages { get; set; } - - public DbSet PackageItems { get; set; } - - public DbSet ShoppingCartPackages { get; set; } - - //protected override void OnModelCreating(ModelBuilder modelBuilder) - //{ - // modelBuilder.Ignore(); - // modelBuilder.Ignore(); - // modelBuilder.Ignore(); - // modelBuilder.Ignore(); - // modelBuilder.Ignore(); - // modelBuilder.Ignore(); - // modelBuilder.Ignore(); - // modelBuilder.Ignore(); - // modelBuilder.Ignore(); - // modelBuilder.Ignore(); - // modelBuilder.Ignore(); - - // modelBuilder.ApplyConfiguration(new CustomerConfiguration()); - // modelBuilder.ApplyConfiguration(new LeadConfiguration()); - // modelBuilder.ApplyConfiguration(new OrderConfiguration()); - // modelBuilder.ApplyConfiguration(new ProductConfiguration()); - // modelBuilder.ApplyConfiguration(new ProductPriceConfiguration()); - // modelBuilder.ApplyConfiguration(new NotificationConfiguration()); - // modelBuilder.ApplyConfiguration(new QuoteConfiguration()); - // modelBuilder.ApplyConfiguration(new ShoppingCartConfiguration()); - // modelBuilder.ApplyConfiguration(new ShoppingCartItemConfiguration()); - // modelBuilder.ApplyConfiguration(new PackageConfirguration()); - // modelBuilder.ApplyConfiguration(new PackageItemConfiguration()); - // modelBuilder.ApplyConfiguration(new ShoppingCartPackageConfiguration()); - - // base.OnModelCreating(modelBuilder); - //} -} diff --git a/LiteCharmsShared.slnx b/LiteCharmsShared.slnx index 21e11b6..a8a890a 100644 --- a/LiteCharmsShared.slnx +++ b/LiteCharmsShared.slnx @@ -2,6 +2,8 @@ + +