books/backend/Books.Api/Commands/Companies/CompanyCommandHandlers.cs
Nicolaj Hartmann 66f6fa138d Initial commit: Books accounting system with EventFlow CQRS
Backend (.NET 10):
- EventFlow CQRS/Event Sourcing with PostgreSQL
- GraphQL.NET API with mutations and queries
- Custom ReadModelSqlGenerator for snake_case PostgreSQL columns
- Hangfire for background job processing
- Integration tests with isolated test databases

Frontend (React/Vite):
- Initial project structure

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 02:52:30 +01:00

50 lines
1.4 KiB
C#

using Books.Api.Domain.Companies;
using EventFlow.Commands;
namespace Books.Api.Commands.Companies;
public class CreateCompanyCommandHandler : CommandHandler<CompanyAggregate, CompanyId, CreateCompanyCommand>
{
public override Task ExecuteAsync(
CompanyAggregate aggregate,
CreateCompanyCommand command,
CancellationToken cancellationToken)
{
aggregate.Create(
command.Name,
command.Cvr,
command.Address,
command.PostalCode,
command.City,
command.Country,
command.FiscalYearStartMonth,
command.Currency,
command.VatRegistered,
command.VatPeriodFrequency);
return Task.CompletedTask;
}
}
public class UpdateCompanyCommandHandler : CommandHandler<CompanyAggregate, CompanyId, UpdateCompanyCommand>
{
public override Task ExecuteAsync(
CompanyAggregate aggregate,
UpdateCompanyCommand command,
CancellationToken cancellationToken)
{
aggregate.Update(
command.Name,
command.Cvr,
command.Address,
command.PostalCode,
command.City,
command.Country,
command.FiscalYearStartMonth,
command.Currency,
command.VatRegistered,
command.VatPeriodFrequency);
return Task.CompletedTask;
}
}