From 633a020212f7a280add65a012b8585ea11c04280 Mon Sep 17 00:00:00 2001 From: Toutsu Date: Thu, 28 May 2026 16:26:54 +0300 Subject: [PATCH] fix(shared): convert GameSystem to string in SQL, guard rollback after commit --- .../Sessions/CreateSession/CreateSessionHandler.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/GmRelay.Shared/Features/Sessions/CreateSession/CreateSessionHandler.cs b/src/GmRelay.Shared/Features/Sessions/CreateSession/CreateSessionHandler.cs index 4f5d9b8..5cb7c32 100644 --- a/src/GmRelay.Shared/Features/Sessions/CreateSession/CreateSessionHandler.cs +++ b/src/GmRelay.Shared/Features/Sessions/CreateSession/CreateSessionHandler.cs @@ -16,6 +16,7 @@ public sealed class CreateSessionHandler( await using var connection = await dataSource.OpenConnectionAsync(ct); await using var transaction = await connection.BeginTransactionAsync(ct); + var transactionCommitted = false; try { var platform = command.User.Platform.ToString(); @@ -130,7 +131,7 @@ public sealed class CreateSessionHandler( ScheduledAt = scheduledAt, Status = SessionStatus.Planned, MaxPlayers = command.MaxPlayers, - System = command.System, + System = command.System?.ToString(), command.Description, command.Format, DurationMinutes = command.DurationMinutes, @@ -142,6 +143,7 @@ public sealed class CreateSessionHandler( } await transaction.CommitAsync(ct); + transactionCommitted = true; var view = SessionBatchViewBuilder.Build(command.Title, sessions, Array.Empty()); @@ -155,7 +157,10 @@ public sealed class CreateSessionHandler( } catch { - await transaction.RollbackAsync(ct); + if (!transactionCommitted) + { + await transaction.RollbackAsync(ct); + } throw; } }