Skip to content

Commit

Permalink
userClaimsprincipal Factory
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidEggenberger committed Jan 1, 2024
1 parent fe936a7 commit 2d7a242
Show file tree
Hide file tree
Showing 49 changed files with 444 additions and 367 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Modules.TenantIdentity.IntegrationEvents;
using Shared.Features.CQRS.IntegrationEvent;

namespace Modules.Subscriptions.Features.Agregates.StripeCustomerAggregate.Aplication.IntegrationEventHandlers
{
public class UserCreatedIntegrationEventHandler : IIntegrationEventHandler<UserCreatedIntegrationEvent>
{
public async Task HandleAsync(UserCreatedIntegrationEvent userCreatedIntegrationEvent, CancellationToken cancellation)
{

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Modules.TenantIdentity.IntegrationEvents;
using Shared.Features.CQRS.IntegrationEvent;

namespace Modules.Subscriptions.Features.Agregates.StripeCustomerAggregate.Aplication.IntegrationEventHandlers
{
public class UserUpdatedIntegrationEventHandler : IIntegrationEventHandler<UserEmailUpdatedIntegrationEvent>
{
public async Task HandleAsync(UserEmailUpdatedIntegrationEvent userEmailUpdatedIntegrationEvent, CancellationToken cancellationToken)
{

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Modules.Subscriptions.Features.Agregates.StripeCustomerAggregate;
using Shared.Features.CQRS.Query;

namespace Modules.Subscriptions.Features.Agregates.StripeCustomerAggregate.Aplication.Queries
{
public class GetStripeCustomer : IQuery<StripeCustomer>
{
public string StripeCustomerId { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Shared.Features.DomainKernel;

namespace Modules.Subscriptions.Features.Agregates.StripeCustomerAggregate
{
public class StripeCustomer : AggregateRoot
{
public Guid UserId { get; set; }
public string StripeCustomerId { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Shared.Features.CQRS.Command;

namespace Modules.Subscriptions.Features.Agregates.StripeSubscriptionAggregate.Application.Commands
{
public class CreateSubscriptionForTenant : ICommand
{
public Guid TenantId { get; set; }
public Stripe.Subscription Subscription { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Shared.Features.CQRS.Command;

namespace Modules.Subscriptions.Features.Agregates.StripeSubscriptionAggregate.Application.Commands
{
public class DeleteSubscription : ICommand
{
public Stripe.Subscription Subscription { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Shared.Features.CQRS.Command;

namespace Modules.Subscriptions.Features.Agregates.StripeSubscriptionAggregate.Application.Commands
{
public class UpdateSubscription : ICommand
{
public Stripe.Subscription Subscription { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Shared.Features.CQRS.Query;

namespace Modules.Subscriptions.Features.Agregates.StripeSubscriptionAggregate.Application.Queries
{
public class GetStripeCheckoutSession : IQuery<Stripe.Checkout.Session>
{
public string SessionId { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Modules.Subscriptions.Features.Agregates.StripeCustomerAggregate;
using Shared.Features.DomainKernel;
using Shared.Kernel.BuildingBlocks.Authorization;

namespace Modules.Subscriptions.Features.Agregates.StripeSubscriptionAggregate
{
public class StripeSubscription : AggregateRoot
{
public StripeCustomer StripeCustomer { get; set; }
public DateTime ExpirationDate { get; set; }
public SubscriptionPlanType PlanType { get; set; }
public SubscriptionStatus Status { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Shared.Kernel.BuildingBlocks.Authorization;

namespace Modules.Subscriptions.Features.Agregates.SubscriptionAggregate
{
public class StripeSubscriptionPlan
{
public string StripePriceId { get; set; }
public SubscriptionPlanType Type { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Modules.Subscriptions.Features.Agregates.StripeSubscriptionAggregate
{
public enum SubscriptionStatus
{
Active,
Canceled,
Trialing,
Unpaid
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Modules.Subscriptions.Features.Configuration
using Shared.Kernel.BuildingBlocks.Auth.DomainKernel;

namespace Modules.Subscriptions.Features.Configuration
{
public class StripeSubscriptionType
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Modules.TenantIdentity.Features.Aggregates.TenantAggregate;
using Modules.TenantIdentity.Features.EFCore;
using Modules.TenantIdentity.Features.Infrastructure.EFCore;
using Shared.Features.CQRS.Query;
using System;
using System.Linq;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

namespace Modules.TenantIdentity.Features.Aggregates.TenantAggregate
{
[AggregateRoot]
public class Tenant : Entity
public class Tenant : AggregateRoot
{
private Tenant() { }
public Tenant(string name)
Expand All @@ -20,7 +19,6 @@ public Tenant(IServiceProvider serviceProvider)

}

public override Guid TenantId { get => base.TenantId; }
public string Name { get; set; }
public TenantStyling Styling { get; set; }
public TenantSettings Settings { get; set; }
Expand All @@ -46,7 +44,7 @@ public void AddUser(Guid userId, TenantRole role)
memberships.Add(new TenantMembership(userId, role));
}
}
public void ChangeRoleOfMember(Guid userId, Role newRole)
public void ChangeRoleOfMember(Guid userId, TenantRole newRole)
{
TenantAuthorizationService.ThrowIfUserIsNotInRole(TenantRole.Admin);

Expand All @@ -67,7 +65,7 @@ public void RemoveUser(Guid userId)

memberships.Remove(memberships.Single(m => m.UserId == userId));
}
public void InviteUserToRole(Guid userId, Role role)
public void InviteUserToRole(Guid userId, TenantRole role)
{
TenantAuthorizationService.ThrowIfUserIsNotInRole(TenantRole.Admin);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Shared.Features.DomainKernel;
using Shared.Kernel.BuildingBlocks.Auth.DomainKernel;
using System;

namespace Modules.TenantIdentity.Features.Aggregates.TenantAggregate
Expand All @@ -9,6 +10,5 @@ public class TenantSubscription : Entity
public DateTime PeriodStart { get; set; }
public DateTime PeriodEnd { get; set; }
public SubscriptionPlanType SubscriptionPlanType { get; set; }
public SubscriptionStatus Status { get; set; }
}
}
Loading

0 comments on commit 2d7a242

Please sign in to comment.