29 lines
818 B
TypeScript
29 lines
818 B
TypeScript
import { adaptWorkflowDetail } from "@/lib/adapters/workflows";
|
|
import { backendRequest } from "@/lib/http/backend-client";
|
|
import {
|
|
jsonSuccess,
|
|
parsePositiveIntegerParam,
|
|
withErrorHandling,
|
|
} from "@/lib/http/response";
|
|
import type { WorkflowStatusResponseDto } from "@/lib/types/backend";
|
|
|
|
type RouteContext = {
|
|
params: Promise<{
|
|
orderId: string;
|
|
}>;
|
|
};
|
|
|
|
export async function GET(_request: Request, context: RouteContext) {
|
|
return withErrorHandling(async () => {
|
|
const { orderId: rawOrderId } = await context.params;
|
|
const orderId = parsePositiveIntegerParam(rawOrderId, "orderId");
|
|
const response = await backendRequest<WorkflowStatusResponseDto>(
|
|
`/workflows/${orderId}`,
|
|
);
|
|
|
|
return jsonSuccess(adaptWorkflowDetail(response.data), {
|
|
mode: "proxy",
|
|
});
|
|
});
|
|
}
|