Skip to content

Commit

Permalink
command query BaseClasses
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidEggenberger committed Nov 1, 2024
1 parent bf9cd03 commit c88f3c6
Show file tree
Hide file tree
Showing 29 changed files with 33 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Modules.Subscriptions.Features.DomainFeatures.StripeCustomers.Application.Queries
{
public class GetStripeCustomerByStripePortalId : IQuery<StripeCustomer>
public class GetStripeCustomerByStripePortalId : Query<StripeCustomer>
{
public string StripeCustomerStripePortalId { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Modules.Subscriptions.Features.DomainFeatures.StripeSubscriptions.Application.Commands
{
public class CreateTrialingSubscription : ICommand
public class CreateTrialingSubscription : Command
{
public Guid UserId { get; set; }
public Guid TenantId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Modules.Subscriptions.Features.DomainFeatures.StripeSubscriptions.Application.Commands
{
public class PauseActiveSubscription : ICommand
public class PauseActiveSubscription : Command
{
public Stripe.Subscription Subscription { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Modules.Subscriptions.Features.DomainFeatures.StripeSubscriptions.Application.Commands
{
public class UpdateSubscriptionPeriod : ICommand
public class UpdateSubscriptionPeriod : Command
{
public Stripe.Subscription Subscription { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Modules.Subscriptions.Features.DomainFeatures.StripeSubscriptions.Application.Queries
{
[AuthorizeTenantAdmin]
public class GetSubscriptionForTenant : IQuery<object>
public class GetSubscriptionForTenant : Query<object>
{
public Guid UserId { get; set; }
public Guid TenantId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Modules.Subscriptions.Features.Infrastructure.StripePayments
{
public class CreateStripeBillingPortalSession : ICommand<Stripe.BillingPortal.Session>
public class CreateStripeBillingPortalSession : Command<Stripe.BillingPortal.Session>
{
public Guid UserId { get; set; }
public string RedirectBaseUrl { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Modules.Subscriptions.Features.Infrastructure.StripePayments
{
public class CreateStripeCheckoutSession : ICommand<Session>
public class CreateStripeCheckoutSession : Command<Session>
{
public SubscriptionPlanType SubscriptionPlanType { get; set; }
public Guid UserId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Modules.TenantIdentity.Features.DomainFeatures.Tenants.Application.Commands
{
public class AddUserToTenant : ICommand
public class AddUserToTenant : Command
{
public Guid TenantId { get; set; }
public Guid UserId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Modules.TenantIdentity.Features.DomainFeatures.Tenants.Application.Commands
{
public class CreateTenantWithAdmin : ICommand<TenantDTO>
public class CreateTenantWithAdmin : Command<TenantDTO>
{
public string Name { get; set; }
public Guid AdminId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Modules.TenantIdentity.Features.DomainFeatures.Tenants.Application.Commands
{
public class DeleteTenant : ICommand
public class DeleteTenant : Command
{
public Guid TenantId { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Modules.TenantIdentity.Features.DomainFeatures.Tenants.Application.Commands
{
public class RemoveUserFromTenant : ICommand
public class RemoveUserFromTenant : Command
{
public Guid UserId { get; set; }
public Guid TenantId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Modules.TenantIdentity.Features.DomainFeatures.Tenants.Application.Commands
{
public class UpdateTenantMembership : ICommand
public class UpdateTenantMembership : Command
{
public Guid TenantId { get; set; }
public Guid UserId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Modules.TenantIdentity.Features.DomainFeatures.Tenants.Application.Queries
{
public class GetAllTenantMembershipsOfUser : IQuery<List<TenantMembershipDTO>>
public class GetAllTenantMembershipsOfUser : Query<List<TenantMembershipDTO>>
{
public Guid UserId { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Modules.TenantIdentity.Features.DomainFeatures.Tenants.Application.Queries
{
public class GetTenantByID : IQuery<TenantDTO>
public class GetTenantByID : Query<TenantDTO>
{
public Guid TenantId { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Modules.TenantIdentity.Features.DomainFeatures.Tenants.Application.Queries
{
public class GetTenantDetailsByID : IQuery<TenantDetailDTO>
public class GetTenantDetailsByID : Query<TenantDetailDTO>
{
public Guid TenantId { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Modules.TenantIdentity.Features.DomainFeatures.Tenants.Application.Queries
{
public class GetTenantMembershipQuery : IQuery<TenantMembershipDTO>
public class GetTenantMembershipQuery : Query<TenantMembershipDTO>
{
public Guid UserId { get; set; }
public Guid TenantId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Modules.TenantIdentity.Features.DomainFeatures.Users.Application.Commands
{
public class CreateNewUser : ICommand
public class CreateNewUser : Command
{
public ApplicationUser User { get; set; }
public ExternalLoginInfo LoginInfo { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Modules.TenantIdentity.Features.DomainFeatures.Users.Application.Commands
{
public class SetSelectedTenantForUser : ICommand
public class SetSelectedTenantForUser : Command
{
public Guid SelectedTenantId { get; set; }
public Guid UserId { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Modules.TenantIdentity.Features.DomainFeatures.Users.Application.Commands
{
public class UpdateUser : ICommand
public class UpdateUser : Command
{
public string UserName { get; set; }
public IFormFile ProfilePicture { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Modules.TenantIdentity.Features.DomainFeatures.Users.Application.Queries
{
public class GetClaimsForUser : IQuery<IEnumerable<Claim>>
public class GetClaimsForUser : Query<IEnumerable<Claim>>
{
public Guid UserId { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Modules.TenantIdentity.Features.DomainFeatures.Users.Application.Queries
{
public class GetUserById : IQuery<ApplicationUser>
public class GetUserById : Query<ApplicationUser>
{
public Guid UserId { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
namespace Shared.Features.Messaging.Command
{
public interface ICommand
public class Command
{
}

public interface ICommand<IResponse>
public class Command<IResponse>
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ public CommandDispatcher(IServiceProvider serviceProvider)
{
this.serviceProvider = serviceProvider;
}
public Task DispatchAsync<TCommand>(TCommand command, CancellationToken cancellation = default) where TCommand : ICommand
public Task DispatchAsync<TCommand>(TCommand command, CancellationToken cancellation = default) where TCommand : Command
{
var handler = serviceProvider.GetRequiredService<ICommandHandler<TCommand>>();
return handler.HandleAsync(command, cancellation);
}
public Task<TResult> DispatchAsync<TCommand, TResult>(TCommand command, CancellationToken cancellation = default) where TCommand : ICommand<TResult>
public Task<TResult> DispatchAsync<TCommand, TResult>(TCommand command, CancellationToken cancellation = default) where TCommand : Command<TResult>
{
var handler = serviceProvider.GetRequiredService<ICommandHandler<TCommand, TResult>>();
return handler.HandleAsync(command, cancellation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
public interface ICommandDispatcher
{
Task DispatchAsync<TCommand>(TCommand command, CancellationToken cancellation = default) where TCommand : ICommand;
Task<TResult> DispatchAsync<TCommand, TResult>(TCommand command, CancellationToken cancellation = default) where TCommand : ICommand<TResult>;
Task DispatchAsync<TCommand>(TCommand command, CancellationToken cancellation = default) where TCommand : Command;
Task<TResult> DispatchAsync<TCommand, TResult>(TCommand command, CancellationToken cancellation = default) where TCommand : Command<TResult>;
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
namespace Shared.Features.Messaging.Command
{
public interface ICommandHandler<in TCommand> where TCommand : ICommand
public interface ICommandHandler<in TCommand> where TCommand : Command
{
Task HandleAsync(TCommand command, CancellationToken cancellationToken);
}
public interface ICommandHandler<in TCommand, TResult> where TCommand : ICommand<TResult>
public interface ICommandHandler<in TCommand, TResult> where TCommand : Command<TResult>
{
Task<TResult> HandleAsync(TCommand command, CancellationToken cancellationToken);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{
public interface IQueryDispatcher
{
Task<TQueryResult> DispatchAsync<TQuery, TQueryResult>(TQuery query, CancellationToken cancellation = default) where TQuery : IQuery<TQueryResult>;
Task<TQueryResult> DispatchAsync<TQuery, TQueryResult>(TQuery query, CancellationToken cancellation = default) where TQuery : Query<TQueryResult>;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Shared.Features.Messaging.Query
{
public interface IQueryHandler<in TQuery, TQueryResult> where TQuery : IQuery<TQueryResult>
public interface IQueryHandler<in TQuery, TQueryResult> where TQuery : Query<TQueryResult>
{
Task<TQueryResult> HandleAsync(TQuery query, CancellationToken cancellation);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Shared.Features.Messaging.Query
{
public interface IQuery<IResponse>
public class Query<IResponse>
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public QueryDispatcher(IServiceProvider serviceProvider)
this.serviceProvider = serviceProvider;
}

public Task<TQueryResult> DispatchAsync<TQuery, TQueryResult>(TQuery query, CancellationToken cancellation = default) where TQuery : IQuery<TQueryResult>
public Task<TQueryResult> DispatchAsync<TQuery, TQueryResult>(TQuery query, CancellationToken cancellation = default) where TQuery : Query<TQueryResult>
{
var handler = serviceProvider.GetRequiredService<IQueryHandler<TQuery, TQueryResult>>();
var executionContext = serviceProvider.GetRequiredService<IExecutionContext>();
Expand Down

0 comments on commit c88f3c6

Please sign in to comment.