ReviewOS

also looking at this

stacks/postline

UI polish, real queue + scheduling, Bluesky threads, live analytics, blog target

#8
Merged glennmichael123 wants to merge feat/ui-polish into main
54 files +2036 -589
app/Actions/Postline/QueuePublishNowAction.tsadded+28-0
Changes to app/Actions/Postline/QueuePublishNowAction.ts
@@ -0,0 +1,28 @@
1import type { RequestInstance } from '@stacksjs/types'
2import { Action } from '@stacksjs/actions'
3import { response } from '@stacksjs/router'
4import { postQueue } from '../../Services/Social/QueueService'
5
6export default new Action({
7 name: 'Postline Queue Publish Now',
8 description: 'Publish a draft, scheduled, or failed post immediately.',
9 method: 'POST',
10
11 async handle(request: RequestInstance) {
12 const id = Number(request.get('id') || 0)
13 if (!id)
14 return response.json({ ok: false, error: 'Post id is required.' }, { status: 422 })
15
16 try {
17 const data = await postQueue.publishNow(id)
18 const allFailed = data.results.length > 0 && data.results.every(result => !result.ok)
19 return response.json({ ok: !allFailed, data }, { status: allFailed ? 422 : 200 })
20 }
21 catch (error) {
22 return response.json({
23 ok: false,
24 error: error instanceof Error ? error.message : String(error),
25 }, { status: 422 })
26 }
27 },
28})