Commit Graph

4 Commits

Author SHA1 Message Date
0763d82f6e Refactor services to use IHttpClientFactory
Refactored `DocReceiverElementService` and `EnvelopeService` to use `IHttpClientFactory` instead of directly injecting `HttpClient`, improving flexibility and testability.

Updated constructors to accept `IHttpClientFactory` and replaced direct `HttpClient` usage with named clients (`"EnvelopeGenerator.Server"`). Adjusted methods to use the factory-created clients for HTTP requests.

Added `using Microsoft.Extensions.Options;` in `Program.cs` and registered `EnvelopeService` and `DocReceiverElementService` in the dependency injection container for proper resolution. Clarified their usage in SSR scenarios with comments.

Removed redundant `using` directives and aligned imports with the updated implementation.

These changes enhance maintainability, scalability, and testability by leveraging `IHttpClientFactory` for better HTTP client management and dependency injection.
2026-06-28 20:31:30 +02:00
5a30bc050b Refactor services to remove ApiOptions dependency
Simplified `DocReceiverElementService` and `EnvelopeService` by removing the `ApiOptions` dependency. Updated constructors to eliminate the `IOptions<ApiOptions>` parameter and switched to using relative URLs directly for API requests.

Removed unused `BaseUrl` and `UsePredefinedReports` properties from `ApiOptions`. Cleaned up redundant fields, constructor logic, and unused `using` directives in affected services.

Registered `EnvelopeService` in `Program.cs` with `AddScoped`. These changes improve maintainability, reduce configuration overhead, and make the services more self-contained.
2026-06-28 20:16:34 +02:00
a4b218b9f3 Add new namespaces to EnvelopeService.cs
Included `EnvelopeGenerator.Application.Common.Dto`, `EnvelopeGenerator.Server.Client.Models`, `EnvelopeGenerator.Server.Client.Options`, and `Microsoft.AspNetCore.WebUtilities` to support new functionality or dependencies in the `EnvelopeService.cs` file.
2026-06-25 15:35:36 +02:00
78ed49a077 Refactor AuthService and add new service classes
Refactored `AuthService` to introduce a reusable `CreateDefaultClient` method, reducing code duplication. Updated all relevant methods in `AuthService` to use this new method.

Added `CultureService` to manage application culture/localization, including support for setting, getting, and initializing culture from `localStorage` or browser settings.

Introduced `DocReceiverElementService` for retrieving document receiver elements (signatures) and `EnvelopeService` for managing envelope data retrieval with optional filters. Both services include error handling and consistent JSON deserialization.

These changes improve code maintainability, reusability, and adhere to the single responsibility principle.
2026-06-25 13:16:57 +02:00