More convenience methods for the dashy

This commit is contained in:
Kwoth
2024-04-23 09:12:24 +00:00
parent cc060da1a7
commit c9fb0a8b03
7 changed files with 96 additions and 70 deletions

View File

@@ -39,5 +39,5 @@ public interface ICurrencyService
long amount,
TxData? txData);
Task<IReadOnlyList<DiscordUser>> GetTopRichest(ulong ignoreId, int count);
Task<IReadOnlyList<DiscordUser>> GetTopRichest(ulong ignoreId, int page = 0, int perPage = 9);
}

View File

@@ -94,10 +94,10 @@ public sealed class CurrencyService : ICurrencyService, INService
{
if (amount == 0)
return true;
var wallet = await GetWalletAsync(userId);
var result = await wallet.Take(amount, txData);
if(result)
if (result)
await _txTracker.TrackRemove(amount, txData);
return result;
}
@@ -108,9 +108,9 @@ public sealed class CurrencyService : ICurrencyService, INService
TxData txData)
=> await RemoveAsync(user.Id, amount, txData);
public async Task<IReadOnlyList<DiscordUser>> GetTopRichest(ulong ignoreId, int count)
public async Task<IReadOnlyList<DiscordUser>> GetTopRichest(ulong ignoreId, int page = 0, int perPage = 9)
{
await using var uow = _db.GetDbContext();
return await uow.Set<DiscordUser>().GetTopRichest(ignoreId, count);
return await uow.Set<DiscordUser>().GetTopRichest(ignoreId, page, perPage);
}
}