forked from Emmy123222/Stellar-MicroPay
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalytics.js
More file actions
80 lines (71 loc) · 1.74 KB
/
Copy pathanalytics.js
File metadata and controls
80 lines (71 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/**
* src/routes/analytics.js
* Analytics endpoints for transaction volume insights.
*/
"use strict";
const express = require("express");
const router = express.Router();
const { strictLimiter } = require("../middleware/rateLimit");
const { sanitizePublicKey } = require("../middleware/sanitization");
const analyticsController = require("../controllers/analyticsController");
/**
* GET /api/analytics/:publicKey/summary
* Returns: total sent, received, unique counterparties, avg transaction size.
*/
router.get(
"/:publicKey/summary",
strictLimiter,
sanitizePublicKey,
analyticsController.getSummary
);
/**
* GET /api/analytics/:publicKey/top-recipients
* Returns: top 5 addresses by total XLM sent, sorted descending.
*/
router.get(
"/:publicKey/top-recipients",
strictLimiter,
sanitizePublicKey,
analyticsController.getTopRecipients
);
/**
* GET /api/analytics/:publicKey/activity
* Returns: payment count by day of week (all 7 days).
*/
router.get(
"/:publicKey/activity",
strictLimiter,
sanitizePublicKey,
analyticsController.getActivityByDay
);
/**
* POST /api/analytics/:publicKey/export-schedule
* Set up recurring email export.
*/
router.post(
"/:publicKey/export-schedule",
strictLimiter,
sanitizePublicKey,
analyticsController.scheduleExport
);
/**
* GET /api/analytics/:publicKey/export-schedule
* Get scheduled export configuration.
*/
router.get(
"/:publicKey/export-schedule",
strictLimiter,
sanitizePublicKey,
analyticsController.getExportSchedule
);
/**
* POST /api/analytics/:publicKey/export-trigger
* Manually trigger sending export email.
*/
router.post(
"/:publicKey/export-trigger",
strictLimiter,
sanitizePublicKey,
analyticsController.triggerExport
);
module.exports = router;