Compare commits
5 Commits
519df50404
...
d873d6dcf1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d873d6dcf1 | ||
|
|
41e0c51055 | ||
|
|
126370ebdb | ||
|
|
629c0d51b2 | ||
|
|
b15616cf53 |
@@ -20,4 +20,4 @@ namespace EnvelopeGenerator.Application.EmailTemplates.Commands.Reset;
|
||||
/// 8 - DocumentRejected_REC (Für den ablehnenden Empfänger): Mail an den ablehnenden Empfänger, wenn das Dokument abgelehnt wird.
|
||||
/// 9 - DocumentRejected_REC_2 (Für sonstige Empfänger): Mail an andere Empfänger (Brief), wenn das Dokument abgelehnt wird.
|
||||
/// </param>
|
||||
public record ResetEnvelopeTemplateCommand(int? Id = null, Constants.EmailTemplateType? Type = null) : EmailTemplateQuery(Id, Type), IRequest;
|
||||
public record ResetEmailTemplateCommand(int? Id = null, Constants.EmailTemplateType? Type = null) : EmailTemplateQuery(Id, Type), IRequest;
|
||||
@@ -9,7 +9,7 @@ namespace EnvelopeGenerator.Application.EmailTemplates.Commands.Reset;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class ResetEnvelopeTemplateCommandHandler : IRequestHandler<ResetEnvelopeTemplateCommand>
|
||||
public class ResetEmailTemplateCommandHandler : IRequestHandler<ResetEmailTemplateCommand>
|
||||
{
|
||||
private readonly IRepository<EmailTemplate> _repository;
|
||||
|
||||
@@ -17,12 +17,12 @@ public class ResetEnvelopeTemplateCommandHandler : IRequestHandler<ResetEnvelope
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="repository"></param>
|
||||
public ResetEnvelopeTemplateCommandHandler(IRepository<EmailTemplate> repository)
|
||||
public ResetEmailTemplateCommandHandler(IRepository<EmailTemplate> repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
public async Task Handle(ResetEnvelopeTemplateCommand request, CancellationToken cancel)
|
||||
public async Task Handle(ResetEmailTemplateCommand request, CancellationToken cancel)
|
||||
{
|
||||
var temps = request.Id is not null
|
||||
? await _repository.ReadAllAsync<EmailTemplateDto>(t => t.Id == request.Id, cancel)
|
||||
@@ -24,6 +24,14 @@ public class UpdateEmailTemplateCommandHandler : IRequestHandler<UpdateEmailTemp
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <param name="cancel"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="InvalidOperationException"></exception>
|
||||
/// <exception cref="NotFoundException"></exception>
|
||||
public async Task Handle(UpdateEmailTemplateCommand request, CancellationToken cancel)
|
||||
{
|
||||
var temp = (request.EmailTemplateQuery?.Id is int id
|
||||
|
||||
@@ -45,6 +45,8 @@ public class ReadEmailTemplateQueryHandler : IRequestHandler<ReadEmailTemplateQu
|
||||
? await _repository.ReadByNameAsync(type)
|
||||
: throw new InvalidOperationException("Either a valid integer ID or a valid EmailTemplateType must be provided in the request.");
|
||||
|
||||
return temp is null ? null : _mapper.Map<ReadEmailTemplateResponse>(temp);
|
||||
var res = _mapper.Map<ReadEmailTemplateResponse>(temp);
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,17 +8,17 @@ public class ReadEmailTemplateResponse
|
||||
/// <summary>
|
||||
/// Die eindeutige Kennung der E-Mail-Vorlage.
|
||||
/// </summary>
|
||||
public int Id { get; init; }
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Der Typ der E-Mail-Vorlage.
|
||||
/// Name des Typs
|
||||
/// </summary>
|
||||
public int Type { get; init; }
|
||||
public required string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Das Datum und die Uhrzeit, wann die Vorlage hinzugefügt wurde.
|
||||
/// </summary>
|
||||
public DateTime AddedWhen { get; init; }
|
||||
public DateTime AddedWhen { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Der Inhalt (Body) der E-Mail-Vorlage. Kann null sein.
|
||||
|
||||
@@ -25,12 +25,12 @@ public record Signature([Required] double X, [Required] double Y, [Required] int
|
||||
/// <param name="PhoneNumber">Sollte mit Vorwahl geschrieben werden</param>
|
||||
public record ReceiverGetOrCreateCommand([Required] IEnumerable<Signature> Signatures, string? Salution = null, string? PhoneNumber = null)
|
||||
{
|
||||
private string? _emailAddress = "h.tek@digitaldata.works";
|
||||
private string? _emailAddress;
|
||||
|
||||
/// <summary>
|
||||
/// E-Mail-Adresse des Empfängers.
|
||||
/// </summary>
|
||||
public string? EmailAddress { get => _emailAddress?.ToLower(); init => _emailAddress = _emailAddress?.ToLower() ?? "h.tek@digitaldata.works"; }
|
||||
public string? EmailAddress { get => _emailAddress?.ToLower(); init => _emailAddress = _emailAddress?.ToLower(); }
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -14,11 +14,11 @@ public class DocumentCreateReadSQL : ISQL<EnvelopeDocument>
|
||||
/// </summary>
|
||||
public string Raw => @"
|
||||
DECLARE @BYTE_DATA1 as VARBINARY(MAX)
|
||||
SET @BYTE_DATA1 = CONVERT(VARBINARY(MAX),{0})
|
||||
SET @BYTE_DATA1 = @ByteData
|
||||
DECLARE @OUT_DOCID int
|
||||
|
||||
EXEC [dbo].[PRSIG_API_ADD_DOC]
|
||||
{1},
|
||||
{0},
|
||||
@BYTE_DATA1,
|
||||
@OUT_DOCID OUTPUT
|
||||
|
||||
@@ -31,13 +31,12 @@ public class DocumentCreateReadSQL : ISQL<EnvelopeDocument>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="base64"></param>
|
||||
/// <param name="envelope_uuid"></param>
|
||||
/// <returns></returns>
|
||||
public static DynamicParameters CreateParmas(string base64, string envelope_uuid)
|
||||
public static DynamicParameters CreateParmas(string base64)
|
||||
{
|
||||
var parameters = new DynamicParameters();
|
||||
parameters.Add("@Base64", base64);
|
||||
parameters.Add("@OUT_UID", envelope_uuid);
|
||||
byte[] byteData = Convert.FromBase64String(base64);
|
||||
parameters.Add("ByteData", byteData, System.Data.DbType.Binary);
|
||||
return parameters;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
@@ -20,5 +21,13 @@ namespace EnvelopeGenerator.Domain.Entities
|
||||
|
||||
[Column("SUBJECT", TypeName = "nvarchar(512)")]
|
||||
public string? Subject { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("ADDED_WHEN", TypeName = "datetime")]
|
||||
[DefaultValue("GETDATE()")]
|
||||
public DateTime AddedWhen { get; set; }
|
||||
|
||||
[Column("CHANGED_WHEN", TypeName = "datetime")]
|
||||
public DateTime? ChangedWhen { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -111,13 +111,13 @@ public class EmailTemplateController : ControllerBase
|
||||
{
|
||||
if (update is null)
|
||||
{
|
||||
var reset = _mapper.Map<ResetEnvelopeTemplateCommand>(email);
|
||||
await _mediator.Send(new ResetEnvelopeTemplateCommand(email?.Id, email?.Type));
|
||||
var reset = _mapper.Map<ResetEmailTemplateCommand>(email);
|
||||
await _mediator.Send(new ResetEmailTemplateCommand(email?.Id, email?.Type));
|
||||
return Ok();
|
||||
}
|
||||
else
|
||||
{
|
||||
var reset = _mapper.Map<ResetEnvelopeTemplateCommand>(email);
|
||||
var reset = _mapper.Map<ResetEmailTemplateCommand>(email);
|
||||
await _mediator.Send(update);
|
||||
return Ok();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Data;
|
||||
using System.Threading.Channels;
|
||||
|
||||
namespace EnvelopeGenerator.GeneratorAPI.Controllers;
|
||||
|
||||
@@ -55,6 +54,8 @@ public class EnvelopeReceiverController : ControllerBase
|
||||
/// <param name="mapper"></param>
|
||||
/// <param name="envelopeExecutor"></param>
|
||||
/// <param name="erExecutor"></param>
|
||||
/// <param name="documentExecutor"></param>
|
||||
/// <param name="csOpt"></param>
|
||||
public EnvelopeReceiverController(ILogger<EnvelopeReceiverController> logger, IEnvelopeReceiverService envelopeReceiverService, IMediator mediator, IMapper mapper, IEnvelopeExecutor envelopeExecutor, IEnvelopeReceiverExecutor erExecutor, IDocumentExecutor documentExecutor, IOptions<ConnectionString> csOpt)
|
||||
{
|
||||
_logger = logger;
|
||||
|
||||
@@ -18,9 +18,10 @@ public class DocumentExecutor : SQLExecutor, IDocumentExecutor
|
||||
{
|
||||
using var connection = new SqlConnection(Params.ConnectionString);
|
||||
var sql = Provider.GetRequiredService<DocumentCreateReadSQL>();
|
||||
var formattedSql = string.Format(sql.Raw, base64.ToSqlParam(), envelope_uuid.ToSqlParam());
|
||||
var formattedSql = string.Format(sql.Raw, envelope_uuid.ToSqlParam());
|
||||
var param = DocumentCreateReadSQL.CreateParmas(base64);
|
||||
await connection.OpenAsync(cancellation);
|
||||
var documents = await connection.QueryAsync<EnvelopeDocument>(formattedSql);
|
||||
var documents = await connection.QueryAsync<EnvelopeDocument>(formattedSql, param);
|
||||
return documents.FirstOrDefault()
|
||||
?? throw new InvalidOperationException($"Document creation failed. Parameters:" +
|
||||
$"base64={base64}, envelope_uuid='{envelope_uuid}'.");
|
||||
|
||||
@@ -16,6 +16,7 @@ using EnvelopeGenerator.Infrastructure;
|
||||
using EnvelopeGenerator.Web.Sanitizers;
|
||||
using EnvelopeGenerator.Application.Contracts.Services;
|
||||
using EnvelopeGenerator.Web.Models.Annotation;
|
||||
using DigitalData.UserManager.DependencyInjection;
|
||||
|
||||
var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger();
|
||||
logger.Info("Logging initialized!");
|
||||
@@ -168,6 +169,8 @@ try
|
||||
|
||||
builder.ConfigureBySection<AnnotationParams>();
|
||||
|
||||
builder.Services.AddUserManager<EGDbContext>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
|
||||
Reference in New Issue
Block a user