flatten app to repo root and update docker deployment for single-stack runtime
This commit is contained in:
26
app/api/filings/[accessionNumber]/analyze/route.ts
Normal file
26
app/api/filings/[accessionNumber]/analyze/route.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { asErrorMessage, jsonError } from '@/lib/server/http';
|
||||
import { enqueueTask } from '@/lib/server/tasks';
|
||||
|
||||
type Context = {
|
||||
params: Promise<{ accessionNumber: string }>;
|
||||
};
|
||||
|
||||
export async function POST(_request: Request, context: Context) {
|
||||
try {
|
||||
const { accessionNumber } = await context.params;
|
||||
|
||||
if (!accessionNumber || accessionNumber.trim().length < 4) {
|
||||
return jsonError('Invalid accession number');
|
||||
}
|
||||
|
||||
const task = await enqueueTask({
|
||||
taskType: 'analyze_filing',
|
||||
payload: { accessionNumber: accessionNumber.trim() },
|
||||
priority: 65
|
||||
});
|
||||
|
||||
return Response.json({ task });
|
||||
} catch (error) {
|
||||
return jsonError(asErrorMessage(error, 'Failed to queue filing analysis task'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user