flatten app to repo root and update docker deployment for single-stack runtime
This commit is contained in:
28
app/api/filings/sync/route.ts
Normal file
28
app/api/filings/sync/route.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { asErrorMessage, jsonError } from '@/lib/server/http';
|
||||
import { enqueueTask } from '@/lib/server/tasks';
|
||||
|
||||
export async function POST(request: Request) {
|
||||
try {
|
||||
const payload = await request.json() as {
|
||||
ticker?: string;
|
||||
limit?: number;
|
||||
};
|
||||
|
||||
if (!payload.ticker || payload.ticker.trim().length < 1) {
|
||||
return jsonError('ticker is required');
|
||||
}
|
||||
|
||||
const task = await enqueueTask({
|
||||
taskType: 'sync_filings',
|
||||
payload: {
|
||||
ticker: payload.ticker.trim().toUpperCase(),
|
||||
limit: payload.limit ?? 20
|
||||
},
|
||||
priority: 90
|
||||
});
|
||||
|
||||
return Response.json({ task });
|
||||
} catch (error) {
|
||||
return jsonError(asErrorMessage(error, 'Failed to queue filings sync task'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user