Merge pull request 'Refactored database references' (#9) from develop into master
Reviewed-on: #9
This commit was merged in pull request #9.
This commit is contained in:
@@ -4,8 +4,8 @@ public static class Constants
|
||||
{
|
||||
public const int QueueBounds = 100000;
|
||||
|
||||
public const string LeadGeneratorSchedulerName = "leadgenerator";
|
||||
public const string LeadGeneratorSchedulerInstanceId = "golden-dawn";
|
||||
public const string ShopSchedulerName = "shop";
|
||||
public const string ShopSchedulerInstanceId = "golden-dawn";
|
||||
|
||||
public const string EmailServiceBus = nameof(EmailServiceBus);
|
||||
public const string GeneralServiceBus = nameof(GeneralServiceBus);
|
||||
|
||||
@@ -6,7 +6,7 @@ public static class Postgres
|
||||
{
|
||||
public static IServiceCollection AddLeadGeneratorDatabase(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
services.AddPooledDbContextFactory<LeadGeneratorDbContext>(options =>
|
||||
services.AddPooledDbContextFactory<ShopDbContext>(options =>
|
||||
options.UseNpgsql(configuration.GetConnectionString("PostgresLeadGenerator")));
|
||||
|
||||
return services;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Features.Customers.Commands.Handlers;
|
||||
|
||||
public class CreateCustomerCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<CreateCustomerCommand, Result<Guid>>
|
||||
public class CreateCustomerCommandHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<CreateCustomerCommand, Result<Guid>>
|
||||
{
|
||||
public async ValueTask<Result<Guid>> Handle(CreateCustomerCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Features.Customers.Commands.Handlers;
|
||||
|
||||
public class UpdateCustomerCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<UpdateCustomerCommand, Result>
|
||||
public class UpdateCustomerCommandHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<UpdateCustomerCommand, Result>
|
||||
{
|
||||
public async ValueTask<Result> Handle(UpdateCustomerCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Customers.Queries.Handlers;
|
||||
|
||||
public class GetCustomerQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetCustomerQuery, Result<Customer>>
|
||||
public class GetCustomerQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetCustomerQuery, Result<Customer>>
|
||||
{
|
||||
public async ValueTask<Result<Customer>> Handle(GetCustomerQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Customers.Queries.Handlers;
|
||||
|
||||
public class GetCustomersQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetCustomersQuery, Result<Customer[]>>
|
||||
public class GetCustomersQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetCustomersQuery, Result<Customer[]>>
|
||||
{
|
||||
public async ValueTask<Result<Customer[]>> Handle(GetCustomersQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ using LiteCharms.Infrastructure.Database;
|
||||
|
||||
namespace LiteCharms.Features.Leads.Commands.Handlers;
|
||||
|
||||
public class CreateLeadCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory, ISender mediator) : IRequestHandler<CreateLeadCommand, Result<Guid>>
|
||||
public class CreateLeadCommandHandler(IDbContextFactory<ShopDbContext> contextFactory, ISender mediator) : IRequestHandler<CreateLeadCommand, Result<Guid>>
|
||||
{
|
||||
public async ValueTask<Result<Guid>> Handle(CreateLeadCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Features.Leads.Commands.Handlers;
|
||||
|
||||
public class UpdateLeadCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<UpdateLeadCommand, Result>
|
||||
public class UpdateLeadCommandHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<UpdateLeadCommand, Result>
|
||||
{
|
||||
public async ValueTask<Result> Handle(UpdateLeadCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Leads.Queries.Handlers;
|
||||
|
||||
public class GetCustomerLeadsQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetCustomerLeadsQuery, Result<Lead[]>>
|
||||
public class GetCustomerLeadsQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetCustomerLeadsQuery, Result<Lead[]>>
|
||||
{
|
||||
public async ValueTask<Result<Lead[]>> Handle(GetCustomerLeadsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Leads.Queries.Handlers;
|
||||
|
||||
public class GetLeadsQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetLeadsQuery, Result<Lead[]>>
|
||||
public class GetLeadsQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetLeadsQuery, Result<Lead[]>>
|
||||
{
|
||||
public async ValueTask<Result<Lead[]>> Handle(GetLeadsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Features.Notifications.Commands.Handlers;
|
||||
|
||||
public class CreateNotificationCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<CreateNotificationCommand, Result<Guid>>
|
||||
public class CreateNotificationCommandHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<CreateNotificationCommand, Result<Guid>>
|
||||
{
|
||||
public async ValueTask<Result<Guid>> Handle(CreateNotificationCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Features.Notifications.Commands.Handlers;
|
||||
|
||||
public class UpdateNotificationCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<UpdateNotificationCommand, Result>
|
||||
public class UpdateNotificationCommandHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<UpdateNotificationCommand, Result>
|
||||
{
|
||||
public async ValueTask<Result> Handle(UpdateNotificationCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Notifications.Queries.Handlers;
|
||||
|
||||
public class GetNotificationQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetNotificationQuery, Result<Notification>>
|
||||
public class GetNotificationQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetNotificationQuery, Result<Notification>>
|
||||
{
|
||||
public async ValueTask<Result<Notification>> Handle(GetNotificationQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Notifications.Queries.Handlers;
|
||||
|
||||
public class GetNotificationsQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetNotificationsQuery, Result<Notification[]>>
|
||||
public class GetNotificationsQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetNotificationsQuery, Result<Notification[]>>
|
||||
{
|
||||
public async ValueTask<Result<Notification[]>> Handle(GetNotificationsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Features.Orders.Commands.Handlers;
|
||||
|
||||
public class CreateOrderCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<CreateOrderCommand, Result<Guid>>
|
||||
public class CreateOrderCommandHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<CreateOrderCommand, Result<Guid>>
|
||||
{
|
||||
public async ValueTask<Result<Guid>> Handle(CreateOrderCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Features.Orders.Commands.Handlers;
|
||||
|
||||
public class UpdateOrderStatusCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<UpdateOrderStatusCommand, Result>
|
||||
public class UpdateOrderStatusCommandHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<UpdateOrderStatusCommand, Result>
|
||||
{
|
||||
public async ValueTask<Result> Handle(UpdateOrderStatusCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Orders.Queries.Handlers;
|
||||
|
||||
public class GetCustomerOrdersQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetCustomerOrdersQuery, Result<Order[]>>
|
||||
public class GetCustomerOrdersQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetCustomerOrdersQuery, Result<Order[]>>
|
||||
{
|
||||
public async ValueTask<Result<Order[]>> Handle(GetCustomerOrdersQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Orders.Queries.Handlers;
|
||||
|
||||
public class GetOrderRefundQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetOrderRefundQuery, Result<OrderRefund>>
|
||||
public class GetOrderRefundQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetOrderRefundQuery, Result<OrderRefund>>
|
||||
{
|
||||
public async ValueTask<Result<OrderRefund>> Handle(GetOrderRefundQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Orders.Queries.Handlers;
|
||||
|
||||
public class GetOrdersQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetOrdersQuery, Result<Order[]>>
|
||||
public class GetOrdersQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetOrdersQuery, Result<Order[]>>
|
||||
{
|
||||
public async ValueTask<Result<Order[]>> Handle(GetOrdersQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Products.Queries.Handlers;
|
||||
|
||||
public class GetProductPriceQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetProductPriceQuery, Result<ProductPrice>>
|
||||
public class GetProductPriceQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetProductPriceQuery, Result<ProductPrice>>
|
||||
{
|
||||
public async ValueTask<Result<ProductPrice>> Handle(GetProductPriceQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Products.Queries.Handlers;
|
||||
|
||||
public class GetProductPricesQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetProductPricesQuery, Result<ProductPrice[]>>
|
||||
public class GetProductPricesQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetProductPricesQuery, Result<ProductPrice[]>>
|
||||
{
|
||||
public async ValueTask<Result<ProductPrice[]>> Handle(GetProductPricesQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Products.Queries.Handlers;
|
||||
|
||||
public class GetProductQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetProductQuery, Result<Product>>
|
||||
public class GetProductQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetProductQuery, Result<Product>>
|
||||
{
|
||||
public async ValueTask<Result<Product>> Handle(GetProductQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Products.Queries.Handlers;
|
||||
|
||||
public class GetProductsQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetProductsQuery, Result<Product[]>>
|
||||
public class GetProductsQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetProductsQuery, Result<Product[]>>
|
||||
{
|
||||
public async ValueTask<Result<Product[]>> Handle(GetProductsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Features.Quotes.Commands.Handlers;
|
||||
|
||||
public class AssignQuoteToOrderCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<AssignQuoteToOrderCommand, Result>
|
||||
public class AssignQuoteToOrderCommandHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<AssignQuoteToOrderCommand, Result>
|
||||
{
|
||||
public async ValueTask<Result> Handle(AssignQuoteToOrderCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Features.Quotes.Commands.Handlers;
|
||||
|
||||
public class AssignQuoteToShoppingCartCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<AssignQuoteToShoppingCartCommand, Result>
|
||||
public class AssignQuoteToShoppingCartCommandHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<AssignQuoteToShoppingCartCommand, Result>
|
||||
{
|
||||
public async ValueTask<Result> Handle(AssignQuoteToShoppingCartCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Features.Quotes.Commands.Handlers;
|
||||
|
||||
public class UpdateQuoteStatusCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<UpdateQuoteStatusCommand, Result>
|
||||
public class UpdateQuoteStatusCommandHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<UpdateQuoteStatusCommand, Result>
|
||||
{
|
||||
public async ValueTask<Result> Handle(UpdateQuoteStatusCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Quotes.Queries.Handlers;
|
||||
|
||||
public class GetCustomerQuotesQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetCustomerQuotesQuery, Result<Quote[]>>
|
||||
public class GetCustomerQuotesQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetCustomerQuotesQuery, Result<Quote[]>>
|
||||
{
|
||||
public async ValueTask<Result<Quote[]>> Handle(GetCustomerQuotesQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Quotes.Queries.Handlers;
|
||||
|
||||
public class GetQuoteQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetQuoteQuery, Result<Quote>>
|
||||
public class GetQuoteQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetQuoteQuery, Result<Quote>>
|
||||
{
|
||||
public async ValueTask<Result<Quote>> Handle(GetQuoteQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Quotes.Queries.Handlers;
|
||||
|
||||
public class GetQuotesHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetQuotesQuery, Result<Quote[]>>
|
||||
public class GetQuotesHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetQuotesQuery, Result<Quote[]>>
|
||||
{
|
||||
public async ValueTask<Result<Quote[]>> Handle(GetQuotesQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Features.Refunds.Commands.Handlers;
|
||||
|
||||
public class RefundCustomerCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<RefundCustomerCommand, Result<Guid>>
|
||||
public class RefundCustomerCommandHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<RefundCustomerCommand, Result<Guid>>
|
||||
{
|
||||
public async ValueTask<Result<Guid>> Handle(RefundCustomerCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Features.Refunds.Commands.Handlers;
|
||||
|
||||
public class UpdateOrderRefundCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<UpdateOrderRefundCommand, Result>
|
||||
public class UpdateOrderRefundCommandHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<UpdateOrderRefundCommand, Result>
|
||||
{
|
||||
public async ValueTask<Result> Handle(UpdateOrderRefundCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Refunds.Queries.Handlers;
|
||||
|
||||
public class GetCustomerRefundsQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetCustomerRefundsQuery, Result<OrderRefund[]>>
|
||||
public class GetCustomerRefundsQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetCustomerRefundsQuery, Result<OrderRefund[]>>
|
||||
{
|
||||
public async ValueTask<Result<OrderRefund[]>> Handle(GetCustomerRefundsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.Refunds.Queries.Handlers;
|
||||
|
||||
public class GetRefundQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetRefundQuery, Result<OrderRefund>>
|
||||
public class GetRefundQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetRefundQuery, Result<OrderRefund>>
|
||||
{
|
||||
public async ValueTask<Result<OrderRefund>> Handle(GetRefundQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Features.ShoppingCarts.Commands.Handlers;
|
||||
|
||||
public class AddItemToShoppingCartCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<AddItemToShoppingCartCommand, Result>
|
||||
public class AddItemToShoppingCartCommandHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<AddItemToShoppingCartCommand, Result>
|
||||
{
|
||||
public async ValueTask<Result> Handle(AddItemToShoppingCartCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Features.ShoppingCarts.Commands.Handlers;
|
||||
|
||||
public class CreateShoppingCartCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<CreateShoppingCartCommand, Result<Guid>>
|
||||
public class CreateShoppingCartCommandHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<CreateShoppingCartCommand, Result<Guid>>
|
||||
{
|
||||
public async ValueTask<Result<Guid>> Handle(CreateShoppingCartCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Features.ShoppingCarts.Commands.Handlers;
|
||||
|
||||
public class EmptyShoppingCartCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<EmptyShoppingCartCommand, Result>
|
||||
public class EmptyShoppingCartCommandHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<EmptyShoppingCartCommand, Result>
|
||||
{
|
||||
public async ValueTask<Result> Handle(EmptyShoppingCartCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Features.ShoppingCarts.Commands.Handlers;
|
||||
|
||||
public class RemoveShoppingCartItemCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<RemoveShoppingCartItemCommand, Result>
|
||||
public class RemoveShoppingCartItemCommandHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<RemoveShoppingCartItemCommand, Result>
|
||||
{
|
||||
public async ValueTask<Result> Handle(RemoveShoppingCartItemCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Features.ShoppingCarts.Commands.Handlers;
|
||||
|
||||
public class UpdateShoppingCartItemCommandHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<UpdateShoppingCartItemCommand, Result>
|
||||
public class UpdateShoppingCartItemCommandHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<UpdateShoppingCartItemCommand, Result>
|
||||
{
|
||||
public async ValueTask<Result> Handle(UpdateShoppingCartItemCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.ShoppingCarts.Queries.Handlers;
|
||||
|
||||
public class GetCustomerShoppingCartsQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetCustomerShoppingCartsQuery, Result<ShoppingCart[]>>
|
||||
public class GetCustomerShoppingCartsQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetCustomerShoppingCartsQuery, Result<ShoppingCart[]>>
|
||||
{
|
||||
public async ValueTask<Result<ShoppingCart[]>> Handle(GetCustomerShoppingCartsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.ShoppingCarts.Queries.Handlers;
|
||||
|
||||
public class GetShoppingCartItemsQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetShoppingCartItemsQuery, Result<ShoppingCartItem[]>>
|
||||
public class GetShoppingCartItemsQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetShoppingCartItemsQuery, Result<ShoppingCartItem[]>>
|
||||
{
|
||||
public async ValueTask<Result<ShoppingCartItem[]>> Handle(GetShoppingCartItemsQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ using LiteCharms.Models;
|
||||
|
||||
namespace LiteCharms.Features.ShoppingCarts.Queries.Handlers;
|
||||
|
||||
public class GetShoppingCartQueryHandler(IDbContextFactory<LeadGeneratorDbContext> contextFactory) : IRequestHandler<GetShoppingCartQuery, Result<ShoppingCart>>
|
||||
public class GetShoppingCartQueryHandler(IDbContextFactory<ShopDbContext> contextFactory) : IRequestHandler<GetShoppingCartQuery, Result<ShoppingCart>>
|
||||
{
|
||||
public async ValueTask<Result<ShoppingCart>> Handle(GetShoppingCartQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
namespace LiteCharms.Infrastructure.Database;
|
||||
|
||||
public class LeadGeneratorDbContextFactory : IDesignTimeDbContextFactory<LeadGeneratorDbContext>
|
||||
{
|
||||
public LeadGeneratorDbContext CreateDbContext(string[] args)
|
||||
{
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddUserSecrets(typeof(LeadGeneratorDbContext).Assembly)
|
||||
.AddJsonFile("appsettings.json")
|
||||
.AddEnvironmentVariables()
|
||||
.Build();
|
||||
|
||||
var optionsBuilder = new DbContextOptionsBuilder<LeadGeneratorDbContext>();
|
||||
optionsBuilder.UseNpgsql(configuration.GetConnectionString("PostgresLeadGenerator"));
|
||||
|
||||
return new LeadGeneratorDbContext(optionsBuilder.Options);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260502231708_Init")]
|
||||
partial class Init
|
||||
{
|
||||
|
||||
Generated
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260503002123_DefinedEntityRelationships")]
|
||||
partial class DefinedEntityRelationships
|
||||
{
|
||||
|
||||
Generated
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260503003624_RemovedLeadIdFromLead")]
|
||||
partial class RemovedLeadIdFromLead
|
||||
{
|
||||
|
||||
Generated
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260503012708_AddedStatusToLead")]
|
||||
partial class AddedStatusToLead
|
||||
{
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260503133855_CorrectedAttributionHashColumnOnLead")]
|
||||
partial class CorrectedAttributionHashColumnOnLead
|
||||
{
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260505120450_GeneralisedLead")]
|
||||
partial class GeneralisedLead
|
||||
{
|
||||
|
||||
Generated
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260505123745_AddedNotifications")]
|
||||
partial class AddedNotifications
|
||||
{
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260505124135_AddedProcessedColumnToNotifications")]
|
||||
partial class AddedProcessedColumnToNotifications
|
||||
{
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
[Migration("20260505202859_AddedQuoteShoppingCartalteredOrderCustomer")]
|
||||
partial class AddedQuoteShoppingCartalteredOrderCustomer
|
||||
{
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
namespace LiteCharms.Infrastructure.Migrations
|
||||
{
|
||||
[DbContext(typeof(LeadGeneratorDbContext))]
|
||||
[DbContext(typeof(ShopDbContext))]
|
||||
partial class LeadGeneratorDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace LiteCharms.Infrastructure.Database;
|
||||
|
||||
public class LeadGeneratorDbContext(DbContextOptions<LeadGeneratorDbContext> options) : DbContext(options)
|
||||
public class ShopDbContext(DbContextOptions<ShopDbContext> options) : DbContext(options)
|
||||
{
|
||||
public DbSet<Customer> Customers { get; set; }
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace LiteCharms.Infrastructure.Database;
|
||||
|
||||
public class ShopDbContextFactory : IDesignTimeDbContextFactory<ShopDbContext>
|
||||
{
|
||||
public ShopDbContext CreateDbContext(string[] args)
|
||||
{
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddUserSecrets(typeof(ShopDbContext).Assembly)
|
||||
.AddJsonFile("appsettings.json")
|
||||
.AddEnvironmentVariables()
|
||||
.Build();
|
||||
|
||||
var optionsBuilder = new DbContextOptionsBuilder<ShopDbContext>();
|
||||
optionsBuilder.UseNpgsql(configuration.GetConnectionString("PostgresShop"));
|
||||
|
||||
return new ShopDbContext(optionsBuilder.Options);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
public class PostgresHealthCheck(IConfiguration configuration) : IHealthCheck
|
||||
{
|
||||
private readonly string connectionString = configuration.GetConnectionString("PostgresLeadGenerator")!;
|
||||
private readonly string connectionString = configuration.GetConnectionString("PostgresShop")!;
|
||||
|
||||
public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user