Add EmailOut components: entity, DTO, repository, and services
- Introduced EmailOut and EmailOutDto for data management. - Added EmailOutRepository and service interfaces based on CRUD patterns.
This commit is contained in:
parent
f7b11e3427
commit
f2e718565d
11
EnvelopeGenerator.Application/Contracts/IEmailOutService.cs
Normal file
11
EnvelopeGenerator.Application/Contracts/IEmailOutService.cs
Normal file
@ -0,0 +1,11 @@
|
||||
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>
|
||||
{
|
||||
}
|
||||
}
|
||||
25
EnvelopeGenerator.Application/DTOs/EmailOutDto.cs
Normal file
25
EnvelopeGenerator.Application/DTOs/EmailOutDto.cs
Normal file
@ -0,0 +1,25 @@
|
||||
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
|
||||
);
|
||||
}
|
||||
@ -21,6 +21,7 @@ namespace EnvelopeGenerator.Application.MappingProfiles
|
||||
CreateMap<EnvelopeType, EnvelopeTypeDto>();
|
||||
CreateMap<Receiver, ReceiverDto>();
|
||||
CreateMap<UserReceiver, UserReceiverDto>();
|
||||
CreateMap<EmailOut, EmailOutDto>();
|
||||
|
||||
// DTO to Entity mappings
|
||||
CreateMap<ConfigDto, Config>();
|
||||
@ -35,6 +36,7 @@ namespace EnvelopeGenerator.Application.MappingProfiles
|
||||
CreateMap<EnvelopeTypeDto, EnvelopeType>();
|
||||
CreateMap<ReceiverDto, Receiver>();
|
||||
CreateMap<UserReceiverDto, UserReceiver>();
|
||||
CreateMap<EmailOutDto, EmailOut>();
|
||||
}
|
||||
}
|
||||
}
|
||||
17
EnvelopeGenerator.Application/Services/EmailOutService.cs
Normal file
17
EnvelopeGenerator.Application/Services/EmailOutService.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Application;
|
||||
using DigitalData.Core.Contracts.CultureServices;
|
||||
using EnvelopeGenerator.Application.Contracts;
|
||||
using EnvelopeGenerator.Application.DTOs;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Infrastructure.Contracts;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Services
|
||||
{
|
||||
public class EmailOutService : BasicCRUDService<IEmailOutRepository, EmailOutDto, EmailOut, int>, IEmailOutService
|
||||
{
|
||||
public EmailOutService(IEmailOutRepository repository, IKeyTranslationService translationService, IMapper mapper) : base(repository, translationService, mapper)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
89
EnvelopeGenerator.Domain/Entities/EmailOut.cs
Normal file
89
EnvelopeGenerator.Domain/Entities/EmailOut.cs
Normal file
@ -0,0 +1,89 @@
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
using DigitalData.Core.Contracts.Infrastructure;
|
||||
using EnvelopeGenerator.Domain.Entities;
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure.Contracts
|
||||
{
|
||||
public interface IEmailOutRepository : ICRUDRepository<EmailOut, int>
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -38,7 +38,7 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
var passwordFromConfig = _config["Config:AdminPassword"] ?? throw new InvalidOperationException("No admin password configured!");
|
||||
var passwordFromConfig = _config["Config:AdminPassword"];
|
||||
|
||||
if (passwordFromConfig == null)
|
||||
{
|
||||
@ -56,8 +56,9 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
|
||||
return View(envelopes);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch(Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Unexpected error");
|
||||
ViewData["error"] = "Unknown error!";
|
||||
return View("Index");
|
||||
}
|
||||
@ -66,6 +67,8 @@ namespace EnvelopeGenerator.Web.Controllers
|
||||
[HttpGet("/EnvelopeKey/{envelopeReceiverId}")]
|
||||
public async Task<IActionResult> SendAccessCode([FromRoute] string envelopeReceiverId)
|
||||
{
|
||||
var envelope = await _envelopeService.ReadByUuidAsync(envelopeReceiverId.GetEnvelopeUuid());
|
||||
|
||||
EnvelopeResponse response = await envelopeOldService.LoadEnvelope(envelopeReceiverId);
|
||||
|
||||
if (response.Envelope.UseAccessCode)
|
||||
|
||||
@ -67,6 +67,7 @@ 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>();
|
||||
@ -81,6 +82,7 @@ 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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user