21 lines
735 B
TypeScript
21 lines
735 B
TypeScript
import { aggregateZapSats } from './zapAggregation'
|
|
|
|
export interface SeriesAggregates {
|
|
sponsoring: number
|
|
purchases: number
|
|
reviewTips: number
|
|
}
|
|
|
|
export async function getSeriesAggregates(params: {
|
|
authorPubkey: string
|
|
seriesId: string
|
|
}): Promise<SeriesAggregates> {
|
|
const [sponsoring, purchases, reviewTips] = await Promise.all([
|
|
aggregateZapSats({ authorPubkey: params.authorPubkey, seriesId: params.seriesId, kindType: 'sponsoring' }),
|
|
aggregateZapSats({ authorPubkey: params.authorPubkey, seriesId: params.seriesId, kindType: 'purchase' }),
|
|
aggregateZapSats({ authorPubkey: params.authorPubkey, seriesId: params.seriesId, kindType: 'review_tip' }),
|
|
])
|
|
|
|
return { sponsoring, purchases, reviewTips }
|
|
}
|