fix(shared): convert GameSystem to string in SQL, guard rollback after commit
This commit is contained in:
@@ -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<ParticipantBatchDto>());
|
||||
|
||||
@@ -155,7 +157,10 @@ public sealed class CreateSessionHandler(
|
||||
}
|
||||
catch
|
||||
{
|
||||
await transaction.RollbackAsync(ct);
|
||||
if (!transactionCommitted)
|
||||
{
|
||||
await transaction.RollbackAsync(ct);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user