diff --git a/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs b/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs index ce493f398..ef695bb5c 100644 --- a/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs @@ -331,14 +331,18 @@ public class AuditDocumentService(IRepository _auditDocumentRepos /// /// [HttpPost] - public async Task GetHistoricalVersion(GetHistoricalVersionInDto inDto) + public async Task> GetHistoricalVersion(GetHistoricalVersionInDto inDto) { - return new GetHistoricalVersionOutDto() - { - CurrentData = await _auditDocumentRepository.Where(x => x.Id == inDto.Id).ProjectTo(_mapper.ConfigurationProvider).FirstNotNullAsync(), - HistoricalVersionList = await _auditDocumentRepository.Where(x => x.MainFileId == inDto.Id).ProjectTo(_mapper.ConfigurationProvider).OrderByDescending(x => x.Version).ToListAsync() - }; + List< HistoricalVersionDto > result=new List(); + + result = await _auditDocumentRepository.Where(x => x.MainFileId == inDto.Id).ProjectTo(_mapper.ConfigurationProvider).OrderByDescending(x => x.Version).ToListAsync(); + var currentData = await _auditDocumentRepository.Where(x => x.Id == inDto.Id).ProjectTo(_mapper.ConfigurationProvider).FirstNotNullAsync(); + currentData.IsCurrentVersion = true; + + result.Insert(0, currentData); + + return result; } /// diff --git a/IRaCIS.Core.Application/Service/Document/DTO/AuditDocumentViewModel.cs b/IRaCIS.Core.Application/Service/Document/DTO/AuditDocumentViewModel.cs index 573603c74..26f168c5c 100644 --- a/IRaCIS.Core.Application/Service/Document/DTO/AuditDocumentViewModel.cs +++ b/IRaCIS.Core.Application/Service/Document/DTO/AuditDocumentViewModel.cs @@ -82,6 +82,13 @@ public class MovieFileOrFolderInDto public Guid ParentId { get; set; } } +public class HistoricalVersionDto: AuditDocumentUpdateDto +{ + public bool IsCurrentVersion { get; set; } = false; + + public int? Version { get; set; } +} + public class AuditDocumentUpdateDto { public Guid? Id { get; set; } diff --git a/IRaCIS.Core.Application/Service/Document/_MapConfig.cs b/IRaCIS.Core.Application/Service/Document/_MapConfig.cs index 2f27b406a..15e80a9a4 100644 --- a/IRaCIS.Core.Application/Service/Document/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Document/_MapConfig.cs @@ -15,6 +15,7 @@ namespace IRaCIS.Core.Application.Service var userId = Guid.Empty; var isEn_Us = false; CreateMap(); + CreateMap(); CreateMap(); CreateMap(); CreateMap().ReverseMap();