Document_Manager #129
@ -1,4 +1,5 @@
|
||||
using Marco.Pms.Model.ViewModels.Activities;
|
||||
using Marco.Pms.Model.Dtos.DocumentManager;
|
||||
using Marco.Pms.Model.ViewModels.Activities;
|
||||
|
||||
namespace Marco.Pms.Model.ViewModels.DocumentManager
|
||||
{
|
||||
@ -20,6 +21,7 @@ namespace Marco.Pms.Model.ViewModels.DocumentManager
|
||||
public BasicEmployeeVM? VerifiedBy { get; set; }
|
||||
public Guid EntityId { get; set; }
|
||||
public DocumentTypeVM? DocumentType { get; set; }
|
||||
public List<DocumentTagDto>? Tags { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ namespace Marco.Pms.Model.ViewModels.DocumentManager
|
||||
public string? Description { get; set; }
|
||||
public DateTime UploadedAt { get; set; }
|
||||
public Guid? ParentAttachmentId { get; set; }
|
||||
public bool IsCurrentVersion { get; set; }
|
||||
public int Version { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
public bool? IsVerified { get; set; }
|
||||
|
@ -273,12 +273,20 @@ namespace Marco.Pms.Services.Controllers
|
||||
loggedInEmployee.Id, versionMapping.ChildAttachment.EntityId);
|
||||
return StatusCode(403, ApiResponse<object>.ErrorResponse("Access Denied.", "You do not have permission to view documents", 403));
|
||||
}
|
||||
|
||||
var tags = await _context.AttachmentTagMappings
|
||||
.Include(at => at.DocumentTag)
|
||||
.Where(at => at.AttachmentId == versionMapping.ChildAttachmentId && at.TenantId == tenantId && at.DocumentTag != null)
|
||||
.Select(at => new DocumentTagDto
|
||||
{
|
||||
Name = at.DocumentTag!.Name,
|
||||
IsActive = true
|
||||
})
|
||||
.ToListAsync();
|
||||
// Map the domain entity to the view model
|
||||
var documentAttachmentVM = _mapper.Map<DocumentAttachmentDetailsVM>(versionMapping.ChildAttachment);
|
||||
documentAttachmentVM.Version = versionMapping.Version;
|
||||
documentAttachmentVM.ParentAttachmentId = versionMapping.ParentAttachmentId;
|
||||
|
||||
documentAttachmentVM.Tags = tags;
|
||||
_logger.LogInfo("Document details fetched successfully for AttachmentId: {AttachmentId}", id);
|
||||
|
||||
// Return success response with document details
|
||||
|
Loading…
x
Reference in New Issue
Block a user