Commit Graph

2117 Commits

Author SHA1 Message Date
297ab458c7 Replace Cultures with MultiCulture and update middleware order
Switched configuration and DI from Cultures to MultiCulture.
Adjusted middleware registration so CultureMiddleware runs after ExceptionHandlingMiddleware.
2026-02-12 17:16:47 +01:00
0e270e3182 Update Culture model and DI for non-nullable properties
Refactored Culture model to use required and non-nullable properties.
Removed nullable checks for Info in ShowEnvelope.cshtml.
Changed DI from Cultures to MultiCulture in _ViewImports.cshtml.
2026-02-12 17:16:36 +01:00
bcf55f7906 Update CultureMiddleware to use MultiCulture config
Replaced Cultures with MultiCulture in CultureMiddleware.cs.
Constructor now accepts IOptions<MultiCulture> for culture settings.
2026-02-12 17:15:34 +01:00
489b2d0917 Rename Cultures class to MultiCulture throughout codebase
Refactored all references from Cultures to MultiCulture in controllers and base classes. Updated the class definition in MultiCulture.cs to improve clarity and consistency in culture-related functionality. No functional changes were made.
2026-02-12 17:15:14 +01:00
63fbdc3bd5 Validate culture cookie against supported languages
Changed CultureMiddleware to check if the culture cookie value is in the list of supported languages, not just for null or empty. This ensures that only valid, supported culture values are accepted from the cookie; otherwise, the middleware falls back to Accept-Language or default logic.
2026-02-12 16:51:51 +01:00
aaf1f75aa7 Change Localize endpoint to use route parameter for key
The Localize endpoint in TestLocalizerController now accepts the "key" parameter as a route parameter instead of a query string. The method signature was updated to use [FromRoute], and the route template was modified to include "{key}". This changes the endpoint usage from /localize?key=de_DE to /localize/de_DE.
2026-02-12 16:42:49 +01:00
cdca639e4f Update culture handling and adjust middleware order
Changed GetCulture to return current UI culture if cookie is missing, ensuring a non-null result. Reordered middleware in Program.cs to run ExceptionHandlingMiddleware after CultureMiddleware.
2026-02-12 16:40:51 +01:00
ab57dd4cee Add endpoints for culture detection and improve cookie parsing
Added two endpoints to TestLocalizerController for retrieving culture from Accept-Language and user cookies. Enhanced GetCulture extension to parse and return the actual culture string from cookies. Updated usings for new extension methods.
2026-02-12 16:11:40 +01:00
745e9c7bfe Add GetCultureByAcceptLanguage extension for HttpContext
Introduced a new extension method, GetCultureByAcceptLanguage, in the WebExtensions class. This method parses the Accept-Language header from the HTTP request and returns the first valid CultureInfo, enabling detection of the user's preferred culture from browser settings.
2026-02-11 13:54:27 +01:00
670c8ed87c Improve culture selection using Accept-Language header
When no culture cookie is present, use the browser's Accept-Language
header to determine the user's preferred culture. This culture is
applied and stored in a cookie, enhancing localization by respecting
user preferences instead of always defaulting to the application's
default language.
2026-02-11 13:51:01 +01:00
91eb5d1e64 Make Culture lookup case-insensitive; add GetOrDefault()
Changed Culture indexer to use case-insensitive language matching.
Added GetOrDefault() to return a Culture or the default if not found.
2026-02-11 13:50:02 +01:00
9f59a17f63 Mark CreateAsync as obsolete; update Flag reference
Marked CreateAsync in ReadOnlyController as [Obsolete] to encourage use of MediatR. Simplified Flag.DataIntegrityIssue reference in EnvelopeMailService error handling.
2026-02-11 13:14:07 +01:00
2a0f7f99d6 Refactor EnvelopeMailService to use MediatR ISender
Replaces IAuthenticator with ISender in EnvelopeMailService, updates the constructor accordingly, and removes unused dependencies. Improves code readability and formatting, cleans up unused usings and redundant code, and aligns with the intended MediatR-based architecture. No functional changes to email sending logic.
2026-02-11 12:59:17 +01:00
ec674b6e80 Refactor TestEmailTemplateController to use MediatR
Replaced direct service dependency and base class inheritance with MediatR in TestEmailTemplateController. Updated the GetAll endpoint to use a MediatR query and removed obsolete code related to the previous service-based approach. This aligns the controller with CQRS/MediatR best practices.
2026-02-11 12:45:32 +01:00
10f23170fd Rename email template query methods for consistency
Renamed ReadEmailTemplateById and ReadEmailTemplateByType to ReadEmailTemplateAsync in ReadEmailTemplateQueryExtensions. This improves naming consistency and better reflects their asynchronous behavior. No changes to method signatures or functionality.
2026-02-11 12:08:26 +01:00
0ec823ec9e Add ISender extension methods for reading email templates
Introduced ReadEmailTemplateQueryExtensions with methods to fetch a single EmailTemplateDto by ID or type and language code. Added required using directive for EnvelopeGenerator.Application.Common.Extensions. These extensions streamline querying email templates via ISender.
2026-02-11 12:06:32 +01:00
06884fe809 Refactor Get method in EmailTemplateController
Simplified the Get method to always require a ReadEmailTemplateQuery and CancellationToken, delegating all queries to the mediator. Removed conditional logic for handling null or missing parameters. Updated XML documentation to reflect the new method signature.
2026-02-11 11:58:50 +01:00
c2d5bd65aa Refactor email template query to support multiple results
ReadEmailTemplateQuery now returns a collection of EmailTemplateDto, with optional filtering by Id, Type, and new LangCode property. Query handler updated to return all matching templates instead of a single result, and NotFoundException handling was removed.
2026-02-11 11:57:47 +01:00
cfcd43b0ed Make EmailTemplateDto mutable, add LangCode property
Changed EmailTemplateDto properties from init-only to mutable (get/set), removed 'required' from Name, and added a new LangCode property with a default value. Also updated using directives and added conditional compilation in EmailTemplate.cs for .NET Framework compatibility. No functional changes to EmailTemplate class.
2026-02-11 11:00:18 +01:00
f41199c389 Add LangCode property to EmailTemplate entity
Introduced a required LangCode property to the EmailTemplate entity, mapped to the LANG_CODE column in the database as varchar(5). This supports language-specific email templates.
2026-02-11 10:56:20 +01:00
03e3e0eaf4 Add IHasChangedWhen support and cleanup using statements
Introduced IHasChangedWhen interface to EnvelopeReceiver and History.
Added HasEmailAndName property to EnvelopeReceiver.
Updated AutoMapperAuditingExtensions to map ChangedWhen to UTC.
Removed redundant using statements and fixed formatting.
2026-02-11 10:31:22 +01:00
c8ca1ef22a Refactor EmailTemplate Update method signature and logic
Simplified XML docs and removed sample requests. Changed Update method to require UpdateEmailTemplateCommand and CancellationToken, eliminating optional query parameter. Streamlined logic to send update command directly, removing previous conditional handling for null values and template resets.
2026-02-11 10:24:54 +01:00
d31916eab8 Add AutoMapper auditing extensions for timestamp fields
Introduced AutoMapperAuditingExtensions with MapAddedWhen and MapChangedWhen methods to standardize mapping of auditing timestamps. Refactored MappingProfile to use these extensions for AddedWhen and ChangedWhen fields, improving code clarity. Updated DocumentStatus to implement auditing interfaces and added necessary imports.
2026-02-11 10:22:49 +01:00
ee7c92ff5b Refactor entities to use new auditing interfaces
Replaced granular auditing interfaces with IUpdateAuditable and ICreationAuditable in ElementAnnotation, EnvelopeReceiverReadOnly, and Signature to modernize and consolidate auditing logic.
2026-02-09 15:55:38 +01:00
89db852705 Refactor auditing interfaces to new Auditing namespace
Moved auditing interfaces to EnvelopeGenerator.Domain.Interfaces.Auditing. Updated entity classes to reference the new namespace. Added ICreationAuditable and IUpdateAuditable interfaces to improve code organization and clarify auditing responsibilities.
2026-02-09 15:55:20 +01:00
c674a450d8 Refactor entities: remove preprocessor blocks, unify style
Refactored Envelope, Receiver, and Signature entity classes to eliminate preprocessor directives around class and property definitions. Applied attributes directly and reformatted properties for clarity. Constructors are now always present, with default initializations still conditional where needed. Removed obsolete directives from IHasAddedWho. These changes improve code readability, maintainability, and cross-platform compatibility.
2026-02-09 15:37:00 +01:00
910a870ddf Refactor entities: remove preprocessor directives, unify style
Large-scale cleanup of entity and interface classes:
- Removed obsolete #if NET/NETFRAMEWORK preprocessor blocks
- Unified class/property formatting and indentation
- Standardized use of data annotations
- Improved nullable reference type handling
- Simplified interfaces (IHasEnvelope, IHasReceiver)
- Removed redundant and dead code
- No changes to business logic or data model

