books/backend/Books.Api/Commands/Attachments/AttachmentCommands.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

58 lines
1.8 KiB
C#

using Books.Api.Domain.Attachments;
using EventFlow.Commands;
namespace Books.Api.Commands.Attachments;
/// <summary>
/// Command to upload an attachment (bilag).
/// Required by Bogføringsloven § 6 for document retention.
/// </summary>
public class UploadAttachmentCommand(
AttachmentId aggregateId,
string companyId,
string fileName,
string originalFileName,
string contentType,
long fileSize,
string storagePath,
string uploadedBy,
string? draftId = null,
string? transactionId = null)
: Command<AttachmentAggregate, AttachmentId>(aggregateId)
{
public string CompanyId { get; } = companyId;
public string FileName { get; } = fileName;
public string OriginalFileName { get; } = originalFileName;
public string ContentType { get; } = contentType;
public long FileSize { get; } = fileSize;
public string StoragePath { get; } = storagePath;
public string UploadedBy { get; } = uploadedBy;
public string? DraftId { get; } = draftId;
public string? TransactionId { get; } = transactionId;
}
/// <summary>
/// Command to link an attachment to a posted transaction.
/// </summary>
public class LinkAttachmentToTransactionCommand(
AttachmentId aggregateId,
string transactionId)
: Command<AttachmentAggregate, AttachmentId>(aggregateId)
{
public string TransactionId { get; } = transactionId;
}
/// <summary>
/// Command to delete an attachment.
/// Note: Per Bogføringsloven § 6, this should only be used after
/// the 5-year retention period.
/// </summary>
public class DeleteAttachmentCommand(
AttachmentId aggregateId,
string deletedBy,
string reason)
: Command<AttachmentAggregate, AttachmentId>(aggregateId)
{
public string DeletedBy { get; } = deletedBy;
public string Reason { get; } = reason;
}