feat: parties with radar, record, checks, VIES and demo data (#41)

Customers, suppliers, prospects and leads live in one parties archive
with a kind and a subject type (ADR 0029). A customer that also supplies
carries is_also_supplier, so it shows in both radars with one code.

- Three radars (/anagrafiche/clienti, /fornitori, /contatti) with search,
  quick filters and bulk disable/enable; the record has eight tabs
  (main data, addresses, contacts, terms, fiscal and SDI, banks, notes and
  attachments, history) on the MasterDataPage base.
- PartyService saves the whole record in one transaction, checks it with
  the fiscal pack (VAT number, tax code, recipient code, country), treats
  a duplicate VAT number or a consumer without tax code as warnings, fills
  the default recipient code, runs VIES after commit for EU companies, and
  converts prospects/leads (new customer code, old one kept as
  previous_code) and suppliers (become customers that also supply).
- Delete falls back to disable when the party is referenced.
- DemoPartiesSeeder adds 3 salespeople and 21 parties with fictitious but
  formally valid identifiers; SeedAsync now runs demo seeders when asked.
- Test host accepts service overrides so VIES can be stubbed.

Docs: ADR 0029, wiki Anagrafiche and demo data pages, regenerated data
model, CHANGELOG and STATUS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-12 10:06:33 +01:00
1 parent a9eda510f2
commit 3401271483
28 files changed
+4600 -85

No files matched your search

+9 -1
View File
@@ -27,7 +27,14 @@ public static class KhaemhatApp
/// <param name="args">Command-line arguments (ASP.NET Core host conventions, e.g. <c>--urls</c>; also <c>--KHAEMHAT_*=value</c>).</param>
/// <returns>The application.</returns>
/// <exception cref="ConfigurationException">The <c>KHAEMHAT_*</c> variables are missing or not valid.</exception>
public static WebApplication Build(string[] args)
public static WebApplication Build(string[] args) => Build(args, null);
/// <summary>Creates the configured application with last changes to its services (tests: fake external services).</summary>
/// <param name="args">Command-line arguments.</param>
/// <param name="configureServices">Runs after every registration, before the application is built.</param>
/// <returns>The application.</returns>
/// <exception cref="ConfigurationException">The <c>KHAEMHAT_*</c> variables are missing or not valid.</exception>
public static WebApplication Build(string[] args, Action<IServiceCollection>? configureServices)
{
// ApplicationName pins the static web assets manifest to this assembly, also when tests host the app.
var builder = WebApplication.CreateBuilder(new WebApplicationOptions
@@ -81,6 +88,7 @@ public static class KhaemhatApp
builder.Services.AddSingleton(ProductVersion.FromAssembly(typeof(KhaemhatApp).Assembly));
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
configureServices?.Invoke(builder.Services);
var app = builder.Build();
@@ -144,11 +144,13 @@ internal static class KhaemhatServices
services.AddSingleton<PaymentTermService>();
services.AddSingleton<CodeRuleService>();
services.AddSingleton<AutoFillService>();
services.AddSingleton<Khaemhat.Application.Parties.PartyService>();
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<ISeeder, DemoPartiesSeeder>();
services.AddSingleton<SeedRunner>();
// Companies and start.