using Admin.NET.Plugin.AiDOP.DataPlatform.Core; using MySqlConnector; namespace Admin.NET.DataPlatform.Worker; internal static class PurchaseBatchJournal { internal static async Task AppendAsync(MySqlConnection connection, MySqlTransaction transaction, PurchaseTaskLease scope, string eventCode, CancellationToken token, int? attempt = null, int? count = null, string? diagnostic = null) { using var command = new MySqlCommand(IngestBatchJournal.Insert, connection, transaction); command.Parameters.AddWithValue("@BatchId", scope.BatchId.ToString("D")); command.Parameters.AddWithValue("@TenantId", scope.TenantId); command.Parameters.AddWithValue("@FactoryId", scope.FactoryId); command.Parameters.AddWithValue("@DatasetId", scope.DatasetId); command.Parameters.AddWithValue("@SourceId", scope.SourceId); command.Parameters.AddWithValue("@EventCode", eventCode); command.Parameters.AddWithValue("@Attempt", (object?)attempt ?? DBNull.Value); command.Parameters.AddWithValue("@Count", (object?)count ?? DBNull.Value); command.Parameters.AddWithValue("@Diagnostic", (object?)diagnostic ?? DBNull.Value); await command.ExecuteNonQueryAsync(token); } }