feat: company tables, profile, fiscal years and base data (#38, #39, #45)

Adds the company tables of SPEC 11.1 behind one generic service so that every
table gets the same rules, history, cache and CSV import/export, plus the
company profile, fiscal years with monthly lock and the base-data seeder.

- 26 coded tables, exchange rates, company profile, fiscal years and periods:
  entities, maps and migrations 010-014
- TableService + TableCatalog: unique codes, per-table rules (VAT codes are
  checked by the fiscal pack), delete or disable when in use, single default,
  CSV export/import all-or-nothing, cache with cross-instance invalidation
- CompanyProfileService (Italian identifiers through the pack),
  FiscalYearService with the date check used by every dated record
- EcbRatesClient and the ECB rates system task; CsvReader
- ISeeder/SeedRunner with the data version in company settings; base tables
  from the pack (IBaseTablesTemplate) and an embedded ISO country list

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-11 22:33:37 +01:00
1 parent 25f8a7ad30
commit 34e196424f
33 files changed
+6049 -3

No files matched your search

@@ -11,7 +11,9 @@ using Khaemhat.Application.Modules;
using Khaemhat.Application.Notifications;
using Khaemhat.Application.Preferences;
using Khaemhat.Application.Search;
using Khaemhat.Application.Seeding;
using Khaemhat.Application.Security;
using Khaemhat.Application.Tables;
using Khaemhat.Core.Caching;
using Khaemhat.Core.Files;
using Khaemhat.Core.Logging;
@@ -27,6 +29,7 @@ using Khaemhat.Fiscal.Abstractions;
using Khaemhat.Fiscal.Italy;
using Khaemhat.Infrastructure.Caching;
using Khaemhat.Infrastructure.Files;
using Khaemhat.Infrastructure.Http;
using Khaemhat.Infrastructure.Licensing;
using Khaemhat.Infrastructure.Logging;
using Khaemhat.Infrastructure.Security;
@@ -132,8 +135,22 @@ internal static class KhaemhatServices
services.AddSingleton<IFiscalPack, ItalyFiscalPack>();
services.AddSingleton(sp => new FiscalPackCatalog(sp.GetServices<IFiscalPack>()));
// Company tables, profile and fiscal years (#38, #39), base data (#45), checks against European services (#40).
services.AddSingleton<CompanyFiscalContext>();
services.AddSingleton<TableCatalog>();
services.AddSingleton<TableService>();
services.AddSingleton<CompanyProfileService>();
services.AddSingleton<FiscalYearService>();
services.AddSingleton<ExchangeRateService>();
services.AddHttpClient<EcbRatesClient>(c => c.Timeout = TimeSpan.FromSeconds(30));
services.AddHttpClient<ViesClient>(c => c.Timeout = TimeSpan.FromSeconds(20));
services.AddSingleton<IScheduledJob, EcbRatesJob>();
services.AddSingleton<ISeeder, BaseTablesSeeder>();
services.AddSingleton<SeedRunner>();
// Companies and start.
services.AddSingleton<ICompanySeeder, PredefinedRolesSeeder>();
services.AddSingleton<ICompanySeeder>(sp => sp.GetRequiredService<SeedRunner>());
services.AddSingleton<CompanyService>();
services.AddSingleton<CompanyContextResolver>();
services.AddScoped<ICompanyContext, WebCompanyContext>();