also looking at this
Sync Bluesky engagement metrics into analytics
#12
10 files
+200
-4
| @@ -0,0 +1,22 @@ | ||
| 1 | import { Action } from '@stacksjs/actions' | |
| 2 | import { response } from '@stacksjs/router' | |
| 3 | import { bluesky } from '../../Services/Social/BlueskyService' | |
| 4 | ||
| 5 | export default new Action({ | |
| 6 | name: 'Postline Metrics Sync', | |
| 7 | description: 'Refresh engagement metrics for published posts on demand.', | |
| 8 | method: 'POST', | |
| 9 | ||
| 10 | async handle() { | |
| 11 | try { | |
| 12 | const data = await bluesky.syncMetrics() | |
| 13 | return response.json({ ok: true, data }) | |
| 14 | } | |
| 15 | catch (error) { | |
| 16 | return response.json({ | |
| 17 | ok: false, | |
| 18 | error: error instanceof Error ? error.message : String(error), | |
| 19 | }, { status: 422 }) | |
| 20 | } | |
| 21 | }, | |
| 22 | }) | |