diff --git a/Marco.Pms.Model/ViewModels/DocumentManager/AttachmentVersionVM.cs b/Marco.Pms.Model/ViewModels/DocumentManager/AttachmentVersionVM.cs index e0c45af..e064522 100644 --- a/Marco.Pms.Model/ViewModels/DocumentManager/AttachmentVersionVM.cs +++ b/Marco.Pms.Model/ViewModels/DocumentManager/AttachmentVersionVM.cs @@ -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; } diff --git a/Marco.Pms.Model/ViewModels/DocumentManager/DocumentAttachmentDetailsVM.cs b/Marco.Pms.Model/ViewModels/DocumentManager/DocumentAttachmentDetailsVM.cs index 38806ec..4076b1d 100644 --- a/Marco.Pms.Model/ViewModels/DocumentManager/DocumentAttachmentDetailsVM.cs +++ b/Marco.Pms.Model/ViewModels/DocumentManager/DocumentAttachmentDetailsVM.cs @@ -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; } diff --git a/Marco.Pms.Services/Controllers/DocumentController.cs b/Marco.Pms.Services/Controllers/DocumentController.cs index 5f9180c..262c819 100644 --- a/Marco.Pms.Services/Controllers/DocumentController.cs +++ b/Marco.Pms.Services/Controllers/DocumentController.cs @@ -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(versionMapping.ChildAttachment); documentVM.Version = versionMapping.Version; + documentVM.FileSize = versionMapping.ChildAttachment!.Document!.FileSize; + documentVM.ContentType = versionMapping.ChildAttachment.Document!.ContentType; return documentVM; }).ToList();