init
This commit is contained in:
21
donations/server/functions.js
Normal file
21
donations/server/functions.js
Normal 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 }
|
||||
}
|
||||
Reference in New Issue
Block a user