diff --git a/Marco.Pms.Services/Controllers/MasterController.cs b/Marco.Pms.Services/Controllers/MasterController.cs
index 78cb989..475cd5d 100644
--- a/Marco.Pms.Services/Controllers/MasterController.cs
+++ b/Marco.Pms.Services/Controllers/MasterController.cs
@@ -71,16 +71,48 @@ namespace Marco.Pms.Services.Controllers
#endregion
#region =================================================================== Purchase Invoice Status APIs ===================================================================
+
+ ///
+ /// Retrieves the purchase invoice status.
+ ///
+ /// The cancellation token.
+ /// The HTTP response containing the purchase invoice status.
[HttpGet("purchase-invoice-status/list")]
public async Task GetPurchaseInvoiceStatus(CancellationToken ct)
{
+ // Get the currently logged-in employee.
var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
+
+ // Retrieve the purchase invoice status asynchronously.
var response = await _masterService.GetPurchaseInvoiceStatusAsync(loggedInEmployee, ct);
+
+ // Return the HTTP response with the purchase invoice status.
return StatusCode(response.StatusCode, response);
}
#endregion
+ #region =================================================================== Invoice Attachment Type APIs ===================================================================
+
+ ///
+ /// Retrieves the invoice attachment types.
+ ///
+ /// The cancellation token.
+ /// The HTTP response containing the invoice attachment types.
+ [HttpGet("purchase-attachment-type/list")]
+ public async Task GetInvoiceAttachmentType(CancellationToken ct)
+ {
+ // Get the currently logged-in employee.
+ var loggedInEmployee = await _userHelper.GetCurrentEmployeeAsync();
+
+ // Retrieve the invoice attachment types asynchronously.
+ var response = await _masterService.GetInvoiceAttachmentTypeAsync(loggedInEmployee, ct);
+
+ // Return the HTTP response with the invoice attachment types.
+ return StatusCode(response.StatusCode, response);
+ }
+ #endregion
+
#region =================================================================== Currency APIs ===================================================================
[HttpGet("currencies/list")]
diff --git a/Marco.Pms.Services/Service/MasterService.cs b/Marco.Pms.Services/Service/MasterService.cs
index 7398aab..e55adf8 100644
--- a/Marco.Pms.Services/Service/MasterService.cs
+++ b/Marco.Pms.Services/Service/MasterService.cs
@@ -244,6 +244,61 @@ namespace Marco.Pms.Services.Service
#endregion
+ #region =================================================================== Invoice Attachment Type APIs ===================================================================
+
+ ///
+ /// Asynchronously retrieves the list of valid Invoice Attachment Types.
+ ///
+ /// The current user context for audit logging.
+ /// Token to propagate notification that operations should be canceled.
+ /// A standardized API response containing a list of attachment type DTOs.
+ public async Task> GetInvoiceAttachmentTypeAsync(Employee loggedInEmployee, CancellationToken cancellationToken = default)
+ {
+ // 1. Structured Logging: Audit WHO is requesting the data
+ _logger.LogInfo("Initiating fetch of Invoice Attachment Types. Requested by User ID: {UserId}", loggedInEmployee.Id);
+
+ try
+ {
+ // 2. Database Optimization:
+ // - AsNoTracking(): Crucial for read-only lists. Bypasses change tracking overhead.
+ // - Select(): Projects directly to DTO. Fetches ONLY needed columns (SQL optimization).
+ var attachmentTypes = await _context.InvoiceAttachmentTypes
+ .AsNoTracking()
+ .OrderBy(type => type.Name)
+ .ToListAsync(cancellationToken); // 3. Pass the token to EF Core
+
+ _logger.LogInfo("Successfully retrieved {Count} Invoice Attachment Types.", attachmentTypes.Count);
+
+ // 4. Strong Typing: Return IEnumerable instead of 'object'
+ return ApiResponse