This commit is contained in:
metacryst
2026-04-28 20:05:00 -05:00
commit 0d6c7683ff
123 changed files with 20922 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
export async function getMoneyData(networkId) {
const purchases = await this.sql`
SELECT * FROM purchases
WHERE network_id = ${networkId}
ORDER BY created DESC
`;
const subscriptions = await this.sql`
SELECT mn.id, mn.created, mn.active, mn.network_plan_id,
np.name AS plan_name, np.price AS plan_price,
m.first_name, m.last_name, m.email
FROM member_networks mn
JOIN network_plans np ON mn.network_plan_id = np.id
LEFT JOIN members m ON mn.member_id = m.id
WHERE mn.network_id = ${networkId}
AND mn.network_plan_id IS NOT NULL
ORDER BY mn.created DESC
`;
return { purchases, subscriptions }
}