Entität 'Receiver' zur Entität 'EnvelopeHistory' hinzugefügt.
This commit is contained in:
parent
0818b8d606
commit
8d5493969f
@ -15,6 +15,8 @@ namespace EnvelopeGenerator.Application.Contracts
|
|||||||
|
|
||||||
Task<bool> IsSigned(int envelopeId, string userReference);
|
Task<bool> IsSigned(int envelopeId, string userReference);
|
||||||
|
|
||||||
|
Task<IEnumerable<EnvelopeHistoryDto>> ReadAsync(int? envelopeId = null, string? userReference = null, int? status = null);
|
||||||
|
|
||||||
Task<IEnumerable<EnvelopeHistoryDto>> ReadRejectedAsync(int envelopeId, string? userReference = null);
|
Task<IEnumerable<EnvelopeHistoryDto>> ReadRejectedAsync(int envelopeId, string? userReference = null);
|
||||||
|
|
||||||
Task<DataResult<long>> RecordAsync(int envelopeId, string userReference, EnvelopeStatus status);
|
Task<DataResult<long>> RecordAsync(int envelopeId, string userReference, EnvelopeStatus status);
|
||||||
|
|||||||
@ -7,5 +7,6 @@
|
|||||||
int Status,
|
int Status,
|
||||||
DateTime AddedWhen,
|
DateTime AddedWhen,
|
||||||
DateTime? ActionDate,
|
DateTime? ActionDate,
|
||||||
|
ReceiverDto? Receiver,
|
||||||
string? Comment = null);
|
string? Comment = null);
|
||||||
}
|
}
|
||||||
@ -50,11 +50,14 @@ namespace EnvelopeGenerator.Application.Services
|
|||||||
status: (int)EnvelopeStatus.DocumentRejected) > 0;
|
status: (int)EnvelopeStatus.DocumentRejected) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<EnvelopeHistoryDto>> ReadRejectedAsync(int envelopeId, string? userReference = null) => _mapper.MapOrThrow<IEnumerable<EnvelopeHistoryDto>>(
|
public async Task<IEnumerable<EnvelopeHistoryDto>> ReadAsync(int? envelopeId = null, string? userReference = null, int? status = null) => _mapper.MapOrThrow<IEnumerable<EnvelopeHistoryDto>>(
|
||||||
await _repository.ReadAsync(
|
await _repository.ReadAsync(
|
||||||
envelopeId: envelopeId,
|
envelopeId: envelopeId,
|
||||||
userReference: userReference,
|
userReference: userReference,
|
||||||
status: (int)EnvelopeStatus.DocumentRejected));
|
status: status));
|
||||||
|
|
||||||
|
public async Task<IEnumerable<EnvelopeHistoryDto>> ReadRejectedAsync(int envelopeId, string? userReference = null) =>
|
||||||
|
await ReadAsync(envelopeId: envelopeId, userReference: userReference, status: (int)EnvelopeStatus.DocumentRejected);
|
||||||
|
|
||||||
public async Task<DataResult<long>> RecordAsync(int envelopeId, string userReference, EnvelopeStatus status) =>
|
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))
|
await CreateAsync(new (EnvelopeId: envelopeId, UserReference: userReference, Status: (int)status, ActionDate: DateTime.Now))
|
||||||
|
|||||||
@ -33,5 +33,12 @@ namespace EnvelopeGenerator.Domain.Entities
|
|||||||
|
|
||||||
[Column("COMMENT", TypeName = "nvarchar(max)")]
|
[Column("COMMENT", TypeName = "nvarchar(max)")]
|
||||||
public string? Comment { get; set; }
|
public string? Comment { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
//[ForeignKey("UserReference")]
|
||||||
|
//public virtual DigitalData.UserManager.Domain.Entities.User? Sender { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("UserReference")]
|
||||||
|
public virtual Receiver? Receiver { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,6 +48,12 @@ namespace DigitalData.UserManager.Infrastructure.Repositories
|
|||||||
.WithMany(ed => ed.Elements)
|
.WithMany(ed => ed.Elements)
|
||||||
.HasForeignKey(dre => dre.DocumentId);
|
.HasForeignKey(dre => dre.DocumentId);
|
||||||
|
|
||||||
|
modelBuilder.Entity<EnvelopeHistory>()
|
||||||
|
.HasOne(eh => eh.Receiver)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(eh => eh.UserReference)
|
||||||
|
.HasPrincipalKey(e => e.EmailAddress);
|
||||||
|
|
||||||
// Configure entities to handle database triggers
|
// Configure entities to handle database triggers
|
||||||
modelBuilder.Entity<Envelope>().ToTable(tb => tb.HasTrigger("TBSIG_ENVELOPE_HISTORY_AFT_INS"));
|
modelBuilder.Entity<Envelope>().ToTable(tb => tb.HasTrigger("TBSIG_ENVELOPE_HISTORY_AFT_INS"));
|
||||||
modelBuilder.Entity<EnvelopeHistory>().ToTable(tb => tb.HasTrigger("TBSIG_ENVELOPE_HISTORY_AFT_INS"));
|
modelBuilder.Entity<EnvelopeHistory>().ToTable(tb => tb.HasTrigger("TBSIG_ENVELOPE_HISTORY_AFT_INS"));
|
||||||
|
|||||||
@ -12,7 +12,7 @@ namespace EnvelopeGenerator.Infrastructure.Repositories
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private IQueryable<EnvelopeHistory> By(int? envelopeId = null, string? userReference = null, int? status = null)
|
private IQueryable<EnvelopeHistory> By(int? envelopeId = null, string? userReference = null, int? status = null, bool withReceiver = false)
|
||||||
{
|
{
|
||||||
var query = _dbSet.AsQueryable();
|
var query = _dbSet.AsQueryable();
|
||||||
|
|
||||||
@ -25,6 +25,11 @@ namespace EnvelopeGenerator.Infrastructure.Repositories
|
|||||||
if (status is not null)
|
if (status is not null)
|
||||||
query = query.Where(eh => eh.Status == status);
|
query = query.Where(eh => eh.Status == status);
|
||||||
|
|
||||||
|
if(withReceiver)
|
||||||
|
query = query.Include(eh => eh.Receiver);
|
||||||
|
|
||||||
|
string qSt = query.ToQueryString();
|
||||||
|
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,10 +37,11 @@ namespace EnvelopeGenerator.Infrastructure.Repositories
|
|||||||
envelopeId: envelopeId,
|
envelopeId: envelopeId,
|
||||||
userReference: userReference,
|
userReference: userReference,
|
||||||
status: status).CountAsync();
|
status: status).CountAsync();
|
||||||
|
|
||||||
public async Task<IEnumerable<EnvelopeHistory>> ReadAsync(int? envelopeId = null, string? userReference = null, int? status = null) => await By(
|
public async Task<IEnumerable<EnvelopeHistory>> ReadAsync(int? envelopeId = null, string? userReference = null, int? status = null, bool withReceiver = true) => await By(
|
||||||
envelopeId: envelopeId,
|
envelopeId: envelopeId,
|
||||||
userReference: userReference,
|
userReference: userReference,
|
||||||
status: status).ToListAsync();
|
status: status,
|
||||||
|
withReceiver: withReceiver).ToListAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -24,5 +24,14 @@ namespace EnvelopeGenerator.Web.Controllers.Test
|
|||||||
{
|
{
|
||||||
return Ok(await _service.AccessCodeAlreadyRequested(envelopeId, userReference));
|
return Ok(await _service.AccessCodeAlreadyRequested(envelopeId, userReference));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IActionResult> GetAsyncWith(int? envelopeId = null, string? userReference = null, int? status = null)
|
||||||
|
{
|
||||||
|
return Ok(await _service.ReadAsync(envelopeId: envelopeId, userReference: userReference, status: status));
|
||||||
|
}
|
||||||
|
|
||||||
|
[NonAction]
|
||||||
|
public override Task<IActionResult> GetAll() => base.GetAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user