books/backend/Books.Api/Commands/BankConnections/BankConnectionCommands.cs
Nicolaj Hartmann 1f75c5d791 Add all backend domain, commands, repositories, and tests
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>
2026-01-30 22:19:42 +01:00

91 lines
2.9 KiB
C#

using Books.Api.Domain.BankConnections;
using Books.Api.Domain.BankConnections.Events;
using EventFlow.Commands;
namespace Books.Api.Commands.BankConnections;
public class InitiateBankConnectionCommand(
BankConnectionId aggregateId,
string companyId,
string aspspName,
string authorizationId,
string redirectUrl,
string state)
: Command<BankConnectionAggregate, BankConnectionId>(aggregateId)
{
public string CompanyId { get; } = companyId;
public string AspspName { get; } = aspspName;
public string AuthorizationId { get; } = authorizationId;
public string RedirectUrl { get; } = redirectUrl;
public string State { get; } = state;
}
public class EstablishBankConnectionCommand(
BankConnectionId aggregateId,
string sessionId,
DateTimeOffset validUntil,
IReadOnlyList<BankAccountInfo> accounts)
: Command<BankConnectionAggregate, BankConnectionId>(aggregateId)
{
public string SessionId { get; } = sessionId;
public DateTimeOffset ValidUntil { get; } = validUntil;
public IReadOnlyList<BankAccountInfo> Accounts { get; } = accounts;
}
public class FailBankConnectionCommand(
BankConnectionId aggregateId,
string reason)
: Command<BankConnectionAggregate, BankConnectionId>(aggregateId)
{
public string Reason { get; } = reason;
}
public class DisconnectBankConnectionCommand(
BankConnectionId aggregateId,
string reason = "User requested disconnection")
: Command<BankConnectionAggregate, BankConnectionId>(aggregateId)
{
public string Reason { get; } = reason;
}
public class RefreshBankConnectionCommand(
BankConnectionId aggregateId,
string newSessionId,
DateTimeOffset validUntil)
: Command<BankConnectionAggregate, BankConnectionId>(aggregateId)
{
public string NewSessionId { get; } = newSessionId;
public DateTimeOffset ValidUntil { get; } = validUntil;
}
public class LinkBankAccountCommand(
BankConnectionId aggregateId,
string bankAccountId,
string linkedAccountId,
DateOnly? importFromDate = null)
: Command<BankConnectionAggregate, BankConnectionId>(aggregateId)
{
public string BankAccountId { get; } = bankAccountId;
public string LinkedAccountId { get; } = linkedAccountId;
public DateOnly? ImportFromDate { get; } = importFromDate;
}
public class ReInitiateBankConnectionCommand(
BankConnectionId aggregateId,
string authorizationId,
string redirectUrl,
string state)
: Command<BankConnectionAggregate, BankConnectionId>(aggregateId)
{
public string AuthorizationId { get; } = authorizationId;
public string RedirectUrl { get; } = redirectUrl;
public string State { get; } = state;
}
public class ArchiveBankConnectionCommand(
BankConnectionId aggregateId,
string reason = "User requested archival")
: Command<BankConnectionAggregate, BankConnectionId>(aggregateId)
{
public string Reason { get; } = reason;
}