Reescrita dos geradores: biblioteca IGenerator, minimal API e novo frontend
- GeradoresService: cada tipo passa a ser um IGenerator (NIF, NIPC, NISS, CC, passaporte, IBAN, NIB, cartões, referência MB, pessoa, telefone, código postal, email, matrícula, EAN, UUID) registado em GeneratorRegistry; remove DAL/EF - GeradoresWS: minimal APIs em /api/v1 com OpenAPI + Scalar e health check - UnitTest: testes de ida e volta, valores conhecidos, detecção e API - geradoresfe: UI construída a partir dos metadados da API, validador livre, exportação CSV/JSON/TXT, nginx com API_UPSTREAM configurável - Docker, docker-compose e Jenkinsfile actualizados Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
39
GeradoresService/Core/IGenerator.cs
Normal file
39
GeradoresService/Core/IGenerator.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
namespace GeradoresService.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Um gerador/validador de um tipo de identificador.
|
||||
/// Os metadados (Id, Name, Options, ...) são expostos pela API para o frontend construir a UI.
|
||||
/// </summary>
|
||||
public interface IGenerator
|
||||
{
|
||||
/// <summary>Identificador estável usado nos URLs (ex.: "nif").</summary>
|
||||
string Id { get; }
|
||||
|
||||
string Name { get; }
|
||||
|
||||
string Category { get; }
|
||||
|
||||
string Description { get; }
|
||||
|
||||
IReadOnlyList<GeneratorOption> Options { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Indica se a validação verifica um dígito de controlo (true) ou apenas o formato (false).
|
||||
/// </summary>
|
||||
bool HasChecksum { get; }
|
||||
|
||||
/// <summary>False para geradores compostos que não têm validação (ex.: pessoa fictícia).</summary>
|
||||
bool CanValidate { get; }
|
||||
|
||||
GeneratedItem Generate(GeneratorContext context);
|
||||
|
||||
ValidationResult Validate(string value);
|
||||
}
|
||||
|
||||
public static class Categories
|
||||
{
|
||||
public const string Identificacao = "Identificação";
|
||||
public const string Financeiro = "Financeiro";
|
||||
public const string Contactos = "Contactos e Morada";
|
||||
public const string Outros = "Outros";
|
||||
}
|
||||
Reference in New Issue
Block a user