REF: get user invoices

This commit is contained in:
Overtorment
2020-03-27 21:03:38 +00:00
parent b58e7dac88
commit d7e91f51ec
2 changed files with 14 additions and 14 deletions

View File

@@ -234,8 +234,11 @@ export class User {
return await this._redis.get('ispaid_' + payment_hash);
}
async getUserInvoices() {
async getUserInvoices(limit) {
let range = await this._redis.lrange('userinvoices_for_' + this._userid, 0, -1);
if (limit && !isNaN(parseInt(limit))) {
range = range.slice(parseInt(limit) * -1);
}
let result = [];
for (let invoice of range) {
invoice = JSON.parse(invoice);