using DigitalOps.CQRS.Services.Organization; using DigitalOps.CQRS.Services.Organization.Options; using FluentValidation; using OpenHarbor.CQRS.Abstractions; namespace DigitalOps.CQRS.Commands.Organization; public class AddOrganizationCommand { public required string Name { get; set; } } public class AddOrganizationCommandHandler(OrganizationService organizationService) : ICommandHandler { public async Task HandleAsync(AddOrganizationCommand command, CancellationToken cancellationToken = new CancellationToken()) { await organizationService.RegisterOrganizationAsync(new RegisterOrganizationOptions { Name = command.Name }, cancellationToken); } } public class AddOrganizationCommandValidator : AbstractValidator { public AddOrganizationCommandValidator() { RuleFor(x => x.Name) .NotEmpty() .MinimumLength(3); } }