These changes modernize and standardize the codebase for easier maintenance and .NET compatibility.
2026-02-09 15:32:41 +01:00
e2afbc5a62 Add audit interfaces and fields to domain entities
Introduced interfaces for audit fields (AddedWhen, ChangedWhen, ChangedWho, AddedWho) and updated domain entities to implement them. Adjusted properties for consistency and nullability. Updated MappingProfile to map audit fields between DTOs and entities. Improves auditability and standardization across the domain model.
2026-02-09 15:11:42 +01:00
0fb94decdd Add MediatR support for CreateDocStatusCommand
Implement IRequest for CreateDocStatusCommand and add CreateDocStatusCommandHandler to enable MediatR request handling. Add necessary using directives and support repository injection in the handler.
2026-02-09 12:52:43 +01:00
2c81583831 Update CreateCommandHandler to return created entity
Changed CreateCommandHandler to implement IRequestHandler<TCommand, TEntity> and updated method signatures to return the created entity. Adjusted generic constraints to require TCommand to implement IRequest<TEntity>.
2026-02-09 12:52:29 +01:00
47eade57a3 Add generic CreateCommandHandler for create operations
Introduced a generic CreateCommandHandler class implementing MediatR's IRequestHandler to handle create commands. The handler uses a generic IRepository to perform asynchronous entity creation and supports dependency injection for repository access.
2026-02-09 11:58:32 +01:00
d094fe14da Refactor UpdateEmailTemplateCommand to use base classes
Refactored UpdateEmailTemplateCommand and its handler to inherit from generic UpdateCommand and UpdateCommandHandler base classes. Replaced QueryExpression with BuildQueryExpression(), removed redundant Update property, and cleaned up unused usings. This improves code reuse, modularity, and consistency across update commands.
2026-02-09 11:39:16 +01:00
0dc356726b Add generic UpdateCommand and handler using MediatR
Introduced abstract UpdateCommand<TUpdateDto, TEntity> and UpdateCommandHandler<TCommand, TUpdateDto, TEntity> in EnvelopeGenerator.Application.Common.Commands. This provides a reusable, type-safe pattern for update operations using a generic repository and MediatR, requiring implementers to supply an update DTO and a query expression for entity selection.
2026-02-09 11:39:01 +01:00
b227eb4051 Refactor UpdateEmailTemplateCommand and handler
- Introduce EmailTemplateUpdateDto for update payloads.
- Expose Id and Type directly on UpdateEmailTemplateCommand; remove EmailTemplateQuery property.
- Add QueryExpression for flexible template selection by Id or Type.
- Remove AutoMapper and EmailTemplateDto usage from handler; update repository call to use EmailTemplateUpdateDto.
- Update MappingProfile to map EmailTemplateUpdateDto to EmailTemplate and set ChangedWhen to DateTime.UtcNow.
- Remove obsolete code and improve documentation.
2026-02-09 11:20:34 +01:00
de36e29743 Update ReadEmailTemplateQuery to non-nullable return type
Refactored ReadEmailTemplateQuery and handler to use non-nullable EmailTemplateDto, throwing NotFoundException when no template is found. Updated namespaces and using statements for consistency. Added detailed XML docs for query properties. Controller updated to reference new query namespace.
2026-02-09 10:49:05 +01:00
6291712291 Add AutoMapper profile for EmailTemplate mappings
Introduced MappingProfile in EmailTemplates namespace.
Maps EmailTemplate to EmailTemplateDto and UpdateEmailTemplateCommand to EmailTemplate, ignoring Id and setting ChangedWhen to current time.
2026-02-09 10:09:21 +01:00
73527a97d7 Improve XML doc formatting for EmailTemplateType property
Updated XML comments in ResetEmailTemplateCommand and IEmailTemplateQuery to use HTML line breaks (<br/>) for example template types. This enhances readability in environments that render HTML in documentation. No functional changes were made.
2026-02-09 09:48:13 +01:00
ff094ebfe1 Refactor email template query to use interface
Replaced EmailTemplateQueryBase record with IEmailTemplateQuery interface for email template queries. Updated all relevant commands, queries, and controller methods to use the new interface. Removed EmailTemplateQueryBase and migrated properties to implementing classes. Improved documentation to clarify query structure and Type property usage.
2026-02-09 09:46:46 +01:00
1c948fcbf8 Simplify command imports in EmailTemplateController
Replaced specific Update command import with general Commands namespace import to streamline access to all command classes. No functional changes made.
2026-02-09 09:42:14 +01:00
eba40acd4d Update namespace and reformat ResetEmailTemplateCommand
Changed namespace from .Commands.Reset to .Commands for ResetEmailTemplateCommand and its handler. Reformatted and re-indented code for readability; no functional changes were made.
2026-02-09 09:40:50 +01:00
5cb3465e12 Move handler to ResetEmailTemplateCommand.cs
ResetEmailTemplateCommandHandler and its dependencies were relocated from ResetEmailTemplateCommandHandler.cs to ResetEmailTemplateCommand.cs. The handler logic and Defaults collection remain unchanged. Using statements were updated to support the move.
2026-02-09 09:38:34 +01:00
2c43fdbaed Move handler into UpdateEmailTemplateCommand.cs
Refactored by relocating UpdateEmailTemplateCommandHandler from its own file into UpdateEmailTemplateCommand.cs. Updated using statements accordingly. No logic changes; improves cohesion and maintainability. Removed the now-unnecessary UpdateEmailTemplateCommandHandler.cs file.
2026-02-09 09:16:13 +01:00
eb96842122 Refactor: Rename EmailTemplateQuery to EmailTemplateQueryBase
Refactored the EmailTemplateQuery record to EmailTemplateQueryBase across the codebase. Updated all references, method signatures, inheritance, and documentation to use the new base type. No functional changes; this improves clarity and generalization for email template queries.
2026-02-06 15:19:33 +01:00
a8cb8f935c No changes detected in this commit
No code was added or removed in this commit. The diff does not reflect any modifications to the source files.
2026-02-06 15:18:21 +01:00
387456659d Remove Obsolete attribute from Handle method
The [Obsolete("Use IRepository")] attribute was removed from the Handle method in ReadEmailTemplateQueryHandler, eliminating related compiler warnings and indicating that the method is no longer considered obsolete.
2026-02-06 15:15:46 +01:00
17e3a67fe5 Refactor handler to use generic IRepository for templates
Replaces IEmailTemplateRepository with IRepository<EmailTemplate> in ReadEmailTemplateQueryHandler. Updates method logic to use LINQ queries and FirstOrDefaultAsync. Cleans up obsolete attributes, comments, and using directives. Renames cancellation token parameter for consistency.
2026-02-06 15:14:46 +01:00
632723de5a Refactor email template DTOs and response handling
Replaced ReadEmailTemplateResponse with EmailTemplateDto as the standard DTO for email templates. Updated ReadEmailTemplateQuery and its handler to use EmailTemplateDto. Removed the obsolete MappingProfile and cleaned up EmailTemplateDto with improved documentation. Simplified UpdateEmailTemplateCommandHandler by removing conditional updates for Body and Subject. These changes streamline DTO usage and reduce redundancy in email template handling.
2026-02-06 15:01:04 +01:00
6611b92fdb Update EmailTemplateDto: add timestamps, make fields nullable
Removed ApiExplorerSettings attribute. Changed Body and Subject to nullable strings with init accessors and updated their documentation. Added AddedWhen and ChangedWhen timestamp properties to track template creation and modification dates. Cleaned up property formatting.
2026-02-06 14:14:31 +01:00
5baa28bac8 Move handler to ReadEmailTemplateQuery.cs, remove old file
Refactored by moving ReadEmailTemplateQueryHandler and its implementation into ReadEmailTemplateQuery.cs. Updated using directives accordingly. Deleted the now-redundant ReadEmailTemplateQueryHandler.cs file. No logic changes were made. This consolidates related query and handler code for better maintainability.
2026-02-06 13:53:51 +01:00
c965975f82 Refactor EmailTemplateController to use primary constructor
- Enforce [Authorize(Policy = AuthPolicy.Sender)] on controller
- Switch to primary constructor for dependency injection
- Remove obsolete constructor and private fields
- Update method logic to use constructor parameters directly
- Improve XML documentation and code clarity
- Ensure consistent use of MediatR for command/query handling
2026-02-06 13:51:50 +01:00