Added the file meta-data of file in details and get version API
This commit is contained in:
parent
0916abe464
commit
35ea41d1ce
@ -7,8 +7,9 @@ namespace Marco.Pms.Model.ViewModels.DocumentManager
|
||||
public Guid Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? DocumentId { get; set; }
|
||||
public string? PreSignedUrl { get; set; }
|
||||
public int Version { get; set; }
|
||||
public long FileSize { get; set; }
|
||||
public string? ContentType { get; set; }
|
||||
public DateTime UploadedAt { get; set; }
|
||||
public BasicEmployeeVM? UploadedBy { get; set; }
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
|
@ -12,6 +12,8 @@ namespace Marco.Pms.Model.ViewModels.DocumentManager
|
||||
public int Version { get; set; }
|
||||
public bool IsCurrentVersion { get; set; }
|
||||
public Guid ParentAttachmentId { get; set; }
|
||||
public long FileSize { get; set; }
|
||||
public string? ContentType { get; set; }
|
||||
public DateTime UploadedAt { get; set; }
|
||||
public BasicEmployeeVM? UploadedBy { get; set; }
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
|
@ -267,6 +267,8 @@ namespace Marco.Pms.Services.Controllers
|
||||
.Include(av => av.ChildAttachment)
|
||||
.ThenInclude(da => da!.DocumentType)
|
||||
.ThenInclude(dt => dt!.DocumentCategory)
|
||||
.Include(av => av.ChildAttachment)
|
||||
.ThenInclude(da => da!.Document)
|
||||
.FirstOrDefaultAsync(av => av.ChildAttachmentId == id && av.TenantId == tenantId);
|
||||
|
||||
// If no mapping found, return 404
|
||||
@ -299,6 +301,9 @@ namespace Marco.Pms.Services.Controllers
|
||||
documentAttachmentVM.Version = versionMapping.Version;
|
||||
documentAttachmentVM.ParentAttachmentId = versionMapping.ParentAttachmentId;
|
||||
documentAttachmentVM.Tags = tags;
|
||||
documentAttachmentVM.FileSize = versionMapping.ChildAttachment.Document!.FileSize;
|
||||
documentAttachmentVM.ContentType = versionMapping.ChildAttachment.Document.ContentType;
|
||||
|
||||
_logger.LogInfo("Document details fetched successfully for AttachmentId: {AttachmentId}", id);
|
||||
|
||||
// Return success response with document details
|
||||
@ -421,6 +426,8 @@ namespace Marco.Pms.Services.Controllers
|
||||
.ThenInclude(da => da!.UploadedBy)
|
||||
.Include(av => av.ChildAttachment)
|
||||
.ThenInclude(da => da!.UpdatedBy)
|
||||
.Include(av => av.ChildAttachment)
|
||||
.ThenInclude(da => da!.Document)
|
||||
.Where(av => av.ParentAttachmentId == parentAttachmentId && av.TenantId == tenantId);
|
||||
|
||||
var totalCount = await versionMappingsQuery.CountAsync();
|
||||
@ -449,6 +456,8 @@ namespace Marco.Pms.Services.Controllers
|
||||
{
|
||||
var documentVM = _mapper.Map<AttachmentVersionVM>(versionMapping.ChildAttachment);
|
||||
documentVM.Version = versionMapping.Version;
|
||||
documentVM.FileSize = versionMapping.ChildAttachment!.Document!.FileSize;
|
||||
documentVM.ContentType = versionMapping.ChildAttachment.Document!.ContentType;
|
||||
return documentVM;
|
||||
}).ToList();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user