This commit is contained in:
boufni95 2025-09-15 18:51:38 +00:00
parent 5addd12928
commit e1bad5af02
4 changed files with 0 additions and 19 deletions

View file

@ -214,15 +214,12 @@ 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 ops = await this.storage.paymentStorage.GetAppOperations(app, { from: req.from_unix, to: req.to_unix }) const ops = 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[] = []
ops.receivingInvoices.forEach(i => { ops.receivingInvoices.forEach(i => {
if (i.paid_at_unix > 0) { if (i.paid_at_unix > 0) {

View file

@ -32,7 +32,6 @@ export function deserializeFindOperator(serialized: SerializedFindOperator): Fin
case 'ilike': case 'ilike':
return ILike(serialized.value); return ILike(serialized.value);
case 'between': case 'between':
console.log("serializing between", serialized.value)
return Between(serialized.value[0], serialized.value[1]); return Between(serialized.value[0], serialized.value[1]);
case 'in': case 'in':
return In(serialized.value); return In(serialized.value);

View file

@ -449,16 +449,9 @@ class StorageProcessor {
} }
private async handleFind(operation: FindOperation<any>) { private async handleFind(operation: FindOperation<any>) {
if(operation.entity == 'BalanceEvent') {
//@ts-ignore
console.log(operation.q.where?.created_at._value)
}
const res = await this.handleRead(operation.txId, eM => { const res = await this.handleRead(operation.txId, eM => {
return eM.getRepository(this.getEntity(operation.entity)).find(operation.q) return eM.getRepository(this.getEntity(operation.entity)).find(operation.q)
}) })
if(operation.entity == 'BalanceEvent') {
console.log(res)
}
this.sendResponse({ this.sendResponse({
success: true, success: true,
type: 'find', type: 'find',

View file

@ -82,10 +82,6 @@ export default class {
async GetBalanceEvents({ from, to }: { from?: number, to?: number }, txId?: string) { async GetBalanceEvents({ from, to }: { from?: number, to?: number }, txId?: string) {
const q = getTimeQuery({ from, to }) const q = getTimeQuery({ from, to })
const chainBalanceEvents = await this.dbs.Find<BalanceEvent>('BalanceEvent', q, txId) const chainBalanceEvents = await this.dbs.Find<BalanceEvent>('BalanceEvent', q, txId)
//@ts-ignore
console.log(q.where?.created_at._value)
console.log("chainBalanceEvents")
console.log(chainBalanceEvents)
return { chainBalanceEvents } return { chainBalanceEvents }
} }
@ -163,16 +159,12 @@ const getTimeQuery = ({ from, to }: { from?: number, to?: number }): FindManyOpt
if (!!from && !!to) { if (!!from && !!to) {
const fromDate = new Date(from * 1000) const fromDate = new Date(from * 1000)
const toDate = new Date(to * 1000) const toDate = new Date(to * 1000)
console.log("from", fromDate)
console.log("to", toDate)
return { where: { created_at: Between<Date>(fromDate, toDate) }, order: { created_at: 'ASC' } } return { where: { created_at: Between<Date>(fromDate, toDate) }, order: { created_at: 'ASC' } }
} else if (!!from) { } else if (!!from) {
const fromDate = new Date(from * 1000) const fromDate = new Date(from * 1000)
console.log("from", fromDate)
return { where: { created_at: MoreThanOrEqual<Date>(fromDate) }, order: { created_at: 'ASC' } } return { where: { created_at: MoreThanOrEqual<Date>(fromDate) }, order: { created_at: 'ASC' } }
} else if (!!to) { } else if (!!to) {
const toDate = new Date(to * 1000) const toDate = new Date(to * 1000)
console.log("to", toDate)
return { where: { created_at: LessThanOrEqual<Date>(toDate) }, order: { created_at: 'ASC' } } return { where: { created_at: LessThanOrEqual<Date>(toDate) }, order: { created_at: 'ASC' } }
} }
return {} return {}