refactor(EnvelopeDocument): rename as Document

This commit is contained in:
2025-09-09 18:56:55 +02:00
parent fbbc05814f
commit ae669d05e7
23 changed files with 51 additions and 51 deletions

View File

@@ -28,7 +28,7 @@ public class MappingProfile : Profile
CreateMap<DocumentStatus, DocumentStatusDto>(); CreateMap<DocumentStatus, DocumentStatusDto>();
CreateMap<EmailTemplate, EmailTemplateDto>(); CreateMap<EmailTemplate, EmailTemplateDto>();
CreateMap<Envelope, EnvelopeDto>(); CreateMap<Envelope, EnvelopeDto>();
CreateMap<EnvelopeDocument, DocumentDto>(); CreateMap<Document, DocumentDto>();
CreateMap<EnvelopeHistory, EnvelopeHistoryDto>(); CreateMap<EnvelopeHistory, EnvelopeHistoryDto>();
CreateMap<EnvelopeHistory, EnvelopeHistoryCreateDto>(); CreateMap<EnvelopeHistory, EnvelopeHistoryCreateDto>();
CreateMap<EnvelopeReceiver, EnvelopeReceiverDto>(); CreateMap<EnvelopeReceiver, EnvelopeReceiverDto>();
@@ -44,7 +44,7 @@ public class MappingProfile : Profile
CreateMap<DocumentStatusDto, DocumentStatus>(); CreateMap<DocumentStatusDto, DocumentStatus>();
CreateMap<EmailTemplateDto, EmailTemplate>(); CreateMap<EmailTemplateDto, EmailTemplate>();
CreateMap<EnvelopeDto, Envelope>(); CreateMap<EnvelopeDto, Envelope>();
CreateMap<DocumentDto, EnvelopeDocument>(); CreateMap<DocumentDto, Document>();
CreateMap<EnvelopeHistoryDto, EnvelopeHistory>(); CreateMap<EnvelopeHistoryDto, EnvelopeHistory>();
CreateMap<EnvelopeHistoryCreateDto, EnvelopeHistory>(); CreateMap<EnvelopeHistoryCreateDto, EnvelopeHistory>();
CreateMap<EnvelopeReceiverDto, EnvelopeReceiver>(); CreateMap<EnvelopeReceiverDto, EnvelopeReceiver>();

View File

