-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tenantIdentityModule serverExecutionBase
- Loading branch information
1 parent
2d577c9
commit 9ae1248
Showing
20 changed files
with
90 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 11 additions & 1 deletion
12
Source/Modules/Subscriptions/Features/SubscriptionsModule.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,20 @@ | ||
using Shared.Features.Modules; | ||
using Modules.Subscription.Features.Infrastructure.Configuration; | ||
using Modules.Subscription.Features.Infrastructure.EFCore; | ||
using Shared.Features.Modules; | ||
using System.Reflection; | ||
|
||
namespace Modules.Subscriptions.Features | ||
{ | ||
public class SubscriptionsModule : IModule | ||
{ | ||
public Assembly FeaturesAssembly => typeof(SubscriptionsModule).Assembly; | ||
public SubscriptionsConfiguration SubscriptionsConfiguration { get; set; } | ||
public SubscriptionsDbContext SubscriptionsDbContext { get; set; } | ||
|
||
public SubscriptionsModule(SubscriptionsConfiguration configuration, SubscriptionsDbContext dbContext) | ||
{ | ||
SubscriptionsConfiguration = configuration; | ||
SubscriptionsDbContext = dbContext; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 5 additions & 10 deletions
15
...gregate/Application/IntegrationEvents/TenantSubscriptionUpdatedIntegrationEventHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,21 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using Modules.Subscriptions.IntegrationEvents; | ||
using Modules.TenantIdentity.Features.Infrastructure.EFCore; | ||
using Shared.Features.Messaging.IntegrationEvent; | ||
using Shared.Features.Server; | ||
using System.Threading; | ||
|
||
namespace Modules.TenantIdentity.Features.DomainFeatures.TenantAggregate.Application.IntegrationEvents | ||
{ | ||
public class TenantSubscriptionUpdatedIntegrationEventHandler : IIntegrationEventHandler<TenantSubscriptionPlanUpdatedIntegrationEvent> | ||
public class TenantSubscriptionUpdatedIntegrationEventHandler : ServerExecutionBase<TenantIdentityModule>, IIntegrationEventHandler<TenantSubscriptionPlanUpdatedIntegrationEvent> | ||
{ | ||
private readonly TenantIdentityDbContext tenantIdentityDbContext; | ||
|
||
public TenantSubscriptionUpdatedIntegrationEventHandler(TenantIdentityDbContext tenantIdentityDbContext) | ||
{ | ||
this.tenantIdentityDbContext = tenantIdentityDbContext; | ||
} | ||
public TenantSubscriptionUpdatedIntegrationEventHandler(IServiceProvider serviceProvider) : base(serviceProvider) { } | ||
|
||
public async Task HandleAsync(TenantSubscriptionPlanUpdatedIntegrationEvent integrationEvent, CancellationToken cancellation) | ||
{ | ||
var tenant = await tenantIdentityDbContext.Tenants.FirstAsync(tenant => tenant.Id == integrationEvent.TenantId); | ||
var tenant = await module.TenantIdentityDbContext.Tenants.FirstAsync(tenant => tenant.Id == integrationEvent.TenantId); | ||
tenant.SubscriptionPlanType = integrationEvent.SubscriptionPlanType; | ||
|
||
await tenantIdentityDbContext.SaveChangesAsync(); | ||
await module.TenantIdentityDbContext.SaveChangesAsync(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.