ReviewOS

also looking at this

stacks/postline

Edit queued and scheduled posts (#21)

#22
Merged glennmichael123 wants to merge feat/edit-queued-posts into main
6 files +359 -7
app/Actions/Postline/QueueGetAction.tsadded+27-0
Changes to app/Actions/Postline/QueueGetAction.ts
@@ -0,0 +1,27 @@
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 Get',
8 description: 'Fetch one queued post\'s editable state for the composer.',
9 method: 'GET',
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.get(id)
18 return response.json({ ok: true, data })
19 }
20 catch (error) {
21 return response.json({
22 ok: false,
23 error: error instanceof Error ? error.message : String(error),
24 }, { status: 404 })
25 }
26 },
27})