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>
36 lines
1.3 KiB
C#
36 lines
1.3 KiB
C#
using Books.Api.EventFlow.Repositories;
|
|
|
|
namespace Books.Api.AiBookkeeper;
|
|
|
|
/// <summary>
|
|
/// Provides chart of accounts data for AI Bookkeeper processing.
|
|
/// Fetches accounts from repository and filters to expense-type accounts.
|
|
/// </summary>
|
|
public class ChartOfAccountsProvider(IAccountRepository accountRepository) : IChartOfAccountsProvider
|
|
{
|
|
public async Task<ChartOfAccountsDto> GetChartOfAccountsAsync(
|
|
string companyId, CancellationToken cancellationToken = default)
|
|
{
|
|
var accounts = await accountRepository.GetActiveByCompanyIdAsync(companyId, cancellationToken);
|
|
|
|
// Filter to expense-type accounts that AI can suggest
|
|
var expenseAccounts = accounts
|
|
.Where(a => a.AccountType is "expense" or "cogs" or "personnel" or "financial")
|
|
.OrderBy(a => a.AccountNumber)
|
|
.Select(a => new AiAccountDto
|
|
{
|
|
AccountNumber = a.AccountNumber,
|
|
Name = a.Name,
|
|
AccountType = a.AccountType,
|
|
VatCodeId = a.VatCodeId,
|
|
StandardAccountNumber = a.StandardAccountNumber
|
|
})
|
|
.ToList();
|
|
|
|
return new ChartOfAccountsDto
|
|
{
|
|
CompanyId = companyId,
|
|
Accounts = expenseAccounts
|
|
};
|
|
}
|
|
}
|