This commit includes all previously untracked backend files: Domain: - Accounts, Attachments, BankConnections, Customers - FiscalYears, Invoices, JournalEntryDrafts - Orders, Products, UserAccess Commands & Handlers: - Full CQRS command structure for all domains Repositories: - PostgreSQL repositories for all read models - Bank transaction and ledger repositories GraphQL: - Input types, scalars, and types for all entities - Mutations and queries Infrastructure: - Banking integration (Enable Banking client) - File storage, Invoicing, Reporting, SAF-T export - Database migrations (003-029) Tests: - Integration tests for GraphQL endpoints - Domain tests - Invoicing and reporting tests Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
78 lines
2.2 KiB
C#
78 lines
2.2 KiB
C#
using Books.Api.Domain.Customers;
|
|
using EventFlow.Commands;
|
|
|
|
namespace Books.Api.Commands.Customers;
|
|
|
|
public class CreateCustomerCommandHandler : CommandHandler<CustomerAggregate, CustomerId, CreateCustomerCommand>
|
|
{
|
|
public override Task ExecuteAsync(
|
|
CustomerAggregate aggregate,
|
|
CreateCustomerCommand command,
|
|
CancellationToken cancellationToken)
|
|
{
|
|
aggregate.Create(
|
|
command.CompanyId,
|
|
command.CustomerNumber,
|
|
command.CustomerType,
|
|
command.Name,
|
|
command.Cvr,
|
|
command.Address,
|
|
command.PostalCode,
|
|
command.City,
|
|
command.Country,
|
|
command.Email,
|
|
command.Phone,
|
|
command.PaymentTermsDays,
|
|
command.DefaultRevenueAccountId,
|
|
command.SubLedgerAccountId);
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|
|
|
|
public class UpdateCustomerCommandHandler : CommandHandler<CustomerAggregate, CustomerId, UpdateCustomerCommand>
|
|
{
|
|
public override Task ExecuteAsync(
|
|
CustomerAggregate aggregate,
|
|
UpdateCustomerCommand command,
|
|
CancellationToken cancellationToken)
|
|
{
|
|
aggregate.Update(
|
|
command.Name,
|
|
command.Cvr,
|
|
command.Address,
|
|
command.PostalCode,
|
|
command.City,
|
|
command.Country,
|
|
command.Email,
|
|
command.Phone,
|
|
command.PaymentTermsDays,
|
|
command.DefaultRevenueAccountId);
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|
|
|
|
public class DeactivateCustomerCommandHandler : CommandHandler<CustomerAggregate, CustomerId, DeactivateCustomerCommand>
|
|
{
|
|
public override Task ExecuteAsync(
|
|
CustomerAggregate aggregate,
|
|
DeactivateCustomerCommand command,
|
|
CancellationToken cancellationToken)
|
|
{
|
|
aggregate.Deactivate();
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|
|
|
|
public class ReactivateCustomerCommandHandler : CommandHandler<CustomerAggregate, CustomerId, ReactivateCustomerCommand>
|
|
{
|
|
public override Task ExecuteAsync(
|
|
CustomerAggregate aggregate,
|
|
ReactivateCustomerCommand command,
|
|
CancellationToken cancellationToken)
|
|
{
|
|
aggregate.Reactivate();
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|