You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
950 B
34 lines
950 B
import { parseAdminAuth } from "@/lib/api/admin-auth-context";
|
|
import { fail, ok } from "@/lib/response";
|
|
import { AuthError } from "@/modules/auth/errors";
|
|
import { requirePermission } from "@/modules/auth/rbac";
|
|
import { RPA_QUEUE_NAME } from "@/lib/constants/rpa";
|
|
import { getQuoteRpaQueueCounts } from "@/workers/rpa/queue";
|
|
|
|
export async function GET(request: Request) {
|
|
let auth;
|
|
try {
|
|
auth = parseAdminAuth(request);
|
|
requirePermission(auth, "rpa:operate");
|
|
} catch (error) {
|
|
if (error instanceof AuthError) {
|
|
return fail(error.code, error.message, error.httpStatus);
|
|
}
|
|
throw error;
|
|
}
|
|
|
|
void auth;
|
|
|
|
const counts = await getQuoteRpaQueueCounts();
|
|
|
|
return ok({
|
|
queue_name: RPA_QUEUE_NAME,
|
|
waiting: counts.waiting,
|
|
active: counts.active,
|
|
delayed: counts.delayed,
|
|
failed: counts.failed,
|
|
completed: counts.completed,
|
|
depth: counts.waiting + counts.active + counts.delayed,
|
|
});
|
|
}
|