@@ -8,7 +8,7 @@ namespace EnvelopeGenerator.Application.Common.SQL;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public class DocumentCreateReadSQL : ISQL<EnvelopeDocument> public class DocumentCreateReadSQL : ISQL<Document>
{ {
/// <summary> /// <summary>
/// Base64, OUT_UID /// Base64, OUT_UID

View File

@@ -17,23 +17,23 @@ public record ReadDocumentQuery(int? Id = null, int? EnvelopeId = null) : IReque
} }
/// <summary> /// <summary>
/// Handles queries for reading <see cref="EnvelopeDocument"/> data based on either the document ID or the envelope ID. /// Handles queries for reading <see cref="Document"/> data based on either the document ID or the envelope ID.
/// </summary> /// </summary>
public class ReadDocumentQueryHandler : IRequestHandler<ReadDocumentQuery, DocumentDto?> public class ReadDocumentQueryHandler : IRequestHandler<ReadDocumentQuery, DocumentDto?>
{ {
/// <summary> /// <summary>
/// TempRepo for accessing <see cref="EnvelopeDocument"/> entities. /// TempRepo for accessing <see cref="Document"/> entities.
/// </summary> /// </summary>
private readonly IRepository<EnvelopeDocument> _repo; private readonly IRepository<Document> _repo;
private readonly IMapper _mapper; private readonly IMapper _mapper;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ReadDocumentQueryHandler"/> class. /// Initializes a new instance of the <see cref="ReadDocumentQueryHandler"/> class.
/// </summary> /// </summary>
/// <param name="envelopeDocumentRepository">The repository used to access <see cref="EnvelopeDocument"/> entities.</param> /// <param name="envelopeDocumentRepository">The repository used to access <see cref="Document"/> entities.</param>
/// <param name="mapper"></param> /// <param name="mapper"></param>
public ReadDocumentQueryHandler(IRepository<EnvelopeDocument> envelopeDocumentRepository, IMapper mapper) public ReadDocumentQueryHandler(IRepository<Document> envelopeDocumentRepository, IMapper mapper)
{ {
_repo = envelopeDocumentRepository; _repo = envelopeDocumentRepository;
_mapper = mapper; _mapper = mapper;

View File

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

View File

@@ -14,5 +14,5 @@ public interface IDocumentExecutor
/// <param name="envelope_uuid"></param> /// <param name="envelope_uuid"></param>
/// <param name="cancellation"></param> /// <param name="cancellation"></param>
/// <returns></returns> /// <returns></returns>
Task<EnvelopeDocument> CreateDocumentAsync(string base64, string envelope_uuid, CancellationToken cancellation = default); Task<Document> CreateDocumentAsync(string base64, string envelope_uuid, CancellationToken cancellation = default);
} }

View File

@@ -8,6 +8,6 @@ namespace EnvelopeGenerator.Application.Interfaces.Services;
/// ///
/// </summary> /// </summary>
[Obsolete("Use MediatR")] [Obsolete("Use MediatR")]
public interface IEnvelopeDocumentService : IBasicCRUDService<DocumentDto, EnvelopeDocument, int> public interface IEnvelopeDocumentService : IBasicCRUDService<DocumentDto, Document, int>
{ {
} }

View File

@@ -11,7 +11,7 @@ namespace EnvelopeGenerator.Application.Services;
/// ///
/// </summary> /// </summary>
[Obsolete("Use MediatR")] [Obsolete("Use MediatR")]
public class EnvelopeDocumentService : BasicCRUDService<IEnvelopeDocumentRepository, DocumentDto, EnvelopeDocument, int>, IEnvelopeDocumentService public class EnvelopeDocumentService : BasicCRUDService<IEnvelopeDocumentRepository, DocumentDto, Document, int>, IEnvelopeDocumentService
{ {
/// <summary> /// <summary>
/// ///

View File

@@ -12,14 +12,14 @@ Public Class DocumentModel
ElementModel = New ElementModel(pState) ElementModel = New ElementModel(pState)
End Sub End Sub
Private Function ToDocument(pRow As DataRow) As EnvelopeDocument Private Function ToDocument(pRow As DataRow) As Document
Return ToDocument(pRow, 0) Return ToDocument(pRow, 0)
End Function End Function
Private Function ToDocument(pRow As DataRow, pReceiverId As Integer) As EnvelopeDocument Private Function ToDocument(pRow As DataRow, pReceiverId As Integer) As Document
Dim oDocumentId = pRow.ItemEx("GUID", 0) Dim oDocumentId = pRow.ItemEx("GUID", 0)
Dim byteDataObj = pRow.Item("BYTE_DATA") Dim byteDataObj = pRow.Item("BYTE_DATA")
Return New EnvelopeDocument() With { Return New Document() With {
.Id = oDocumentId, .Id = oDocumentId,
.EnvelopeId = pRow.ItemEx("ENVELOPE_ID", 0), .EnvelopeId = pRow.ItemEx("ENVELOPE_ID", 0),
.Filename = pRow.ItemEx("FILENAME", ""), .Filename = pRow.ItemEx("FILENAME", ""),
@@ -31,7 +31,7 @@ Public Class DocumentModel
} }
End Function End Function
Public Function GetById(pDocumentId As Integer) As EnvelopeDocument Public Function GetById(pDocumentId As Integer) As Document
Try Try
Dim oSql = $"SELECT * FROM [dbo].[TBSIG_ENVELOPE_DOCUMENT] WHERE GUID = {pDocumentId}" Dim oSql = $"SELECT * FROM [dbo].[TBSIG_ENVELOPE_DOCUMENT] WHERE GUID = {pDocumentId}"
Dim oTable = Database.GetDatatable(oSql) Dim oTable = Database.GetDatatable(oSql)
@@ -46,7 +46,7 @@ Public Class DocumentModel
End Try End Try
End Function End Function
Public Function List(pEnvelopeId As Integer) As IEnumerable(Of EnvelopeDocument) Public Function List(pEnvelopeId As Integer) As IEnumerable(Of Document)
Try Try
Dim oSql = $"SELECT * FROM [dbo].[TBSIG_ENVELOPE_DOCUMENT] WHERE ENVELOPE_ID = {pEnvelopeId}" Dim oSql = $"SELECT * FROM [dbo].[TBSIG_ENVELOPE_DOCUMENT] WHERE ENVELOPE_ID = {pEnvelopeId}"
Dim oTable = Database.GetDatatable(oSql) Dim oTable = Database.GetDatatable(oSql)
@@ -61,7 +61,7 @@ Public Class DocumentModel
End Try End Try
End Function End Function
Public Function List(pEnvelopeId As Integer, pReceiverId As Integer) As IEnumerable(Of EnvelopeDocument) Public Function List(pEnvelopeId As Integer, pReceiverId As Integer) As IEnumerable(Of Document)
Try Try
Dim oSql = $"SELECT * FROM [dbo].[TBSIG_ENVELOPE_DOCUMENT] WHERE ENVELOPE_ID = {pEnvelopeId}" Dim oSql = $"SELECT * FROM [dbo].[TBSIG_ENVELOPE_DOCUMENT] WHERE ENVELOPE_ID = {pEnvelopeId}"
Dim oTable = Database.GetDatatable(oSql) Dim oTable = Database.GetDatatable(oSql)
@@ -76,7 +76,7 @@ Public Class DocumentModel
End Try End Try
End Function End Function
Public Function Insert(pEnvelope As Envelope, pDocument As EnvelopeDocument, pTransaction As SqlTransaction) As Boolean Public Function Insert(pEnvelope As Envelope, pDocument As Document, pTransaction As SqlTransaction) As Boolean
Try Try
Dim oSql = "INSERT INTO [dbo].[TBSIG_ENVELOPE_DOCUMENT] Dim oSql = "INSERT INTO [dbo].[TBSIG_ENVELOPE_DOCUMENT]
([FILENAME] ([FILENAME]

View File

@@ -14,9 +14,9 @@ namespace EnvelopeGenerator.Domain.Entities
#endif #endif
[Table("TBSIG_ENVELOPE_DOCUMENT", Schema = "dbo")] [Table("TBSIG_ENVELOPE_DOCUMENT", Schema = "dbo")]
public class EnvelopeDocument public class Document
{ {
public EnvelopeDocument() public Document()
{ {
#if NETFRAMEWORK #if NETFRAMEWORK
Elements = Enumerable.Empty<DocumentReceiverElement>().ToList(); Elements = Enumerable.Empty<DocumentReceiverElement>().ToList();

View File

@@ -103,7 +103,7 @@ public class DocumentReceiverElement
ChangedWho { get; set; } ChangedWho { get; set; }
[ForeignKey("DocumentId")] [ForeignKey("DocumentId")]
public virtual EnvelopeDocument Document { get; set; } public virtual Document Document { get; set; }
[ForeignKey("ReceiverId")] [ForeignKey("ReceiverId")]
public virtual Receiver Receiver { get; set; } public virtual Receiver Receiver { get; set; }

View File

@@ -35,7 +35,7 @@ public class Envelope
ReminderIntervalDays = 0; ReminderIntervalDays = 0;
CertificationType = (int)Constants.CertificationType.AdvancedElectronicSignature; CertificationType = (int)Constants.CertificationType.AdvancedElectronicSignature;
UseAccessCode = false; UseAccessCode = false;
Documents = Enumerable.Empty<EnvelopeDocument>().ToList(); Documents = Enumerable.Empty<Document>().ToList();
Histories = Enumerable.Empty<EnvelopeHistory>().ToList(); Histories = Enumerable.Empty<EnvelopeHistory>().ToList();
EnvelopeReceivers = Enumerable.Empty<EnvelopeReceiver>().ToList(); EnvelopeReceivers = Enumerable.Empty<EnvelopeReceiver>().ToList();
#endif #endif
@@ -158,7 +158,7 @@ public class Envelope
public bool IsAlreadySent => Status > EnvelopeStatus.EnvelopeSaved; public bool IsAlreadySent => Status > EnvelopeStatus.EnvelopeSaved;
#endif #endif
public List<EnvelopeDocument> public List<Document>
#if NET #if NET
? ?
#endif #endif

View File

@@ -100,7 +100,7 @@ Public MustInherit Class BaseController
End Try End Try
End Function End Function
Public Function DeleteDocument(pDocument As EnvelopeDocument, pTransaction As SqlTransaction) As Boolean Public Function DeleteDocument(pDocument As Document, pTransaction As SqlTransaction) As Boolean
Try Try
If DocumentModel.Delete(pDocument.Id, pTransaction) = True Then If DocumentModel.Delete(pDocument.Id, pTransaction) = True Then
@@ -137,7 +137,7 @@ Public MustInherit Class BaseController
End Function End Function
Public Function DeleteDocumentFromDisk(pDocument As EnvelopeDocument) As Boolean Public Function DeleteDocumentFromDisk(pDocument As Document) As Boolean
Try Try
If IO.File.Exists(pDocument.Filepath) Then If IO.File.Exists(pDocument.Filepath) Then
IO.File.Delete(pDocument.Filepath) IO.File.Delete(pDocument.Filepath)

View File

@@ -159,7 +159,7 @@ Public Class EnvelopeEditorController
End Try End Try
End Function End Function
Public Async Function CreateDocument(pDocumentFilePath As String) As Threading.Tasks.Task(Of EnvelopeDocument) Public Async Function CreateDocument(pDocumentFilePath As String) As Threading.Tasks.Task(Of Document)
Try Try
Dim oFixedPath = FixPageRotation.FixPageRotation(pDocumentFilePath) Dim oFixedPath = FixPageRotation.FixPageRotation(pDocumentFilePath)
If oFixedPath <> pDocumentFilePath Then If oFixedPath <> pDocumentFilePath Then
@@ -177,7 +177,7 @@ Public Class EnvelopeEditorController
Dim oFileInfoTemp = New FileInfo(oTempFilePath) Dim oFileInfoTemp = New FileInfo(oTempFilePath)
Dim oDocument = New EnvelopeDocument() With { Dim oDocument = New Document() With {
.Filename = oFileInfoTemp.Name, .Filename = oFileInfoTemp.Name,
.Filepath = oFileInfoTemp.FullName, .Filepath = oFileInfoTemp.FullName,
.FileNameOriginal = oFileInfo.Name, .FileNameOriginal = oFileInfo.Name,
@@ -230,7 +230,7 @@ Public Class EnvelopeEditorController
End Try End Try
End Function End Function
Public Overloads Function DeleteDocument(pDocument As EnvelopeDocument) As Boolean Public Overloads Function DeleteDocument(pDocument As Document) As Boolean
Dim oConnection As SqlConnection = Database.GetConnection Dim oConnection As SqlConnection = Database.GetConnection
Dim oTransaction As SqlTransaction = oConnection.BeginTransaction Dim oTransaction As SqlTransaction = oConnection.BeginTransaction

View File

@@ -7,7 +7,7 @@ Imports EnvelopeGenerator.Domain.Entities
Public Class FieldEditorController Public Class FieldEditorController
Inherits BaseController Inherits BaseController
Private ReadOnly Document As EnvelopeDocument Private ReadOnly Document As Document
Public Property Elements As New List(Of DocumentReceiverElement) Public Property Elements As New List(Of DocumentReceiverElement)
Public Class ElementInfo Public Class ElementInfo
@@ -16,7 +16,7 @@ Public Class FieldEditorController
Public Guid As Integer Public Guid As Integer
End Class End Class
Public Sub New(pState As State, pDocument As EnvelopeDocument) Public Sub New(pState As State, pDocument As Document)
MyBase.New(pState) MyBase.New(pState)
Document = pDocument Document = pDocument

View File

@@ -17,7 +17,7 @@ Imports EnvelopeGenerator.Domain.Entities
Partial Public Class frmEnvelopeEditor Partial Public Class frmEnvelopeEditor
Public Property Envelope As Envelope Public Property Envelope As Envelope
Public Property Documents As New BindingList(Of EnvelopeDocument) Public Property Documents As New BindingList(Of Document)
Public Property Receivers As New BindingList(Of ReceiverVM) Public Property Receivers As New BindingList(Of ReceiverVM)
Private AllReceiverEmails As New List(Of String) Private AllReceiverEmails As New List(Of String)
@@ -104,10 +104,10 @@ Partial Public Class frmEnvelopeEditor
End If End If
Else Else
Controller = New EnvelopeEditorController(State, Envelope) Controller = New EnvelopeEditorController(State, Envelope)
Documents = New BindingList(Of EnvelopeDocument)(Controller.Envelope.Documents) Documents = New BindingList(Of Document)(Controller.Envelope.Documents)
Receivers = New BindingList(Of ReceiverVM)(Controller.Envelope.EnvelopeReceivers.Select(Function(r) ReceiverVM.From(r)).ToList()) Receivers = New BindingList(Of ReceiverVM)(Controller.Envelope.EnvelopeReceivers.Select(Function(r) ReceiverVM.From(r)).ToList())
For Each docItem As EnvelopeDocument In Documents For Each docItem As Document In Documents
If Not File.Exists(docItem.Filepath) Then If Not File.Exists(docItem.Filepath) Then
Dim oTempFolder = TempFiles._TempPath Dim oTempFolder = TempFiles._TempPath
Dim oTempFilename = String.Concat(oTempFolder, "\", $"ViewEnvDoc_{Envelope.Id}.pdf") Dim oTempFilename = String.Concat(oTempFolder, "\", $"ViewEnvDoc_{Envelope.Id}.pdf")
@@ -183,7 +183,7 @@ Partial Public Class frmEnvelopeEditor
Exit Sub Exit Sub
End If End If
Dim oDocument As EnvelopeDocument = DirectCast(ViewDocuments.GetFocusedRow(), EnvelopeDocument) Dim oDocument As Document = DirectCast(ViewDocuments.GetFocusedRow(), Document)
If Controller.DeleteDocument(oDocument) Then If Controller.DeleteDocument(oDocument) Then
Documents.Remove(oDocument) Documents.Remove(oDocument)
GridDocuments.DataSource = Nothing GridDocuments.DataSource = Nothing
@@ -213,7 +213,7 @@ Partial Public Class frmEnvelopeEditor
End If End If
If ViewDocuments.GetSelectedRows().Count > 0 Then If ViewDocuments.GetSelectedRows().Count > 0 Then
Dim oDocument As EnvelopeDocument = DirectCast(ViewDocuments.GetFocusedRow(), EnvelopeDocument) Dim oDocument As Document = DirectCast(ViewDocuments.GetFocusedRow(), Document)
Dim oEnvelope = Controller.Envelope Dim oEnvelope = Controller.Envelope
If Not IsNothing(oDocument.ByteData) Then If Not IsNothing(oDocument.ByteData) Then
Dim oTempFolder = TempFiles._TempPath Dim oTempFolder = TempFiles._TempPath

View File

@@ -18,7 +18,7 @@ Partial Public Class frmFieldEditor
Private Manager As AnnotationManager Private Manager As AnnotationManager
Private Controller As FieldEditorController Private Controller As FieldEditorController
Public Property Document As EnvelopeDocument = Nothing Public Property Document As Document = Nothing
Public Property Receivers As List(Of ReceiverVM) Public Property Receivers As List(Of ReceiverVM)
Public Property SelectedReceiver As ReceiverVM = Nothing Public Property SelectedReceiver As ReceiverVM = Nothing

View File

@@ -623,7 +623,7 @@ Public Class frmMain
Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(ViewEnvelopes.FocusedRowHandle) Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(ViewEnvelopes.FocusedRowHandle)
Dim oController = New EnvelopeEditorController(State, oEnvelope) Dim oController = New EnvelopeEditorController(State, oEnvelope)
Dim Documents As New BindingList(Of EnvelopeDocument) Dim Documents As New BindingList(Of Document)
Dim Receivers = New BindingList(Of ReceiverVM)(oController.Envelope.EnvelopeReceivers.Select(Function(r) ReceiverVM.From(r)).ToList()) Dim Receivers = New BindingList(Of ReceiverVM)(oController.Envelope.EnvelopeReceivers.Select(Function(r) ReceiverVM.From(r)).ToList())
For Each oReceiver As ReceiverVM In Receivers For Each oReceiver As ReceiverVM In Receivers
If oReceiver.EmailAddress = selReceiver.EmailAddress Then If oReceiver.EmailAddress = selReceiver.EmailAddress Then
@@ -871,7 +871,7 @@ Public Class frmMain
Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(ViewEnvelopes.FocusedRowHandle) Dim oEnvelope As Envelope = ViewEnvelopes.GetRow(ViewEnvelopes.FocusedRowHandle)
If oEnvelope.UseAccessCode = True Then If oEnvelope.UseAccessCode = True Then
Dim oController = New EnvelopeEditorController(State, oEnvelope) Dim oController = New EnvelopeEditorController(State, oEnvelope)
Dim Documents As New BindingList(Of EnvelopeDocument) Dim Documents As New BindingList(Of Document)
Dim Receivers = New BindingList(Of ReceiverVM)(oController.Envelope.EnvelopeReceivers.Select(Function(r) ReceiverVM.From(r)).ToList()) Dim Receivers = New BindingList(Of ReceiverVM)(oController.Envelope.EnvelopeReceivers.Select(Function(r) ReceiverVM.From(r)).ToList())
For Each oReceiver As ReceiverVM In Receivers For Each oReceiver As ReceiverVM In Receivers
If oReceiver.EmailAddress = selReceiver.EmailAddress Then If oReceiver.EmailAddress = selReceiver.EmailAddress Then

View File

@@ -58,7 +58,7 @@ public static class DIExtensions
services.AddDbRepository<EGDbContext, User>(context => context.Users).UseAutoMapper(); services.AddDbRepository<EGDbContext, User>(context => context.Users).UseAutoMapper();
services.AddDbRepository<EGDbContext, Config>(context => context.Configs).UseAutoMapper(); services.AddDbRepository<EGDbContext, Config>(context => context.Configs).UseAutoMapper();
services.AddDbRepository<EGDbContext, DocumentReceiverElement>(context => context.DocumentReceiverElements).UseAutoMapper(); services.AddDbRepository<EGDbContext, DocumentReceiverElement>(context => context.DocumentReceiverElements).UseAutoMapper();
services.AddDbRepository<EGDbContext, EnvelopeDocument>(context => context.EnvelopeDocument).UseAutoMapper(); services.AddDbRepository<EGDbContext, Document>(context => context.EnvelopeDocument).UseAutoMapper();
services.AddDbRepository<EGDbContext, DocumentStatus>(context => context.DocumentStatus).UseAutoMapper(); services.AddDbRepository<EGDbContext, DocumentStatus>(context => context.DocumentStatus).UseAutoMapper();
services.AddDbRepository<EGDbContext, EmailTemplate>(context => context.EmailTemplate).UseAutoMapper(); services.AddDbRepository<EGDbContext, EmailTemplate>(context => context.EmailTemplate).UseAutoMapper();
services.AddDbRepository<EGDbContext, EmailOut>(context => context.EMailOuts).UseAutoMapper(); services.AddDbRepository<EGDbContext, EmailOut>(context => context.EMailOuts).UseAutoMapper();
@@ -71,14 +71,14 @@ public static class DIExtensions
services.AddSQLExecutor<Envelope>(); services.AddSQLExecutor<Envelope>();
services.AddSQLExecutor<Receiver>(); services.AddSQLExecutor<Receiver>();
services.AddSQLExecutor<EnvelopeDocument>(); services.AddSQLExecutor<Document>();
services.AddSQLExecutor<DocumentReceiverElement>(); services.AddSQLExecutor<DocumentReceiverElement>();
services.AddSQLExecutor<DocumentStatus>(); services.AddSQLExecutor<DocumentStatus>();
SetDapperTypeMap<Envelope>(); SetDapperTypeMap<Envelope>();
SetDapperTypeMap<User>(); SetDapperTypeMap<User>();
SetDapperTypeMap<Receiver>(); SetDapperTypeMap<Receiver>();
SetDapperTypeMap<EnvelopeDocument>(); SetDapperTypeMap<Document>();
SetDapperTypeMap<DocumentReceiverElement>(); SetDapperTypeMap<DocumentReceiverElement>();
SetDapperTypeMap<DocumentStatus>(); SetDapperTypeMap<DocumentStatus>();

View File

@@ -29,7 +29,7 @@ public class EGDbContext : DbContext, IUserManagerDbContext, IMailDbContext
public DbSet<EmailTemplate> EmailTemplate { get; set; } public DbSet<EmailTemplate> EmailTemplate { get; set; }
public DbSet<EnvelopeDocument> EnvelopeDocument { get; set; } public DbSet<Document> EnvelopeDocument { get; set; }
public DbSet<EnvelopeHistory> EnvelopeHistories { get; set; } public DbSet<EnvelopeHistory> EnvelopeHistories { get; set; }
@@ -71,7 +71,7 @@ public class EGDbContext : DbContext, IUserManagerDbContext, IMailDbContext
Envelopes = Set<Envelope>(); Envelopes = Set<Envelope>();
DocumentReceiverElements = Set<DocumentReceiverElement>(); DocumentReceiverElements = Set<DocumentReceiverElement>();
DocumentStatus = Set<DocumentStatus>(); DocumentStatus = Set<DocumentStatus>();
EnvelopeDocument = Set<EnvelopeDocument>(); EnvelopeDocument = Set<Document>();
EnvelopeHistories = Set<EnvelopeHistory>(); EnvelopeHistories = Set<EnvelopeHistory>();
EnvelopeTypes = Set<EnvelopeType>(); EnvelopeTypes = Set<EnvelopeType>();
Receivers = Set<Receiver>(); Receivers = Set<Receiver>();
@@ -132,7 +132,7 @@ public class EGDbContext : DbContext, IUserManagerDbContext, IMailDbContext
#endregion Receiver #endregion Receiver
#region EnvelopeDocument #region EnvelopeDocument
modelBuilder.Entity<EnvelopeDocument>() modelBuilder.Entity<Document>()
.HasMany(ed => ed.Elements) .HasMany(ed => ed.Elements)
.WithOne(e => e.Document) .WithOne(e => e.Document)
.HasForeignKey(e => e.DocumentId); .HasForeignKey(e => e.DocumentId);
@@ -197,7 +197,7 @@ public class EGDbContext : DbContext, IUserManagerDbContext, IMailDbContext
AddTrigger<DocumentStatus>(); AddTrigger<DocumentStatus>();
AddTrigger<EmailTemplate>(); AddTrigger<EmailTemplate>();
AddTrigger<Envelope>(); AddTrigger<Envelope>();
AddTrigger<EnvelopeDocument>(); AddTrigger<Document>();
AddTrigger<EnvelopeHistory>(); AddTrigger<EnvelopeHistory>();
AddTrigger<EnvelopeReceiver>(); AddTrigger<EnvelopeReceiver>();
AddTrigger<EnvelopeReceiverReadOnly>(); AddTrigger<EnvelopeReceiverReadOnly>();

View File

@@ -14,14 +14,14 @@ public class DocumentExecutor : SQLExecutor, IDocumentExecutor
{ {
} }
public async Task<EnvelopeDocument> CreateDocumentAsync(string base64, string envelope_uuid, CancellationToken cancellation = default) public async Task<Document> CreateDocumentAsync(string base64, string envelope_uuid, CancellationToken cancellation = default)
{ {
using var connection = new SqlConnection(Params.ConnectionString); using var connection = new SqlConnection(Params.ConnectionString);
var sql = Provider.GetRequiredService<DocumentCreateReadSQL>(); var sql = Provider.GetRequiredService<DocumentCreateReadSQL>();
var formattedSql = string.Format(sql.Raw, envelope_uuid.ToSqlParam()); var formattedSql = string.Format(sql.Raw, envelope_uuid.ToSqlParam());
var param = DocumentCreateReadSQL.CreateParmas(base64); var param = DocumentCreateReadSQL.CreateParmas(base64);
await connection.OpenAsync(cancellation); await connection.OpenAsync(cancellation);
var documents = await connection.QueryAsync<EnvelopeDocument>(formattedSql, param); var documents = await connection.QueryAsync<Document>(formattedSql, param);
return documents.FirstOrDefault() return documents.FirstOrDefault()
?? throw new InvalidOperationException($"Document creation failed. Parameters:" + ?? throw new InvalidOperationException($"Document creation failed. Parameters:" +
$"base64={base64}, envelope_uuid='{envelope_uuid}'."); $"base64={base64}, envelope_uuid='{envelope_uuid}'.");

View File

@@ -5,7 +5,7 @@ using EnvelopeGenerator.Application.Interfaces.Repositories;
namespace EnvelopeGenerator.Infrastructure.Repositories; namespace EnvelopeGenerator.Infrastructure.Repositories;
[Obsolete("Use IRepository")] [Obsolete("Use IRepository")]
public class EnvelopeDocumentRepository : CRUDRepository<EnvelopeDocument, int, EGDbContext>, IEnvelopeDocumentRepository public class EnvelopeDocumentRepository : CRUDRepository<Document, int, EGDbContext>, IEnvelopeDocumentRepository
{ {
public EnvelopeDocumentRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeDocument) public EnvelopeDocumentRepository(EGDbContext dbContext) : base(dbContext, dbContext.EnvelopeDocument)
{ {

View File

@@ -192,7 +192,7 @@ public static class Extensions
string lorem = faker.Lorem.Paragraphs(2); string lorem = faker.Lorem.Paragraphs(2);
QuestPDF.Settings.License = LicenseType.Community; QuestPDF.Settings.License = LicenseType.Community;
var document = Document.Create(container => var document = QuestPDF.Fluent.Document.Create(container =>
{ {
container.Page(page => container.Page(page =>
{ {

View File

@@ -5,7 +5,7 @@ using EnvelopeGenerator.Application.Common.Dto;
namespace EnvelopeGenerator.Web.Controllers.Test; namespace EnvelopeGenerator.Web.Controllers.Test;
[Obsolete("Use MediatR")] [Obsolete("Use MediatR")]
public class TestEnvelopeDocumentController : TestControllerBase<IEnvelopeDocumentService, DocumentDto, EnvelopeDocument, int> public class TestEnvelopeDocumentController : TestControllerBase<IEnvelopeDocumentService, DocumentDto, Document, int>
{ {
public TestEnvelopeDocumentController(ILogger<TestEnvelopeDocumentController> logger, IEnvelopeDocumentService service) : base(logger, service) public TestEnvelopeDocumentController(ILogger<TestEnvelopeDocumentController> logger, IEnvelopeDocumentService service) : base(logger, service)
{ {