Refactor: Replace EnvelopeType with EnvelopeTypeDefaults

Replaced the `EnvelopeType` class with `EnvelopeTypeDefaults` across the codebase to standardize the data model. Updated DTOs, repositories, services, mappings, and database contexts to reflect this change.

Key updates include:
- Updated `EnvelopeDto` to use `EnvelopeTypeDefaults`.
- Modified `IEnvelopeTypeRepository` and `IEnvelopeTypeService` interfaces.
- Adjusted mappings in `MappingProfile.cs` for `EnvelopeTypeDefaults`.
- Updated `ReadEnvelopeTypesQueryHandler` and `CreateEnvelopeCommandHandler` to use `EnvelopeTypeDefaults`.
- Replaced `EnvelopeType` with `EnvelopeTypeDefaults` in `EnvelopeTypeModel.vb`, `frmEnvelopeMainData.vb`, and `EGDbContextBase`.
- Introduced the `EnvelopeTypeDefaults` class with updated schema mappings.
- Updated `EnvelopeTypeRepository` and `TestEnvelopeTypeController` to use `EnvelopeTypeDefaults`.

These changes ensure consistency and improve maintainability across the application.
This commit is contained in:
2026-11-12 16:42:27 +01:00
parent 34b184b057
commit 621f9333a4
15 changed files with 24 additions and 24 deletions

View File

@@ -139,7 +139,7 @@ public record EnvelopeDto : IEnvelope
/// <summary>
///
/// </summary>
public EnvelopeType? EnvelopeType { get; set; }
public EnvelopeTypeDefaults? EnvelopeType { get; set; }
/// <summary>
///

View File

@@ -7,6 +7,6 @@ namespace EnvelopeGenerator.Application.Common.Interfaces.Repositories;
///
/// </summary>
[Obsolete("Use IRepository")]
public interface IEnvelopeTypeRepository : ICRUDRepository<EnvelopeType, int>
public interface IEnvelopeTypeRepository : ICRUDRepository<EnvelopeTypeDefaults, int>
{
}

View File

@@ -8,6 +8,6 @@ namespace EnvelopeGenerator.Application.Common.Interfaces.Services;
///
/// </summary>
[Obsolete("Use MediatR")]
public interface IEnvelopeTypeService : IBasicCRUDService<EnvelopeTypeDto, EnvelopeType, int>
public interface IEnvelopeTypeService : IBasicCRUDService<EnvelopeTypeDto, EnvelopeTypeDefaults, int>
{
}

View File

@@ -37,7 +37,7 @@ public class MappingProfile : Profile
CreateMap<History, HistoryCreateDto>().ForMember(dest => dest.ActionDate, opt => opt.MapFrom(src => src.ChangedWhen));
CreateMap<EnvelopeReceiver, EnvelopeReceiverDto>();
CreateMap<EnvelopeReceiver, EnvelopeReceiverSecretDto>();
CreateMap<EnvelopeType, EnvelopeTypeDto>();
CreateMap<EnvelopeTypeDefaults, EnvelopeTypeDto>();
CreateMap<Receiver, ReceiverDto>();
CreateMap<EnvelopeReceiverReadOnly, EnvelopeReceiverReadOnlyDto>();
CreateMap<ElementAnnotation, AnnotationDto>();
@@ -55,7 +55,7 @@ public class MappingProfile : Profile
CreateMap<HistoryDto, History>().ForMember(dest => dest.ChangedWhen, opt => opt.MapFrom(src => src.ActionDate));
CreateMap<HistoryCreateDto, History>().ForMember(dest => dest.ChangedWhen, opt => opt.MapFrom(src => src.ActionDate));
CreateMap<EnvelopeReceiverDto, EnvelopeReceiver>();
CreateMap<EnvelopeTypeDto, EnvelopeType>();
CreateMap<EnvelopeTypeDto, EnvelopeTypeDefaults>();
CreateMap<ReceiverDto, Receiver>().ForMember(rcv => rcv.EnvelopeReceivers, rcvReadDto => rcvReadDto.Ignore());
CreateMap<EnvelopeReceiverReadOnlyCreateDto, EnvelopeReceiverReadOnly>();
CreateMap<EnvelopeReceiverReadOnlyUpdateDto, EnvelopeReceiverReadOnly>();

View File

@@ -16,13 +16,13 @@ public record ReadEnvelopeTypesQuery : IRequest<IEnumerable<EnvelopeTypeDto>>;
/// </summary>
public class ReadEnvelopeTypesQueryHandler : IRequestHandler<ReadEnvelopeTypesQuery, IEnumerable<EnvelopeTypeDto>>
{
private readonly IRepository<EnvelopeType> _repository;
private readonly IRepository<EnvelopeTypeDefaults> _repository;
/// <summary>
///
/// </summary>
/// <param name="repository"></param>
public ReadEnvelopeTypesQueryHandler(IRepository<EnvelopeType> repository)
public ReadEnvelopeTypesQueryHandler(IRepository<EnvelopeTypeDefaults> repository)
{
_repository = repository;
}

View File

@@ -41,7 +41,7 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
private IRepository<EnvelopeReceiver> EnvelopeReceiverRepository => Provider.GetRequiredService<IRepository<EnvelopeReceiver>>();
private IRepository<EnvelopeType> EnvelopeTypeRepository => Provider.GetRequiredService<IRepository<EnvelopeType>>();
private IRepository<EnvelopeTypeDefaults> EnvelopeTypeRepository => Provider.GetRequiredService<IRepository<EnvelopeTypeDefaults>>();
private IRepository<Receiver> ReceiverRepository => Provider.GetRequiredService<IRepository<Receiver>>();
@@ -233,7 +233,7 @@ public class CreateEnvelopeCommandHandler(IServiceProvider Provider, IMapper Map
private async Task<EnvelopeSettings> ResolveEnvelopeSettingsAsync(CreateEnvelopeCommand request, Envelope? existing, CancellationToken cancel)
{
EnvelopeType? selectedType = null;
EnvelopeTypeDefaults? selectedType = null;
if (request.EnvelopeTypeId is int envelopeTypeId && envelopeTypeId > 0)
{
selectedType = await EnvelopeTypeRepository.Query

View File

@@ -14,7 +14,7 @@ namespace EnvelopeGenerator.Application.Services;
///
/// </summary>
[Obsolete("Use MediatR")]
public class EnvelopeTypeService : BasicCRUDService<IEnvelopeTypeRepository, EnvelopeTypeDto, EnvelopeType, int>, IEnvelopeTypeService
public class EnvelopeTypeService : BasicCRUDService<IEnvelopeTypeRepository, EnvelopeTypeDto, EnvelopeTypeDefaults, int>, IEnvelopeTypeService
{
private static readonly Guid CacheKey = Guid.NewGuid();