main
|
Last change
on this file since ff3a614 was ff3a614, checked in by Tome <gjorgievtome@…>, 4 months ago |
|
Fix SQL functions for reporting and update queries in reports
|
-
Property mode
set to
100644
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | import 'dotenv/config';
|
|---|
| 2 | import { db } from '../db';
|
|---|
| 3 | import { sql } from 'drizzle-orm';
|
|---|
| 4 |
|
|---|
| 5 | async function main() {
|
|---|
| 6 | console.log("Generating Reports . . .");
|
|---|
| 7 |
|
|---|
| 8 | try {
|
|---|
| 9 | const r1 = await db.execute(sql`SELECT * FROM get_report_top_components()`);
|
|---|
| 10 | console.log('--- Top Performing Components ---');
|
|---|
| 11 | console.table(r1.rows);
|
|---|
| 12 |
|
|---|
| 13 | const r2 = await db.execute(sql`SELECT * FROM get_report_user_reputation_leaderboard()`);
|
|---|
| 14 | console.log('--- User Reputation Leaderboard ---');
|
|---|
| 15 | console.table(r2.rows);
|
|---|
| 16 |
|
|---|
| 17 | const r3 = await db.execute(sql`SELECT * FROM get_report_price_to_performance()`);
|
|---|
| 18 | console.log('--- Price-to-Performance Analysis ---');
|
|---|
| 19 | console.table(r3.rows);
|
|---|
| 20 |
|
|---|
| 21 | const r4 = await db.execute(sql`SELECT * FROM get_report_budget_tier_popularity()`);
|
|---|
| 22 | console.log('--- Budget Tier Popularity ---');
|
|---|
| 23 | console.table(r4.rows);
|
|---|
| 24 |
|
|---|
| 25 | const r5 = await db.execute(sql`SELECT * FROM get_report_compatibility()`);
|
|---|
| 26 | console.log('--- Component Compatibility ---');
|
|---|
| 27 | console.table(r5.rows);
|
|---|
| 28 |
|
|---|
| 29 | const r6 = await db.execute(sql`SELECT * FROM get_report_storage_optimization()`);
|
|---|
| 30 | console.log('--- Storage Optimization ---');
|
|---|
| 31 | console.table(r6.rows);
|
|---|
| 32 |
|
|---|
| 33 | process.exit(0);
|
|---|
| 34 | } catch (e) {
|
|---|
| 35 | console.error(e);
|
|---|
| 36 | process.exit(1);
|
|---|
| 37 | }
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | main();
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.