feat(inventory): thread GrantSource into InventoryTransaction
Add _source field + ctor parameter (between freeplay and log) to InventoryTransaction; pass loadCfg.Source from InventoryService.BeginAsync. Field is captured but not yet consumed — Task 6 wires it into history rows. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -57,7 +57,7 @@ public sealed class InventoryService : IInventoryService
|
|||||||
var freeplay = _config.Get<FreeplayConfig>();
|
var freeplay = _config.Get<FreeplayConfig>();
|
||||||
var dbTx = await _db.Database.BeginTransactionAsync(ct);
|
var dbTx = await _db.Database.BeginTransactionAsync(ct);
|
||||||
|
|
||||||
return new InventoryTransaction(_db, dbTx, viewer, freeplay, _log);
|
return new InventoryTransaction(_db, dbTx, viewer, freeplay, loadCfg.Source, _log);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long EffectiveBalance(Viewer viewer, SpendCurrency currency)
|
public long EffectiveBalance(Viewer viewer, SpendCurrency currency)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ internal sealed class InventoryTransaction : IInventoryTransaction
|
|||||||
private readonly IDbContextTransaction _dbTx;
|
private readonly IDbContextTransaction _dbTx;
|
||||||
private readonly ILogger _log;
|
private readonly ILogger _log;
|
||||||
private readonly FreeplayConfig _freeplay;
|
private readonly FreeplayConfig _freeplay;
|
||||||
|
private readonly GrantSource _source;
|
||||||
private bool _committed;
|
private bool _committed;
|
||||||
|
|
||||||
public Viewer Viewer { get; }
|
public Viewer Viewer { get; }
|
||||||
@@ -29,12 +30,14 @@ internal sealed class InventoryTransaction : IInventoryTransaction
|
|||||||
IDbContextTransaction dbTx,
|
IDbContextTransaction dbTx,
|
||||||
Viewer viewer,
|
Viewer viewer,
|
||||||
FreeplayConfig freeplay,
|
FreeplayConfig freeplay,
|
||||||
|
GrantSource source,
|
||||||
ILogger log)
|
ILogger log)
|
||||||
{
|
{
|
||||||
_db = db;
|
_db = db;
|
||||||
_dbTx = dbTx;
|
_dbTx = dbTx;
|
||||||
Viewer = viewer;
|
Viewer = viewer;
|
||||||
_freeplay = freeplay;
|
_freeplay = freeplay;
|
||||||
|
_source = source;
|
||||||
_log = log;
|
_log = log;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user