add job invoice

This commit is contained in:
zzdrojewskipaw
2025-11-28 15:11:56 +01:00
parent 437d6d8f42
commit f31176cfc9
3 changed files with 19 additions and 4 deletions

View File

@@ -131,9 +131,21 @@ RecurringJob.AddOrUpdate<ProductSyncJob>(
new RecurringJobOptions
{
TimeZone = TimeZoneInfo.Local,
MisfireHandling = app.Environment.IsDevelopment()
? MisfireHandlingMode.Relaxed
: MisfireHandlingMode.Strict
MisfireHandling = app.Environment.IsDevelopment()
? MisfireHandlingMode.Relaxed
: MisfireHandlingMode.Strict
});
RecurringJob.AddOrUpdate<InvoiceSyncJob>(
"invoice-sync",
job => job.ExecuteAsync(),
Cron.Daily(2, 30), // Every day at 2:30 AM
new RecurringJobOptions
{
TimeZone = TimeZoneInfo.Local,
MisfireHandling = app.Environment.IsDevelopment()
? MisfireHandlingMode.Relaxed
: MisfireHandlingMode.Strict
});
app.Run();

View File

@@ -6,6 +6,9 @@
"E5_CRM": {
"ApiKey": "7e50a8a5-f01f-4fbc-8c1b-59f3fc474bb5"
},
"TWINPOL_CRM": {
"ApiKey": "d68dac4c-f784-4e1b-8267-9ffcfa0eda4c"
},
"GoogleAuth": {
"ClientId": "896226687615-rhmqk06t1hvll1hh2gtje2u6nbadtras.apps.googleusercontent.com"
},

View File

@@ -18,7 +18,7 @@ public class InvoiceSyncService(HttpClient httpClient, BimAIDbContext db, IConfi
public async Task RunAsync()
{
var apiKey = configuration["E5_CRM:ApiKey"];
var apiKey = configuration["TWINPOL_CRM:ApiKey"];
var syncState = db.SyncStates.FirstOrDefault(x => x.Entity == "Invoice") ?? new SyncState { Entity = "Invoice", LastSynced = 0 };
var url = $"https://crm.twinpol.com/REST/index.php?key={apiKey}&action=bimai.export.ecommerce&since=0";