mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-21 22:18:08 +02:00
feat: implement PostgreSQL FF Nancy client to replace per-article HTTP API calls with bulk SQL queries
This commit is contained in:
1 parent
94018fa885
commit
db90ed6e41
1 file changed
+7
@@ -550,6 +550,13 @@ interface ApiPerfDashboard {
|
|||||||
* N-1 : même jour de semaine (52 semaines = 364 jours avant hier).
|
* N-1 : même jour de semaine (52 semaines = 364 jours avant hier).
|
||||||
*/
|
*/
|
||||||
export async function pgGetDashboardData(): Promise<DashboardData> {
|
export async function pgGetDashboardData(): Promise<DashboardData> {
|
||||||
|
try {
|
||||||
|
const sampleResult = await pgNoParallel(sql`SELECT codein, no_id FROM articles LIMIT 5`);
|
||||||
|
require('fs').writeFileSync('c:/GIT/CollectFlow/scripts/db-sample.json', JSON.stringify(sampleResult.rows, null, 2));
|
||||||
|
} catch (e: any) {
|
||||||
|
require('fs').writeFileSync('c:/GIT/CollectFlow/scripts/db-sample.json', JSON.stringify({error: e.message}));
|
||||||
|
}
|
||||||
|
|
||||||
const yesterday = new Date();
|
const yesterday = new Date();
|
||||||
yesterday.setDate(yesterday.getDate() - 1);
|
yesterday.setDate(yesterday.getDate() - 1);
|
||||||
const dateHier = yesterday.toISOString().split("T")[0];
|
const dateHier = yesterday.toISOString().split("T")[0];
|
||||||
|
|||||||
Reference in new issue
Block a user