create invoice component
This commit is contained in:
31
BimAI.Infrastructure/Jobs/InvoiceSyncJob.cs
Normal file
31
BimAI.Infrastructure/Jobs/InvoiceSyncJob.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using BimAI.Infrastructure.Sync;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace BimAI.Infrastructure.Jobs;
|
||||
|
||||
public class InvoiceSyncJob
|
||||
{
|
||||
private readonly InvoiceSyncService _invoiceSyncService;
|
||||
private readonly ILogger<InvoiceSyncJob> _logger;
|
||||
|
||||
public InvoiceSyncJob(InvoiceSyncService invoiceSyncService, ILogger<InvoiceSyncJob> logger)
|
||||
{
|
||||
_invoiceSyncService = invoiceSyncService;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task ExecuteAsync()
|
||||
{
|
||||
_logger.LogInformation("Starting invoice sync...");
|
||||
|
||||
try
|
||||
{
|
||||
await _invoiceSyncService.RunAsync();
|
||||
_logger.LogInformation("Invoice sync finished.");
|
||||
} catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error during invoice sync.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user