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:
@@ -139,7 +139,7 @@ public record EnvelopeDto : IEnvelope
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public EnvelopeType? EnvelopeType { get; set; }
|
||||
public EnvelopeTypeDefaults? EnvelopeType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
||||
@@ -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>
|
||||
{
|
||||
}
|
||||
@@ -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>
|
||||
{
|
||||
}
|
||||
@@ -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>();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ Public Class EnvelopeTypeModel
|
||||
MyBase.New(pState)
|
||||
End Sub
|
||||
|
||||
Private Function ToEnvelopeType(pRow As DataRow) As EnvelopeType
|
||||
Return New EnvelopeType() With {
|
||||
Private Function ToEnvelopeType(pRow As DataRow) As EnvelopeTypeDefaults
|
||||
Return New EnvelopeTypeDefaults() With {
|
||||
.Id = pRow.ItemEx("GUID", 0),
|
||||
.Title = pRow.ItemEx("TITLE", ""),
|
||||
.UseAccessCode = pRow.ItemEx("USE_ACCESS_CODE", False),
|
||||
@@ -27,7 +27,7 @@ Public Class EnvelopeTypeModel
|
||||
}
|
||||
End Function
|
||||
|
||||
Public Function GetById(pEnvelopeTypeId As Integer) As EnvelopeType
|
||||
Public Function GetById(pEnvelopeTypeId As Integer) As EnvelopeTypeDefaults
|
||||
Dim oSql As String = $"SELECT * FROM TBSIG_ENVELOPE_TYPE WHERE GUID = {pEnvelopeTypeId}"
|
||||
Dim oTable As DataTable = Database.GetDatatable(oSql)
|
||||
|
||||
@@ -39,7 +39,7 @@ Public Class EnvelopeTypeModel
|
||||
Return ToEnvelopeType(oRow)
|
||||
End Function
|
||||
|
||||
Public Function List() As IEnumerable(Of EnvelopeType)
|
||||
Public Function List() As IEnumerable(Of EnvelopeTypeDefaults)
|
||||
Dim oSql As String = $"SELECT * FROM TBSIG_ENVELOPE_TYPE"
|
||||
Dim oTable As DataTable = Database.GetDatatable(oSql)
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace EnvelopeGenerator.Domain.Entities
|
||||
{ get; set; }
|
||||
|
||||
[ForeignKey("EnvelopeTypeId")]
|
||||
public virtual EnvelopeType
|
||||
public virtual EnvelopeTypeDefaults
|
||||
#if nullable
|
||||
?
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,7 @@ using System;
|
||||
namespace EnvelopeGenerator.Domain.Entities
|
||||
{
|
||||
[Table("TBSIG_ENVELOPE_TYPE", Schema = "dbo")]
|
||||
public class EnvelopeType
|
||||
public class EnvelopeTypeDefaults
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
@@ -14,7 +14,7 @@ Public Class frmEnvelopeMainData
|
||||
Private Property EnvelopeTypeModel As EnvelopeTypeModel
|
||||
|
||||
<Bindable(True)>
|
||||
Private Property EnvelopeType As New EnvelopeType
|
||||
Private Property EnvelopeType As New EnvelopeTypeDefaults
|
||||
|
||||
Public Property State As State
|
||||
|
||||
@@ -121,7 +121,7 @@ Public Class frmEnvelopeMainData
|
||||
Return
|
||||
End If
|
||||
|
||||
Dim oEnvelopeType = DirectCast(cmbEnvelopeType.EditValue, EnvelopeType)
|
||||
Dim oEnvelopeType = DirectCast(cmbEnvelopeType.EditValue, EnvelopeTypeDefaults)
|
||||
If IsNothing(oEnvelopeType) Then
|
||||
oEnvelopeType = EnvelopeType
|
||||
End If
|
||||
@@ -162,7 +162,7 @@ Public Class frmEnvelopeMainData
|
||||
End Sub
|
||||
|
||||
Private Sub cmbContractType_SelectedValueChanged(sender As Object, e As EventArgs) Handles cmbEnvelopeType.SelectedValueChanged
|
||||
Dim oSelectedType As EnvelopeType = cmbEnvelopeType.SelectedItem
|
||||
Dim oSelectedType As EnvelopeTypeDefaults = cmbEnvelopeType.SelectedItem
|
||||
|
||||
If oSelectedType Is Nothing Then
|
||||
Exit Sub
|
||||
|
||||
@@ -57,7 +57,7 @@ public abstract class EGDbContextBase : DbContext
|
||||
|
||||
public DbSet<History> EnvelopeHistories { get; set; }
|
||||
|
||||
public DbSet<EnvelopeType> EnvelopeTypes { get; set; }
|
||||
public DbSet<EnvelopeTypeDefaults> EnvelopeTypes { get; set; }
|
||||
|
||||
public DbSet<Receiver> Receivers { get; set; }
|
||||
|
||||
@@ -233,7 +233,7 @@ public abstract class EGDbContextBase : DbContext
|
||||
AddTrigger<History>();
|
||||
AddTrigger<EnvelopeReceiver>();
|
||||
AddTrigger<EnvelopeReceiverReadOnly>();
|
||||
AddTrigger<EnvelopeType>();
|
||||
AddTrigger<EnvelopeTypeDefaults>();
|
||||
AddTrigger<Receiver>();
|
||||
#if NET
|
||||
AddTrigger<EmailOut>();
|
||||
|
||||
@@ -6,7 +6,7 @@ using EnvelopeGenerator.Application.Common.Interfaces.Repositories;
|
||||
namespace EnvelopeGenerator.Infrastructure.Repositories;
|
||||
|
||||
[Obsolete("Use IRepository")]
|
||||
public class EnvelopeTypeRepository : CRUDRepository<EnvelopeType, int, EGDbContext>, IEnvelopeTypeRepository
|
||||
public class EnvelopeTypeRepository : CRUDRepository<EnvelopeTypeDefaults, int, EGDbContext>, IEnvelopeTypeRepository
|
||||
{
|
||||
public EnvelopeTypeRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeTypes)
|
||||
{
|
||||
|
||||
@@ -628,7 +628,7 @@
|
||||
private bool _createWizardVisible = false;
|
||||
private IReadOnlyList<EnvelopeTypeDto> _envelopeTypes = [];
|
||||
|
||||
// Stable keys used to store/restore each tab's layout in UserPreferences.GridLayouts
|
||||
// StableDefaults keys used to store/restore each tab's layout in UserPreferences.GridLayouts
|
||||
private const string GridKeyActive = "sender.active-envelopes";
|
||||
private const string GridKeyCompleted = "sender.completed-envelopes";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ using EnvelopeGenerator.Application.Common.Interfaces.Services;
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test;
|
||||
|
||||
[Obsolete("Use MediatR")]
|
||||
public class TestEnvelopeTypeController : TestControllerBase<IEnvelopeTypeService, EnvelopeTypeDto, EnvelopeType, int>
|
||||
public class TestEnvelopeTypeController : TestControllerBase<IEnvelopeTypeService, EnvelopeTypeDto, EnvelopeTypeDefaults, int>
|
||||
{
|
||||
public TestEnvelopeTypeController(ILogger<TestEnvelopeTypeController> logger, IEnvelopeTypeService service) : base(logger, service)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user