Compare commits
11 Commits
81220ac9b4
...
8d6d483c5d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d6d483c5d | ||
|
|
824bf6fb82 | ||
|
|
0c6fd2efe3 | ||
|
|
1f4cf54406 | ||
|
|
a6635f4a20 | ||
|
|
ed25482cee | ||
|
|
1664b5739e | ||
|
|
0ef9d3c49e | ||
|
|
86bdb233c2 | ||
|
|
bc6972bcfb | ||
|
|
2e66129485 |
@@ -1,11 +0,0 @@
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IEmailOutService : IBasicCRUDService<IEmailOutRepository, EmailOutDto, EmailOut, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,14 @@
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
using static EnvelopeGenerator.Common.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IEmailTemplateService : IBasicCRUDService<IEmailTemplateRepository, EmailTemplateDto, EmailTemplate, int>
|
||||
{
|
||||
Task<DataResult<EmailTemplateDto>> ReadByNameAsync(EmailTemplateType type);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,20 @@
|
||||
using DigitalData.Core.Contracts.Application;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeHistory;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
using static EnvelopeGenerator.Common.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IEnvelopeHistoryService : IBasicCRUDService<IEnvelopeHistoryRepository, EnvelopeHistoryDto, EnvelopeHistory, long>
|
||||
public interface IEnvelopeHistoryService : ICRUDService<IEnvelopeHistoryRepository, EnvelopeHistoryCreateDto, EnvelopeHistoryDto, EnvelopeHistoryDto, EnvelopeHistory, long>
|
||||
{
|
||||
Task<int> CountAsync(int? envelopeId = null, string? userReference = null, int? status = null);
|
||||
|
||||
Task<bool> AccessCodeAlreadyRequested(int envelopeId, string userReference);
|
||||
|
||||
Task<bool> IsSigned(int envelopeId, string userReference);
|
||||
|
||||
Task<DataResult<long>> RecordAsync(int envelopeId, string userReference, EnvelopeStatus status);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using DigitalData.EmailProfilerDispatcher.Application.Contracts;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Contracts
|
||||
{
|
||||
public interface IEnvelopeMailService : IEmailOutService
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
{
|
||||
public record EmailOutDto(
|
||||
int Guid,
|
||||
int ReminderTypeId,
|
||||
int SendingProfile,
|
||||
int ReferenceId,
|
||||
string? ReferenceString,
|
||||
int? EntityId,
|
||||
int WfId,
|
||||
string? WfReference,
|
||||
string EmailAdress,
|
||||
string EmailSubj,
|
||||
string EmailBody,
|
||||
string? EmailAttmt1,
|
||||
DateTime? EmailSent,
|
||||
string? Comment,
|
||||
string AddedWho,
|
||||
DateTime? AddedWhen,
|
||||
string? ChangedWho,
|
||||
DateTime? ChangedWhen,
|
||||
DateTime? ErrorTimestamp,
|
||||
string? ErrorMsg
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using DigitalData.UserManager.Domain.Entities;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeHistory;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory
|
||||
{
|
||||
public record EnvelopeHistoryCreateDto(
|
||||
int EnvelopeId,
|
||||
string UserReference,
|
||||
int Status,
|
||||
DateTime? ActionDate);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace EnvelopeGenerator.Application.DTOs
|
||||
namespace EnvelopeGenerator.Application.DTOs.EnvelopeHistory
|
||||
{
|
||||
public record EnvelopeHistoryDto(
|
||||
long Id,
|
||||
@@ -28,6 +28,15 @@
|
||||
<Reference Include="DigitalData.Core.Infrastructure">
|
||||
<HintPath>..\..\WebUserManager\DigitalData.UserManager.Application\bin\Debug\net7.0\DigitalData.Core.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.EmailProfilerDispatcher.Application">
|
||||
<HintPath>..\..\EmailProfilerDispatcher\DigitalData.EmailProfilerDispatcher.Application\bin\Debug\net7.0\DigitalData.EmailProfilerDispatcher.Application.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.EmailProfilerDispatcher.Domain">
|
||||
<HintPath>..\..\EmailProfilerDispatcher\DigitalData.EmailProfilerDispatcher.Application\bin\Debug\net7.0\DigitalData.EmailProfilerDispatcher.Domain.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.EmailProfilerDispatcher.Infrastructure">
|
||||
<HintPath>..\..\EmailProfilerDispatcher\DigitalData.EmailProfilerDispatcher.Application\bin\Debug\net7.0\DigitalData.EmailProfilerDispatcher.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.UserManager.Application">
|
||||
<HintPath>..\..\WebUserManager\DigitalData.UserManager.Application\bin\Debug\net7.0\DigitalData.UserManager.Application.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -2,16 +2,18 @@
|
||||
{
|
||||
public static class Key
|
||||
{
|
||||
public static readonly string EnvelopeNotFound = "EnvelopeNotFound";
|
||||
public static readonly string EnvelopeReceiverNotFound = "EnvelopeReceiverNotFound";
|
||||
public static readonly string AccessCodeNull = "AccessCodeNull";
|
||||
public static readonly string WrongAccessCode = "WrongAccessCode";
|
||||
public static readonly string DataIntegrityIssue = "DataIntegrityIssue";
|
||||
public static readonly string SecurityBreachOrDataIntegrity = "SecurityBreachOrDataIntegrity";
|
||||
public static readonly string PossibleDataIntegrityIssue = "PossibleDataIntegrityIssue";
|
||||
public static readonly string SecurityBreach = "SecurityBreach";
|
||||
public static readonly string PossibleSecurityBreach = "PossibleSecurityBreach";
|
||||
public static readonly string WrongEnvelopeReceiverId = "WrongEnvelopeReceiverId";
|
||||
public static readonly string EnvelopeOrReceiverNonexists = "EnvelopeOrReceiverNonexists";
|
||||
public static readonly string InnerServiceError = nameof(InnerServiceError);
|
||||
public static readonly string EnvelopeNotFound = nameof(EnvelopeNotFound);
|
||||
public static readonly string EnvelopeReceiverNotFound = nameof(EnvelopeReceiverNotFound);
|
||||
public static readonly string AccessCodeNull = nameof(AccessCodeNull);
|
||||
public static readonly string WrongAccessCode = nameof(WrongAccessCode);
|
||||
public static readonly string DataIntegrityIssue = nameof(DataIntegrityIssue);
|
||||
public static readonly string SecurityBreachOrDataIntegrity = nameof(SecurityBreachOrDataIntegrity);
|
||||
public static readonly string PossibleDataIntegrityIssue = nameof(PossibleDataIntegrityIssue);
|
||||
public static readonly string SecurityBreach = nameof(SecurityBreach);
|
||||
public static readonly string PossibleSecurityBreach = nameof(PossibleSecurityBreach);
|
||||
public static readonly string WrongEnvelopeReceiverId = nameof(WrongEnvelopeReceiverId);
|
||||
public static readonly string EnvelopeOrReceiverNonexists = nameof(EnvelopeOrReceiverNonexists);
|
||||
public static readonly string Default = nameof(Default);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using AutoMapper;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeHistory;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Application.MappingProfiles
|
||||
@@ -17,11 +18,11 @@ namespace EnvelopeGenerator.Application.MappingProfiles
|
||||
CreateMap<EnvelopeCertificate, EnvelopeCertificateDto>();
|
||||
CreateMap<EnvelopeDocument, EnvelopeDocumentDto>();
|
||||
CreateMap<EnvelopeHistory, EnvelopeHistoryDto>();
|
||||
CreateMap<EnvelopeHistory, EnvelopeHistoryCreateDto>();
|
||||
CreateMap<EnvelopeReceiver, EnvelopeReceiverDto>();
|
||||
CreateMap<EnvelopeType, EnvelopeTypeDto>();
|
||||
CreateMap<Receiver, ReceiverDto>();
|
||||
CreateMap<UserReceiver, UserReceiverDto>();
|
||||
CreateMap<EmailOut, EmailOutDto>();
|
||||
|
||||
// DTO to Entity mappings
|
||||
CreateMap<ConfigDto, Config>();
|
||||
@@ -32,11 +33,11 @@ namespace EnvelopeGenerator.Application.MappingProfiles
|
||||
CreateMap<EnvelopeCertificateDto, EnvelopeCertificate>();
|
||||
CreateMap<EnvelopeDocumentDto, EnvelopeDocument>();
|
||||
CreateMap<EnvelopeHistoryDto, EnvelopeHistory>();
|
||||
CreateMap<EnvelopeHistoryCreateDto, EnvelopeHistory>();
|
||||
CreateMap<EnvelopeReceiverDto, EnvelopeReceiver>();
|
||||
CreateMap<EnvelopeTypeDto, EnvelopeType>();
|
||||
CreateMap<ReceiverDto, Receiver>();
|
||||
CreateMap<UserReceiverDto, UserReceiver>();
|
||||
CreateMap<EmailOutDto, EmailOut>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Application;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Application.Resources;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Services
|
||||
{
|
||||
public class EmailOutService : BasicCRUDService<IEmailOutRepository, EmailOutDto, EmailOut, int>, IEmailOutService
|
||||
{
|
||||
public EmailOutService(IEmailOutRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, localizer, mapper)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,9 @@ using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
using EnvelopeGenerator.Application.Resources;
|
||||
using static EnvelopeGenerator.Common.Constants;
|
||||
using DigitalData.Core.DTO;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Services
|
||||
{
|
||||
@@ -15,5 +18,15 @@ namespace EnvelopeGenerator.Application.Services
|
||||
: base(repository, localizer, mapper)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<DataResult<EmailTemplateDto>> ReadByNameAsync(EmailTemplateType type)
|
||||
{
|
||||
var temp = await _repository.ReadByNameAsync(type);
|
||||
return temp is null
|
||||
? Result.Fail<EmailTemplateDto>()
|
||||
.Message(Key.InnerServiceError)
|
||||
.Notice(LogLevel.Error, Flag.DataIntegrityIssue, $"EmailTemplateType '{type}' is not found in DB. Please, define required e-mail template.")
|
||||
: Result.Success(_mapper.MapOrThrow<EmailTemplateDto>(temp));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,16 @@
|
||||
using DigitalData.Core.Application;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
using static EnvelopeGenerator.Common.Constants;
|
||||
using EnvelopeGenerator.Application.Resources;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeHistory;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Services
|
||||
{
|
||||
public class EnvelopeHistoryService : BasicCRUDService<IEnvelopeHistoryRepository, EnvelopeHistoryDto, EnvelopeHistory, long>, IEnvelopeHistoryService
|
||||
public class EnvelopeHistoryService : CRUDService<IEnvelopeHistoryRepository, EnvelopeHistoryCreateDto, EnvelopeHistoryDto, EnvelopeHistoryDto, EnvelopeHistory, long>, IEnvelopeHistoryService
|
||||
{
|
||||
public EnvelopeHistoryService(IEnvelopeHistoryRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper)
|
||||
: base(repository, localizer, mapper)
|
||||
@@ -33,5 +34,12 @@ namespace EnvelopeGenerator.Application.Services
|
||||
envelopeId: envelopeId,
|
||||
userReference: userReference,
|
||||
status: (int) EnvelopeStatus.DocumentSigned) > 0;
|
||||
|
||||
public async Task<DataResult<long>> RecordAsync(int envelopeId, string userReference, EnvelopeStatus status) =>
|
||||
await CreateAsync(new (EnvelopeId: envelopeId, UserReference: userReference, Status: (int)status, ActionDate: DateTime.Now))
|
||||
.ThenAsync(
|
||||
Success: id => Result.Success(id),
|
||||
Fail: (mssg, ntc) => Result.Fail<long>().Message(mssg).Notice(ntc)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.EmailProfilerDispatcher.Application.Services;
|
||||
using DigitalData.EmailProfilerDispatcher.Infrastructure.Contracts;
|
||||
using DigitalData.UserManager.Application;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using Microsoft.Extensions.Localization;
|
||||
namespace EnvelopeGenerator.Application.Services
|
||||
{
|
||||
public class EnvelopeMailService : EmailOutService<Resource>, IEnvelopeMailService
|
||||
{
|
||||
public EnvelopeMailService(IEmailOutRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper, IEmailTemplateService tempService) : base(repository, localizer, mapper)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace EnvelopeGenerator.Domain.Entities
|
||||
{
|
||||
[Table("TBEMLP_EMAIL_OUT", Schema = "dbo")]
|
||||
public class EmailOut
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
[Column("GUID")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("REMINDER_TYPE_ID")]
|
||||
public int ReminderTypeId { get; set; } = 1; // Default value
|
||||
|
||||
[Required]
|
||||
[Column("SENDING_PROFILE")]
|
||||
public int SendingProfile { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("REFERENCE_ID")]
|
||||
public int ReferenceId { get; set; }
|
||||
|
||||
[StringLength(200)]
|
||||
[Column("REFERENCE_STRING")]
|
||||
public string ReferenceString { get; set; }
|
||||
|
||||
[Column("ENTITY_ID")]
|
||||
public int? EntityId { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("WF_ID")]
|
||||
public int WfId { get; set; }
|
||||
|
||||
[StringLength(200)]
|
||||
[Column("WF_REFERENCE")]
|
||||
public string WfReference { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(1000)]
|
||||
[Column("EMAIL_ADRESS")]
|
||||
public string EmailAdress { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(500)]
|
||||
[Column("EMAIL_SUBJ")]
|
||||
public string EmailSubj { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("EMAIL_BODY")]
|
||||
public string EmailBody { get; set; }
|
||||
|
||||
[StringLength(512)]
|
||||
[Column("EMAIL_ATTMT1")]
|
||||
public string EmailAttmt1 { get; set; }
|
||||
|
||||
[Column("EMAIL_SENT")]
|
||||
public DateTime? EmailSent { get; set; }
|
||||
|
||||
[StringLength(500)]
|
||||
[Column("COMMENT")]
|
||||
public string Comment { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(50)]
|
||||
[Column("ADDED_WHO")]
|
||||
public string AddedWho { get; set; } = "DEFAULT"; // Default value
|
||||
|
||||
[Column("ADDED_WHEN")]
|
||||
public DateTime? AddedWhen { get; set; } = DateTime.Now; // Default value
|
||||
|
||||
[StringLength(50)]
|
||||
[Column("CHANGED_WHO")]
|
||||
public string ChangedWho { get; set; }
|
||||
|
||||
[Column("CHANGED_WHEN")]
|
||||
public DateTime? ChangedWhen { get; set; }
|
||||
|
||||
[Column("ERROR_TIMESTAMP")]
|
||||
public DateTime? ErrorTimestamp { get; set; }
|
||||
|
||||
[StringLength(900)]
|
||||
[Column("ERROR_MSG")]
|
||||
public string ErrorMsg { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@ namespace EnvelopeGenerator.Domain.Entities
|
||||
|
||||
[Required]
|
||||
[Column("ADDED_WHEN", TypeName = "datetime")]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
public DateTime AddedWhen { get; set; }
|
||||
|
||||
[Column("ACTION_DATE", TypeName = "datetime")]
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
using DigitalData.Core.Contracts.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure.Contracts
|
||||
{
|
||||
public interface IEmailOutRepository : ICRUDRepository<EmailOut, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
using DigitalData.Core.Contracts.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using static EnvelopeGenerator.Common.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure.Contracts
|
||||
{
|
||||
public interface IEmailTemplateRepository : ICRUDRepository<EmailTemplate, int>
|
||||
{
|
||||
Task<EmailTemplate?> ReadByNameAsync(EmailTemplateType type);
|
||||
}
|
||||
}
|
||||
@@ -33,11 +33,6 @@ namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
.WithOne()
|
||||
.HasForeignKey(ed => ed.EnvelopeId);
|
||||
|
||||
//modelBuilder.Entity<Envelope>()
|
||||
// .HasMany(e => e.Receivers)
|
||||
// .WithOne(er => er.Envelope)
|
||||
// .HasForeignKey(er => er.EnvelopeId);
|
||||
|
||||
modelBuilder.Entity<Envelope>()
|
||||
.HasMany(e => e.History)
|
||||
.WithOne()
|
||||
@@ -53,10 +48,9 @@ namespace DigitalData.UserManager.Infrastructure.Repositories
|
||||
.WithMany(ed => ed.Elements)
|
||||
.HasForeignKey(dre => dre.DocumentId);
|
||||
|
||||
//modelBuilder.Entity<Receiver>()
|
||||
// .HasMany(e => e.EnvelopeReceivers)
|
||||
// .WithOne(er => er.Receiver)
|
||||
// .HasForeignKey(er => er.ReceiverId);
|
||||
// Configure entities to handle database triggers
|
||||
modelBuilder.Entity<Envelope>().ToTable(tb => tb.HasTrigger("TBSIG_ENVELOPE_HISTORY_AFT_INS"));
|
||||
modelBuilder.Entity<EnvelopeHistory>().ToTable(tb => tb.HasTrigger("TBSIG_ENVELOPE_HISTORY_AFT_INS"));
|
||||
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
using DigitalData.Core.Infrastructure;
|
||||
using DigitalData.UserManager.Infrastructure.Repositories;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure.Repositories
|
||||
{
|
||||
public class EmailOutRepository : CRUDRepository<EmailOut, int, EGDbContext>, IEmailOutRepository
|
||||
{
|
||||
public EmailOutRepository(EGDbContext dbContext) : base(dbContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
using DigitalData.UserManager.Infrastructure.Repositories;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using static EnvelopeGenerator.Common.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure.Repositories
|
||||
{
|
||||
@@ -10,5 +12,7 @@ namespace EnvelopeGenerator.Infrastructure.Repositories
|
||||
public EmailTemplateRepository(EGDbContext dbContext) : base(dbContext)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<EmailTemplate?> ReadByNameAsync(EmailTemplateType type) => await _dbSet.Where(t => t.Name == type.ToString()).FirstOrDefaultAsync();
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ namespace EnvelopeGenerator.Infrastructure.Repositories
|
||||
|
||||
if (withEnvelope)
|
||||
query = query
|
||||
.Include(er => er.Envelope).ThenInclude(e => e!.Documents!).ThenInclude(d => d.Elements)
|
||||
.Include(er => er.Envelope).ThenInclude(e => e!.Documents!).ThenInclude(d => d.Elements!.Where(e => signature == null || e.Receiver!.Signature == signature))
|
||||
.Include(er => er.Envelope).ThenInclude(e => e!.History)
|
||||
.Include(er => er.Envelope).ThenInclude(e => e!.User);
|
||||
|
||||
|
||||
63
EnvelopeGenerator.Web/.gitattributes
vendored
63
EnvelopeGenerator.Web/.gitattributes
vendored
@@ -1,63 +0,0 @@
|
||||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
||||
363
EnvelopeGenerator.Web/.gitignore
vendored
363
EnvelopeGenerator.Web/.gitignore
vendored
@@ -1,363 +0,0 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Oo]ut/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
@@ -56,8 +56,8 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
bool accessCodeAlreadyRequested = await _historyService.AccessCodeAlreadyRequested(envelopeId: er.Envelope!.Id, userReference: er.Receiver!.EmailAddress);
|
||||
if (!accessCodeAlreadyRequested)
|
||||
{
|
||||
// Send email with password
|
||||
bool actionResult = database.Services.actionService.RequestAccessCode(response.Envelope, response.Receiver);
|
||||
await _historyService.RecordAsync(er.EnvelopeId, er.Receiver.EmailAddress, Constants.EnvelopeStatus.AccessCodeRequested);
|
||||
|
||||
bool result = database.Services.emailService.SendDocumentAccessCodeReceivedEmail(response.Envelope, response.Receiver);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
}
|
||||
|
||||
[HttpGet("EnvelopeKey/{envelopeReceiverId}/Locked")]
|
||||
public async Task<IActionResult> EnvelopeLocked([FromRoute] string envelopeReceiverId, [FromQuery] string? culture)
|
||||
public async Task<IActionResult> EnvelopeLocked([FromRoute] string envelopeReceiverId, [FromQuery] string? culture = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -89,13 +89,10 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
UserLanguage = _cultures.Default.Language;
|
||||
return Redirect($"{Request.Headers["Referer"]}?culture={_cultures.Default.Language}");
|
||||
}
|
||||
|
||||
if (UserLanguage is not null && culture is not null)
|
||||
{
|
||||
else if (UserLanguage is not null && culture is not null)
|
||||
return Redirect($"Locked");
|
||||
}
|
||||
|
||||
ViewData["UserLanguage"] = UserLanguage;
|
||||
ViewData["UserLanguage"] = UserLanguage ?? culture;
|
||||
|
||||
return await _envRcvService.IsExisting(envelopeReceiverId: envelopeReceiverId).ThenAsync(
|
||||
Success: isExisting => isExisting ? View().WithData("EnvelopeKey", envelopeReceiverId) : this.ViewEnvelopeNotFound(),
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Security.Cryptography;
|
||||
using static EnvelopeGenerator.Common.Constants;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
@@ -9,7 +13,23 @@ namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
public TestEmailTemplateController(ILogger<TestEmailTemplateController> logger, IEmailTemplateService service) : base(logger, service)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public virtual async Task<IActionResult> GetAll([FromQuery] string? tempType = null)
|
||||
{
|
||||
return tempType is null
|
||||
? await base.GetAll()
|
||||
: await _service.ReadByNameAsync((EmailTemplateType)Enum.Parse(typeof(EmailTemplateType), tempType)).ThenAsync(
|
||||
Success: Ok,
|
||||
Fail: IActionResult (messages, notices) =>
|
||||
{
|
||||
_logger.LogNotice(notices);
|
||||
return NotFound(messages);
|
||||
});
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public override Task<IActionResult> GetAll() => base.GetAll();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
using DigitalData.Core.API;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeHistory;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
public class TestEnvelopeHistoryController : TestControllerBase<IEnvelopeHistoryService, IEnvelopeHistoryRepository, EnvelopeHistoryDto, EnvelopeHistory, long>
|
||||
public class TestEnvelopeHistoryController : CRUDControllerBase<IEnvelopeHistoryService, IEnvelopeHistoryRepository, EnvelopeHistoryCreateDto, EnvelopeHistoryDto, EnvelopeHistoryDto, EnvelopeHistory, long>
|
||||
{
|
||||
public TestEnvelopeHistoryController(ILogger<TestEnvelopeHistoryController> logger, IEnvelopeHistoryService service) : base(logger, service)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace EnvelopeGenerator.Web.Controllers.Test
|
||||
{
|
||||
try
|
||||
{
|
||||
var passwordFromConfig = _config["Config:AdminPassword"];
|
||||
var passwordFromConfig = _config["AdminPassword"];
|
||||
|
||||
if (passwordFromConfig == null)
|
||||
{
|
||||
|
||||
@@ -62,6 +62,15 @@
|
||||
<Reference Include="DigitalData.Core.Infrastructure">
|
||||
<HintPath>..\..\WebCoreModules\DigitalData.Core.Infrastructure\bin\Debug\net7.0\DigitalData.Core.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.EmailProfilerDispatcher.Application">
|
||||
<HintPath>..\..\EmailProfilerDispatcher\DigitalData.EmailProfilerDispatcher.Application\bin\Debug\net7.0\DigitalData.EmailProfilerDispatcher.Application.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.EmailProfilerDispatcher.Domain">
|
||||
<HintPath>..\..\EmailProfilerDispatcher\DigitalData.EmailProfilerDispatcher.Application\bin\Debug\net7.0\DigitalData.EmailProfilerDispatcher.Domain.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.EmailProfilerDispatcher.Infrastructure">
|
||||
<HintPath>..\..\EmailProfilerDispatcher\DigitalData.EmailProfilerDispatcher.Application\bin\Debug\net7.0\DigitalData.EmailProfilerDispatcher.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Base">
|
||||
<HintPath>..\..\DDModules\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -17,6 +17,9 @@ using DigitalData.Core.DTO;
|
||||
using System.Text.Encodings.Web;
|
||||
using Ganss.Xss;
|
||||
using Microsoft.Extensions.Options;
|
||||
using DigitalData.EmailProfilerDispatcher.Application;
|
||||
using EnvelopeGenerator.Application;
|
||||
using EnvelopeGenerator.Application.Resources;
|
||||
|
||||
var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger();
|
||||
logger.Info("Logging initialized!");
|
||||
@@ -55,22 +58,23 @@ try
|
||||
{
|
||||
//remove option for Test*Controller
|
||||
options.Conventions.Add(new RemoveIfControllerConvention()
|
||||
.AndIf(_ => !builder.IsDevOrDiP())
|
||||
.AndIf(c => c.ControllerName.StartsWith("Test"))
|
||||
.AndIf(c => !config.GetValue<bool>("EnableTestControllers")));
|
||||
.AndIf(_ => !config.GetValue<bool>("EnableTestControllers")));
|
||||
}).AddJsonOptions(q =>
|
||||
{
|
||||
// Prevents serialization error when serializing SvgBitmap in EnvelopeReceiver
|
||||
q.JsonSerializerOptions.ReferenceHandler = System.Text.Json.Serialization.ReferenceHandler.IgnoreCycles;
|
||||
});
|
||||
|
||||
if (config.GetValue<bool>("EnableSwagger"))
|
||||
if (config.GetValue<bool>("EnableSwagger") && builder.IsDevOrDiP())
|
||||
{
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
}
|
||||
|
||||
//AddEF Core dbcontext
|
||||
var connStr = config["Config:ConnectionString"];
|
||||
var connStr = config.GetConnectionString(Key.Default) ?? throw new InvalidOperationException("There is no default connection string in appsettings.json.");
|
||||
builder.Services.AddDbContext<EGDbContext>(options => options.UseSqlServer(connStr));
|
||||
|
||||
//Inject CRUD Service and repositoriesad
|
||||
@@ -89,7 +93,6 @@ try
|
||||
builder.Services.AddScoped<IEnvelopeTypeRepository, EnvelopeTypeRepository>();
|
||||
builder.Services.AddScoped<IReceiverRepository, ReceiverRepository>();
|
||||
builder.Services.AddScoped<IUserReceiverRepository, UserReceiverRepository>();
|
||||
builder.Services.AddScoped<IEmailOutRepository, EmailOutRepository>();
|
||||
builder.Services.AddScoped<IConfigService, ConfigService>();
|
||||
builder.Services.AddScoped<IDocumentReceiverElementService, DocumentReceiverElementService>();
|
||||
builder.Services.AddScoped<IEnvelopeDocumentService, EnvelopeDocumentService>();
|
||||
@@ -103,7 +106,6 @@ try
|
||||
builder.Services.AddScoped<IEnvelopeTypeService, EnvelopeTypeService>();
|
||||
builder.Services.AddScoped<IReceiverService, ReceiverService>();
|
||||
builder.Services.AddScoped<IUserReceiverService, UserReceiverService>();
|
||||
builder.Services.AddScoped<IEmailOutService, EmailOutService>();
|
||||
|
||||
//Auto mapping profiles
|
||||
builder.Services.AddAutoMapper(typeof(BasicDtoMappingProfile).Assembly);
|
||||
@@ -151,7 +153,7 @@ try
|
||||
};
|
||||
});
|
||||
|
||||
builder.Services.AddSingleton(_ => config.GetSection("ContactLink").Get<ContactLink>() ?? new ContactLink());
|
||||
builder.Services.AddSingleton(config.GetSection("ContactLink").Get<ContactLink>() ?? new());
|
||||
|
||||
builder.Services.AddCookieConsentSettings();
|
||||
|
||||
@@ -167,9 +169,13 @@ try
|
||||
});
|
||||
|
||||
// Register the FlagIconCssClass instance as a singleton
|
||||
builder.Services.Configure<Cultures>(builder.Configuration.GetSection("Cultures"));
|
||||
builder.Services.Configure<Cultures>(config.GetSection("Cultures"));
|
||||
builder.Services.AddSingleton(sp => sp.GetRequiredService<IOptions<Cultures>>().Value);
|
||||
|
||||
// Register mail services
|
||||
builder.Services.AddScoped<IEnvelopeMailService, EnvelopeMailService>();
|
||||
builder.Services.AddDispatcher<EGDbContext, Resource>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
@@ -181,14 +187,21 @@ try
|
||||
}
|
||||
|
||||
//Content-Security-Policy
|
||||
if (config.GetValue<bool>("TestCSP") || !app.Environment.IsDevelopment())
|
||||
if (config.GetValue<bool>("UseCSPInDev") || !app.Environment.IsDevelopment())
|
||||
{
|
||||
var csp_list = config.GetSection("Content-Security-Policy").Get<string[]>();
|
||||
if (csp_list is not null)
|
||||
app.UseCSPMiddleware($"{string.Join("; ", csp_list)};");
|
||||
if (csp_list is null)
|
||||
logger.Warn("There is no Content-Security-Policy");
|
||||
else
|
||||
{
|
||||
var csp = string.Join("; ", csp_list?.Where(st => st is not null) ?? Array.Empty<string>());
|
||||
logger.Info($"Content-Security-Policy {csp}");
|
||||
if (csp_list is not null)
|
||||
app.UseCSPMiddleware(csp);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.GetValue<bool>("EnableSwagger"))
|
||||
if (config.GetValue<bool>("EnableSwagger") && builder.IsDevOrDiP())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using DigitalData.Modules.Database;
|
||||
using DigitalData.Modules.Logging;
|
||||
using EnvelopeGenerator.Application;
|
||||
using EnvelopeGenerator.Common;
|
||||
|
||||
namespace EnvelopeGenerator.Web.Services
|
||||
@@ -52,11 +53,11 @@ namespace EnvelopeGenerator.Web.Services
|
||||
|
||||
public DatabaseService(ILogger<DatabaseService> logger, IConfiguration config)
|
||||
{
|
||||
LogConfig logConfig = new LogConfig(LogConfig.PathType.CustomPath, config["Config:LogPath"], null, "Digital Data", "ECM.EnvelopeGenerator.Web");
|
||||
LogConfig logConfig = new LogConfig(LogConfig.PathType.CustomPath, config["NLog:variables:logDirectory"], null, "Digital Data", "ECM.EnvelopeGenerator.Web");
|
||||
_logger = logger;
|
||||
|
||||
_logger.LogInformation("Establishing MSSQL Database connection..");
|
||||
MSSQL = new MSSQLServer(logConfig, config["Config:ConnectionString"]);
|
||||
MSSQL = new MSSQLServer(logConfig, config.GetConnectionString(Key.Default));
|
||||
|
||||
if (MSSQL.DBInitialized == true)
|
||||
{
|
||||
|
||||
@@ -70,19 +70,7 @@
|
||||
var envelopeKey = ViewData["EnvelopeKey"] as string;
|
||||
|
||||
<script nonce="@nonce">
|
||||
var base64String = "@Html.Raw(documentBase64String.TrySanitize(_sanitizer))";
|
||||
var byteCharacters = atob(base64String);
|
||||
var byteNumbers = new Array(byteCharacters.length);
|
||||
for (var i = 0; i < byteCharacters.length; i++) {
|
||||
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
||||
}
|
||||
var byteArray = new Uint8Array(byteNumbers);
|
||||
var documentArrayBuffer = byteArray.buffer;
|
||||
|
||||
document.addEventListener("DOMContentLoaded", async () => {
|
||||
const app = new App("#app", "@envelopeKey.TrySanitize(_sanitizer)", @Html.Raw(envelopeReceiverJson.TrySanitize(_sanitizer)), documentArrayBuffer, "@ViewData["PSPDFKitLicenseKey"]");
|
||||
await app.init();
|
||||
})
|
||||
document.addEventListener("DOMContentLoaded", async () => await new App("@envelopeKey.TrySanitize(_sanitizer)", @Html.Raw(envelopeReceiverJson.TrySanitize(_sanitizer)), B64ToBuff("@Html.Raw(documentBase64String.TrySanitize(_sanitizer))"), "@ViewData["PSPDFKitLicenseKey"]").init())
|
||||
</script>
|
||||
}
|
||||
<div id='app'></div>
|
||||
@@ -22,7 +22,7 @@
|
||||
<script src="~/js/app.js" asp-append-version="true"></script>
|
||||
<script src="~/lib/pspdfkit/pspdfkit.js" asp-append-version="true"></script>
|
||||
<script src="~/lib/bootstrap-cookie-consent-settings-main/bootstrap-cookie-consent-settings.js" asp-append-version="true"></script>
|
||||
<script src="~/lib/select2/dist/js/select2.min.js"></script>
|
||||
<script src="~/js/util.js" asp-append-version="true"></script>
|
||||
@await RenderSectionAsync("Scripts", required: false)
|
||||
<main role="main">
|
||||
<partial name="_CookieConsentPartial" />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"DiPMode": false, //Please be careful when enabling Development in Production (DiP) mode. It allows Swagger and test controllers to be enabled in a production environment.
|
||||
"EnableSwagger": true,
|
||||
"EnableTestControllers": true,
|
||||
"DetailedErrors": true,
|
||||
@@ -10,20 +11,16 @@
|
||||
"Microsoft.AspNetCore.Hosting.Diagnostics": "Warning"
|
||||
}
|
||||
},
|
||||
"Config": {
|
||||
"ConnectionString": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;",
|
||||
"LogPath": "E:\\EnvelopeGenerator\\Logs",
|
||||
"LogDebug": true,
|
||||
"LogJson": true,
|
||||
"AdminPassword": "dd"
|
||||
"ConnectionStrings": {
|
||||
"Default": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;Encrypt=false;TrustServerCertificate=True;"
|
||||
},
|
||||
"PSPDFKitLicenseKey": null,
|
||||
/* The first format parameter {0} will be replaced by the nonce value. */
|
||||
"TestCSP": true,
|
||||
"Content-Security-Policy": [
|
||||
"AdminPassword": "dd",
|
||||
"PSPDFKitLicenseKey_SignFlow": "y8VgCpBgUfNlpKJZC-GwjpPs-S-KFBHv4RywfHbqpBAbO0XxRuWDaMGZtIaMrXBDlndlJLk---Ve93xjI_ZR4sbFymf4Ot97yTYUMeDdL2LYXhspkEnSAtkXf9zqepNL1v_0DMibjpqXFQMkVB1y3D5xdnOg-iJuCCZEMhZ780qg04_H_nmx63uSgxjN0GJxC8YvsbnRcUZ2l_idImMvWL0HMqB5B7oEpNenasA0RK0uapFRTa7NIQok0phpTHZYKB4qvj7od2yxlytGB7qBl4-lwT70DSQ9mrLkCWbuzZ9cV9D8fDzdFXr6WoZdOYpkrUadRbsy2bhPq_ukxszDWN4JGhebo0XKUK_YfgvSlS7lFOxHNblHeC9B7gZ8T-VuQ_z1QA2JYRf1dmhSuclnW00diShIg-N0I79PWGsQE4j40XtVpyWcN9uT9hMuiRpL0LzHV4YgsgBrgKgs_moqL7f0L4-MwaS25Dx4Wcz4ttKaerLavwMM4CJHI3DNqTC5UUEG6EViFxBQtrmuAS7kiw2nWjvXO7kUA24NARtsRCphjWE4l6wSMdh7kpqhfbV7_hdb5xXYGALNPkv8En6zPpFIew8DDcOH9dgxfKMI34LLhkEWqovZW_7fXNJTEIHVpR0DSPbZrmyEwkECnbDcNzjyFk2M1fzstJj_dSotyZvS57XJK2DgojbRgXL9pncs",
|
||||
"UseCSPInDev": false,
|
||||
"Content-Security-Policy": [ // The first format parameter {0} will be replaced by the nonce value.
|
||||
"default-src 'self'",
|
||||
"script-src 'self' 'nonce-{0}' 'unsafe-inline' 'unsafe-eval' blob: data:",
|
||||
"style-src 'self' 'unsafe-inline'",
|
||||
"script-src 'self' 'nonce-{0}' blob: data:",
|
||||
"style-src 'self'",
|
||||
"img-src 'self' data: https: blob:",
|
||||
"font-src 'self'",
|
||||
"connect-src 'self' http://localhost:* https://localhost:* ws://localhost:* wss://localhost:* blob:",
|
||||
@@ -32,24 +29,27 @@
|
||||
"object-src 'self'",
|
||||
"worker-src 'self' blob: data:"
|
||||
],
|
||||
"AdminPassword": "dd",
|
||||
"AllowedOrigins": [ "https://localhost:7202", "https://digitale.unterschrift.wisag.de/" ],
|
||||
"NLog": {
|
||||
"throwConfigExceptions": true,
|
||||
"variables": {
|
||||
"logDirectory": "E:\\EnvelopeGenerator\\Logs",
|
||||
"logFileNamePrefix": "${shortdate}-ECM.EnvelopeGenerator.Web"
|
||||
},
|
||||
"targets": {
|
||||
"infoLogs": {
|
||||
"type": "File",
|
||||
"fileName": "E:\\EnvelopeGenerator\\Logs\\${shortdate}-ECM.EnvelopeGenerator.Web-Info.log",
|
||||
"fileName": "${logDirectory}\\${logFileNamePrefix}-Info.log",
|
||||
"maxArchiveDays": 30
|
||||
},
|
||||
"errorLogs": {
|
||||
"type": "File",
|
||||
"fileName": "E:\\EnvelopeGenerator\\Logs\\${shortdate}-ECM.EnvelopeGenerator.Web-Error.log",
|
||||
"fileName": "${logDirectory}\\${logFileNamePrefix}-Error.log",
|
||||
"maxArchiveDays": 30
|
||||
},
|
||||
"criticalLogs": {
|
||||
"type": "File",
|
||||
"fileName": "E:\\EnvelopeGenerator\\Logs\\${shortdate}-ECM.EnvelopeGenerator.Web-Critical.log",
|
||||
"fileName": "${logDirectory}\\${logFileNamePrefix}-Critical.log",
|
||||
"maxArchiveDays": 30
|
||||
}
|
||||
},
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
const annotations = []
|
||||
|
||||
document.elements.forEach((element) => {
|
||||
console.debug('Creating annotation for element', element.id)
|
||||
|
||||
const [annotation, formField] = this.createAnnotationFromElement(element)
|
||||
annotations.push(annotation)
|
||||
annotations.push(formField)
|
||||
|
||||
@@ -10,8 +10,8 @@ const ActionType = {
|
||||
}
|
||||
|
||||
class App {
|
||||
constructor(container, envelopeKey, envelopeReceiver, documentBytes, licenseKey) {
|
||||
this.container = container
|
||||
constructor(envelopeKey, envelopeReceiver, documentBytes, licenseKey, container) {
|
||||
this.container = container ?? `#${this.constructor.name.toLowerCase()}`;
|
||||
this.envelopeKey = envelopeKey
|
||||
|
||||
this.UI = new UI()
|
||||
@@ -38,7 +38,6 @@ class App {
|
||||
const documentResponse = this.documentBytes
|
||||
|
||||
if (documentResponse.fatal || documentResponse.error) {
|
||||
console.error(documentResponse.error)
|
||||
return Swal.fire({
|
||||
title: 'Fehler',
|
||||
text: 'Dokument konnte nicht geladen werden!',
|
||||
@@ -66,7 +65,6 @@ class App {
|
||||
)
|
||||
|
||||
// Load annotations into PSPDFKit
|
||||
console.debug('Loading annotations..')
|
||||
|
||||
try {
|
||||
this.signatureCount = this.currentDocument.elements.length
|
||||
@@ -85,12 +83,11 @@ class App {
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
handleAnnotationsLoad(loadedAnnotations) {
|
||||
console.debug('annotations loaded', loadedAnnotations.toJS())
|
||||
loadedAnnotations.toJS()
|
||||
}
|
||||
|
||||
handleAnnotationsChange() { }
|
||||
@@ -184,7 +181,6 @@ class App {
|
||||
try {
|
||||
await this.Instance.save()
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
Swal.fire({
|
||||
title: 'Fehler',
|
||||
text: 'Umschlag konnte nicht signiert werden!',
|
||||
@@ -196,7 +192,6 @@ class App {
|
||||
// Export annotation data and save to database
|
||||
try {
|
||||
const json = await this.Instance.exportInstantJSON()
|
||||
console.log(json)
|
||||
const postEnvelopeResult = await this.Network.postEnvelope(
|
||||
this.envelopeKey,
|
||||
this.currentDocument.id,
|
||||
@@ -223,7 +218,6 @@ class App {
|
||||
|
||||
return true
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,8 +47,6 @@
|
||||
configurePSPDFKit(instance, handler) {
|
||||
const toolbarItems = this.getToolbarItems(instance, handler)
|
||||
instance.setToolbarItems(toolbarItems)
|
||||
|
||||
console.debug('PSPDFKit configured!')
|
||||
}
|
||||
|
||||
annotationRenderer(data) {
|
||||
|
||||
1
EnvelopeGenerator.Web/wwwroot/js/util.js
Normal file
1
EnvelopeGenerator.Web/wwwroot/js/util.js
Normal file
@@ -0,0 +1 @@
|
||||
const B64ToBuff = (base64String) => new Uint8Array(Array.from(atob(base64String), char => char.charCodeAt(0))).buffer;
|
||||
Reference in New Issue
Block a user