diff --git a/Marco.Pms.Services/Controllers/DocumentController.cs b/Marco.Pms.Services/Controllers/DocumentController.cs
index adb872e..85e4e3b 100644
--- a/Marco.Pms.Services/Controllers/DocumentController.cs
+++ b/Marco.Pms.Services/Controllers/DocumentController.cs
@@ -536,17 +536,90 @@ namespace Marco.Pms.Services.Controllers
}
}
+ ///
+ /// Verifies a document attachment by its ID. Checks permissions, logs the operation, and updates verification fields.
+ ///
+ /// Document Attachment ID (Guid)
+ /// Flag to verify or unverify the document (default: true)
+
[HttpPost("verify/{id}")]
- public async Task VerifyDocumentAsync(Guid id)
+ public async Task VerifyDocumentAsync(Guid id, [FromQuery] bool isVerify = true)
{
+ // Begin: Create DbContext and DI scope
await using var dbContext = await _dbContextFactory.CreateDbContextAsync();
using var scope = _serviceScope.CreateScope();
- var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
+ try
+ {
+ // Get current logged-in employee for authentication/auditing
+ var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
+ var tenantId = loggedInEmployee.TenantId;
- return Ok(ApiResponse