- ReceiverStatusTableComponent als Unterkomponente der EnvelopeTable erstellt, um Empfängerstatus anzuzeigen. - ReceiverStatusTable in EnvelopeTable mit Tabs und dynamischem Datenladen integriert. - EnvelopeTable angepasst, um Empfängerdaten über den EnvelopeReceiverService abzurufen und in ReceiverStatusTable anzuzeigen. - Backend aktualisiert, um das Abrufen von Umschlägen nach Benutzer zu unterstützen: - `ReadByUserAsync`-Methode im Envelope-Repository hinzugefügt, um Umschläge für einen bestimmten Benutzer abzufragen. - Servicemethode implementiert, um die abgefragten Umschläge in DTOs zu konvertieren und das Ergebnis zurückzugeben.
43 lines
2.0 KiB
C#
43 lines
2.0 KiB
C#
using AutoMapper;
|
|
using DigitalData.Core.Application;
|
|
using DigitalData.Core.DTO;
|
|
using EnvelopeGenerator.Application.Contracts;
|
|
using EnvelopeGenerator.Application.DTOs;
|
|
using EnvelopeGenerator.Domain.Entities;
|
|
using EnvelopeGenerator.Infrastructure.Contracts;
|
|
|
|
namespace EnvelopeGenerator.Application.Services
|
|
{
|
|
public class EnvelopeService : BasicCRUDService<IEnvelopeRepository, EnvelopeDto, Envelope, int>, IEnvelopeService
|
|
{
|
|
public EnvelopeService(IEnvelopeRepository repository, IMapper mapper)
|
|
: base(repository, mapper)
|
|
{
|
|
}
|
|
|
|
public async Task<DataResult<IEnumerable<EnvelopeDto>>> ReadAllWithAsync(bool documents = false, bool history = false, bool documentReceiverElement = false)
|
|
{
|
|
var envelopes = await _repository.ReadAllWithAsync(documents: documents, history: history, documentReceiverElement: documentReceiverElement);
|
|
var readDto = _mapper.MapOrThrow<IEnumerable<EnvelopeDto>>(envelopes);
|
|
return Result.Success(readDto);
|
|
}
|
|
|
|
public async Task<DataResult<EnvelopeDto>> ReadByUuidAsync(string uuid, bool withDocuments = false, bool withHistory = false, bool withDocumentReceiverElement = false, bool withUser = false, bool withAll = false)
|
|
{
|
|
var envelope = await _repository.ReadByUuidAsync(uuid: uuid, withDocuments: withDocuments, withHistory: withHistory, withDocumentReceiverElement: withDocumentReceiverElement, withUser:withUser, withAll:withAll);
|
|
|
|
if (envelope is null)
|
|
return Result.Fail<EnvelopeDto>();
|
|
|
|
var readDto = _mapper.MapOrThrow<EnvelopeDto>(envelope);
|
|
return Result.Success(readDto);
|
|
}
|
|
|
|
public async Task<DataResult<IEnumerable<EnvelopeDto>>> ReadByUserAsync(int userId)
|
|
{
|
|
var users = await _repository.ReadByUserAsync(userId: userId);
|
|
var readDto = _mapper.MapOrThrow<IEnumerable<EnvelopeDto>>(users);
|
|
return Result.Success(readDto);
|
|
}
|
|
}
|
|
} |