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>
77 lines
2.6 KiB
C#
77 lines
2.6 KiB
C#
using Books.Api.Domain.JournalEntryDrafts;
|
|
using EventFlow.Commands;
|
|
|
|
namespace Books.Api.Commands.JournalEntryDrafts;
|
|
|
|
/// <summary>
|
|
/// Command to create a new journal entry draft.
|
|
/// VoucherNumber is required by Bogføringsloven § 7, Stk. 4.
|
|
/// </summary>
|
|
public class CreateJournalEntryDraftCommand(
|
|
JournalEntryDraftId aggregateId,
|
|
string companyId,
|
|
string name,
|
|
string createdBy,
|
|
string voucherNumber,
|
|
string? extractionData = null)
|
|
: Command<JournalEntryDraftAggregate, JournalEntryDraftId>(aggregateId)
|
|
{
|
|
public string CompanyId { get; } = companyId;
|
|
public string Name { get; } = name;
|
|
public string CreatedBy { get; } = createdBy;
|
|
/// <summary>
|
|
/// Bilagsnummer - unique document number per company.
|
|
/// </summary>
|
|
public string VoucherNumber { get; } = voucherNumber;
|
|
/// <summary>
|
|
/// Full AI extraction data as JSON string.
|
|
/// Contains vendor CVR, amounts, VAT, due date, payment reference, line items, etc.
|
|
/// </summary>
|
|
public string? ExtractionData { get; } = extractionData;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Command to update a journal entry draft (auto-save).
|
|
/// Includes VAT codes per line and attachment references.
|
|
/// </summary>
|
|
public class UpdateJournalEntryDraftCommand(
|
|
JournalEntryDraftId aggregateId,
|
|
string? name,
|
|
DateOnly? documentDate,
|
|
string? description,
|
|
string? fiscalYearId,
|
|
List<DraftLine> lines,
|
|
List<string>? attachmentIds = null)
|
|
: Command<JournalEntryDraftAggregate, JournalEntryDraftId>(aggregateId)
|
|
{
|
|
public string? Name { get; } = name;
|
|
/// <summary>
|
|
/// Bilagsdato - the date of the transaction/document (e.g., invoice date)
|
|
/// </summary>
|
|
public DateOnly? DocumentDate { get; } = documentDate;
|
|
public string? Description { get; } = description;
|
|
public string? FiscalYearId { get; } = fiscalYearId;
|
|
public List<DraftLine> Lines { get; } = lines;
|
|
/// <summary>
|
|
/// References to attached documents (bilag) - required by Bogføringsloven § 6.
|
|
/// </summary>
|
|
public List<string> AttachmentIds { get; } = attachmentIds ?? [];
|
|
}
|
|
|
|
public class MarkJournalEntryDraftPostedCommand(
|
|
JournalEntryDraftId aggregateId,
|
|
string transactionId,
|
|
string postedBy)
|
|
: Command<JournalEntryDraftAggregate, JournalEntryDraftId>(aggregateId)
|
|
{
|
|
public string TransactionId { get; } = transactionId;
|
|
public string PostedBy { get; } = postedBy;
|
|
}
|
|
|
|
public class DiscardJournalEntryDraftCommand(
|
|
JournalEntryDraftId aggregateId,
|
|
string discardedBy)
|
|
: Command<JournalEntryDraftAggregate, JournalEntryDraftId>(aggregateId)
|
|
{
|
|
public string DiscardedBy { get; } = discardedBy;
|
|
}
|