This commit is contained in:
boufni95 2025-09-12 17:05:37 +00:00
parent 038c20ec2d
commit bc63d8bdc6

View file

@ -214,12 +214,15 @@ export default class Handler {
} }
async GetAppMetrics(req: Types.AppsMetricsRequest, app: Application | null): Promise<Types.AppMetrics> { async GetAppMetrics(req: Types.AppsMetricsRequest, app: Application | null): Promise<Types.AppMetrics> {
console.log("fetching app metrics")
const totalFees = await this.storage.paymentStorage.GetTotalFeesPaidInApp(app) const totalFees = await this.storage.paymentStorage.GetTotalFeesPaidInApp(app)
console.log("fetching ops")
const { receivingInvoices, receivingTransactions, outgoingInvoices, outgoingTransactions, receivingAddresses, userToUser } = await this.storage.paymentStorage.GetAppOperations(app, { from: req.from_unix, to: req.to_unix }) const { receivingInvoices, receivingTransactions, outgoingInvoices, outgoingTransactions, receivingAddresses, userToUser } = await this.storage.paymentStorage.GetAppOperations(app, { from: req.from_unix, to: req.to_unix })
let totalReceived = 0 let totalReceived = 0
let totalSpent = 0 let totalSpent = 0
let unpaidInvoices = 0 let unpaidInvoices = 0
let feesInRange = 0 let feesInRange = 0
console.log("processing metrics")
const operations: Types.UserOperation[] = [] const operations: Types.UserOperation[] = []
receivingInvoices.forEach(i => { receivingInvoices.forEach(i => {
if (i.paid_at_unix > 0) { if (i.paid_at_unix > 0) {