Merge pull request #69 from Hestia-Homes/feature/show_condition_json

save
This commit is contained in:
Jun-te Kim 2025-08-20 13:20:55 +01:00 committed by GitHub
commit c0dfcfdf1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 0 deletions

View file

@ -0,0 +1,22 @@
import { NextRequest, NextResponse } from "next/server";
import { sendToQueue } from "@/app/utils/sqs";
export async function POST(req: NextRequest) {
try {
const { id } = await req.json();
if (!id) {
return NextResponse.json({ error: "Missing id" }, { status: 400 });
}
const resp = await sendToQueue({ id }, { queueName: "extractor-loader-queue" });
return NextResponse.json(
{ ok: true, messageId: resp.MessageId },
{ status: 200 }
);
} catch (err: any) {
console.error("SQS enqueue failed:", err);
return NextResponse.json({ error: err.message }, { status: 500 });
}
}

View file

@ -0,0 +1,13 @@
import { NextResponse } from "next/server";
import { listQueues } from "@/app/utils/sqs";
// Handle GET requests
export async function GET() {
try {
const queues = await listQueues(); // optionally pass a prefix
return NextResponse.json({ queues }, { status: 200 });
} catch (err: any) {
console.error(err);
return NextResponse.json({ error: err.message }, { status: 500 });
}
}