Refactor namespaces and simplify DTOs
Updated namespaces to align with the new DigitalData.Core structure, replacing `DigitalData.Core.Abstractions` with `DigitalData.Core.Application.Interfaces` and `DigitalData.Core.Client.Interface`. Removed the `IUnique<int>` interface from several DTOs, simplifying their design and altering the handling of entity identification. Updated project files to reflect new dependency versions for improved compatibility and features. Cleaned up using directives to remove obsolete references, enhancing code maintainability.
This commit is contained in:
@@ -7,6 +7,7 @@ using DigitalData.Core.DTO;
|
||||
using EnvelopeGenerator.Application.DTOs.EnvelopeHistory;
|
||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
using EnvelopeGenerator.Application.Contracts.Services;
|
||||
using DigitalData.Core.Application.DTO;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Services;
|
||||
|
||||
@@ -85,7 +86,7 @@ public class EnvelopeHistoryService : CRUDService<IEnvelopeHistoryRepository, En
|
||||
Comment = comment
|
||||
})
|
||||
.ThenAsync(
|
||||
Success: id => Result.Success(id),
|
||||
Success: dto => Result.Success(dto.Id),
|
||||
Fail: (mssg, ntc) => Result.Fail<long>().Message(mssg).Notice(ntc)
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Abstractions.Client;
|
||||
using DigitalData.Core.Client.Interface;
|
||||
using DigitalData.Core.Client;
|
||||
using EnvelopeGenerator.Application.Configurations;
|
||||
using EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
@@ -4,7 +4,6 @@ using EnvelopeGenerator.Domain.Entities;
|
||||
using EnvelopeGenerator.Application.Contracts.Repositories;
|
||||
using EnvelopeGenerator.Application.DTOs.Receiver;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.Core.Abstractions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using EnvelopeGenerator.Application.Contracts.Services;
|
||||
|
||||
@@ -37,12 +36,12 @@ public class ReceiverService : CRUDService<IReceiverRepository, ReceiverCreateDt
|
||||
return await _repository.DeleteAsync(rcv) ? Result.Success() : Result.Fail();
|
||||
}
|
||||
|
||||
public virtual async Task<Result> UpdateAsync<TUpdateDto>(TUpdateDto updateDto) where TUpdateDto : IUnique<int>
|
||||
public virtual async Task<Result> UpdateAsync<TUpdateDto>(TUpdateDto updateDto)
|
||||
{
|
||||
var val = await _repository.ReadByIdAsync(updateDto.Id);
|
||||
var val = await _repository.ReadByIdAsync(updateDto.GetId<int>());
|
||||
if (val == null)
|
||||
{
|
||||
return Result.Fail().Notice(LogLevel.Warning, Flag.NotFound, $"{updateDto.Id} is not found in update process of {GetType()} entity.");
|
||||
return Result.Fail().Notice(LogLevel.Warning, Flag.NotFound, $"{updateDto.GetIdOrDefault<int>()} is not found in update process of {GetType()} entity.");
|
||||
}
|
||||
|
||||
var entity = _mapper.Map(updateDto, val);
|
||||
|
||||
Reference in New Issue
Block a user