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
|
|
|
using Books.Api.Domain.JournalEntryDrafts;
|
|
|
|
|
|
|
|
|
|
namespace Books.Api.EventFlow.ReadModels;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// DTO for reading journal entry draft data from the database.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class JournalEntryDraftReadModelDto
|
|
|
|
|
{
|
|
|
|
|
public string Id { get; set; } = string.Empty;
|
|
|
|
|
public string CompanyId { get; set; } = string.Empty;
|
|
|
|
|
public string Name { get; set; } = string.Empty;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Bilagsnummer - unique document number required by Bogføringsloven § 7, Stk. 4
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string VoucherNumber { get; set; } = string.Empty;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Bilagsdato - the date of the transaction/document (e.g., invoice date)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DateTime? DocumentDate { get; set; }
|
|
|
|
|
public string? Description { get; set; }
|
|
|
|
|
public string? FiscalYearId { get; set; }
|
|
|
|
|
public string Lines { get; set; } = "[]";
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// JSON array of attachment IDs (bilag references)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string AttachmentIds { get; set; } = "[]";
|
|
|
|
|
public string Status { get; set; } = "active";
|
|
|
|
|
public string? TransactionId { get; set; }
|
2026-02-05 21:35:26 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// The exact timestamp when the draft was posted to the ledger.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DateTimeOffset? PostedAt { get; set; }
|
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
|
|
|
public string CreatedBy { get; set; } = string.Empty;
|
|
|
|
|
public DateTime CreatedAt { get; set; }
|
|
|
|
|
public DateTime UpdatedAt { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Full AI extraction data stored as JSON string.
|
|
|
|
|
/// Contains vendor CVR, amounts, VAT, due date, payment reference, line items, etc.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string? ExtractionData { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Deserialize lines from JSON to list of DraftLine objects.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<DraftLine> GetLines()
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(Lines))
|
|
|
|
|
return [];
|
|
|
|
|
|
|
|
|
|
return System.Text.Json.JsonSerializer.Deserialize<List<DraftLine>>(Lines) ?? [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Deserialize attachment IDs from JSON.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<string> GetAttachmentIds()
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(AttachmentIds))
|
|
|
|
|
return [];
|
|
|
|
|
|
|
|
|
|
return System.Text.Json.JsonSerializer.Deserialize<List<string>>(AttachmentIds) ?? [];
|
|
|
|
|
}
|
|
|
|
|
}
|