Refactor EnvelopeStatus usage and streamline code

- Added `EnvelopeGenerator.Domain.Constants` in multiple files, replacing `Domain.Constants.EnvelopeStatus` with `EnvelopeStatus` for improved readability.
- Modified `CreateEnvelopeCommandHandler.cs` to directly use `request.UserId`, eliminating unnecessary local variable assignment.
- Identified potential duplication in query logic within `ReceiverAlreadySignedQuery.cs`.
- Updated `IEnvelopeService`, `EnvelopeReceiverService`, and `EnvelopeService` to ensure consistent usage of the simplified `EnvelopeStatus`.
- Overall, these changes enhance code maintainability and clarity.
This commit is contained in:
2025-09-01 11:11:30 +02:00
parent ef7e694c9f
commit 48ce0d5f32
9 changed files with 20 additions and 21 deletions

View File

@@ -33,9 +33,7 @@ public class CreateEnvelopeCommandHandler : IRequestHandler<CreateEnvelopeComman
/// <returns></returns>
public async Task<EnvelopeDto?> Handle(CreateEnvelopeCommand request, CancellationToken cancellationToken)
{
int userId = request.UserId ?? throw new InvalidOperationException("UserId cannot be null when creating an envelope.");
var envelope = await _envelopeExecutor.CreateEnvelopeAsync(userId, request.Title, request.Message, request.TFAEnabled, cancellationToken);
var envelope = await _envelopeExecutor.CreateEnvelopeAsync(request.UserId, request.Title, request.Message, request.TFAEnabled, cancellationToken);
return _mapper.Map<EnvelopeDto>(envelope);
}