Fix query
This commit is contained in:
@ -115,12 +115,14 @@ public class NostrStreamManager : IStreamManager
|
|||||||
var cost = (long)Math.Ceiling(_context.UserStream.Endpoint.Cost * (duration / 60d));
|
var cost = (long)Math.Ceiling(_context.UserStream.Endpoint.Cost * (duration / 60d));
|
||||||
if (cost > 0)
|
if (cost > 0)
|
||||||
{
|
{
|
||||||
await _context.Db.Streams
|
await _context.Db.Users
|
||||||
.Include(a => a.User)
|
.Where(a => a.PubKey == _context.User.PubKey)
|
||||||
.Where(a => a.PubKey == _context.User.PubKey && a.Id == _context.UserStream.Id)
|
|
||||||
.ExecuteUpdateAsync(o =>
|
.ExecuteUpdateAsync(o =>
|
||||||
o.SetProperty(v => v.User.Balance, v => v.User.Balance - cost)
|
o.SetProperty(v => v.Balance, v => v.Balance - cost));
|
||||||
.SetProperty(v => v.MilliSatsCollected, v => v.MilliSatsCollected + cost));
|
await _context.Db.Streams
|
||||||
|
.Where(a => a.Id == _context.UserStream.Id)
|
||||||
|
.ExecuteUpdateAsync(o =>
|
||||||
|
o.SetProperty(v => v.MilliSatsCollected, v => v.MilliSatsCollected + cost));
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Stream produced {n} seconds for {pubkey} costing {cost:#,##0} milli-sats", duration,
|
_logger.LogInformation("Stream produced {n} seconds for {pubkey} costing {cost:#,##0} milli-sats", duration,
|
||||||
|
Reference in New Issue
Block a user