@agentbadge/database 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -37,17 +37,15 @@ export class SpendApprovalRepository {
|
|
|
37
37
|
return this.db.orm.public.SpendApproval.where({ id }).first();
|
|
38
38
|
}
|
|
39
39
|
async listByWallet(wallet, state) {
|
|
40
|
-
let q = this.db.orm.public.SpendApproval.orderBy((a) => a.
|
|
40
|
+
let q = this.db.orm.public.SpendApproval.orderBy((a) => a.createdAtMs.desc()).where({ wallet: wallet.toLowerCase() });
|
|
41
41
|
if (state !== undefined)
|
|
42
42
|
q = q.where({ state });
|
|
43
|
-
|
|
44
|
-
return rows.sort((x, y) => Number(y.createdAtMs) - Number(x.createdAtMs));
|
|
43
|
+
return q.all();
|
|
45
44
|
}
|
|
46
45
|
async listAll(limit = 1_000) {
|
|
47
|
-
|
|
46
|
+
return this.db.orm.public.SpendApproval.orderBy((a) => a.createdAtMs.desc())
|
|
48
47
|
.limit(limit)
|
|
49
48
|
.all();
|
|
50
|
-
return rows.sort((x, y) => Number(y.createdAtMs) - Number(x.createdAtMs));
|
|
51
49
|
}
|
|
52
50
|
async decide(id, to, actor, decidedAtMs, expiresAtMs, payload) {
|
|
53
51
|
const row = await this.db.orm.public.SpendApproval.where({
|