배치 수정 페이지 저장 및 API 미리보기 버그 수정
This commit is contained in:
parent
58ca340699
commit
b6a7b4a93b
|
|
@ -456,13 +456,7 @@ export class BatchManagementController {
|
|||
}
|
||||
}
|
||||
|
||||
// 토큰이 없으면 에러 (직접 입력도 안 하고 DB 선택도 안 한 경우)
|
||||
if (!finalApiKey) {
|
||||
return res.status(400).json({
|
||||
success: false,
|
||||
message: "인증 토큰이 필요합니다. 직접 입력하거나 DB에서 선택하세요.",
|
||||
});
|
||||
}
|
||||
// 토큰이 없어도 공개 API 호출 가능 (토큰 검증 제거)
|
||||
|
||||
console.log("REST API 미리보기 요청:", {
|
||||
apiUrl,
|
||||
|
|
|
|||
|
|
@ -328,6 +328,10 @@ export class BatchService {
|
|||
updateFields.push(`auth_service_name = $${paramIndex++}`);
|
||||
updateValues.push(data.authServiceName || null);
|
||||
}
|
||||
if (data.dataArrayPath !== undefined) {
|
||||
updateFields.push(`data_array_path = $${paramIndex++}`);
|
||||
updateValues.push(data.dataArrayPath || null);
|
||||
}
|
||||
|
||||
// 배치 설정 업데이트
|
||||
const batchConfigResult = await client.query(
|
||||
|
|
|
|||
|
|
@ -478,33 +478,35 @@ export default function BatchEditPage() {
|
|||
return;
|
||||
}
|
||||
|
||||
// DB 선택 모드일 때만 서비스명 검증 (직접 입력 모드는 빈 값 허용 - 공개 API용)
|
||||
if (authTokenMode === "db" && !authServiceName) {
|
||||
toast.error("인증 토큰 서비스를 선택해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const method =
|
||||
(first.from_api_method as "GET" | "POST" | "PUT" | "DELETE") || "GET";
|
||||
|
||||
const paramInfo =
|
||||
first.from_api_param_type &&
|
||||
first.from_api_param_name &&
|
||||
first.from_api_param_value
|
||||
apiParamType !== "none" && apiParamName && apiParamValue
|
||||
? {
|
||||
paramType: first.from_api_param_type as "url" | "query",
|
||||
paramName: first.from_api_param_name as string,
|
||||
paramValue: first.from_api_param_value as string,
|
||||
paramSource:
|
||||
(first.from_api_param_source as "static" | "dynamic") ||
|
||||
"static",
|
||||
paramType: apiParamType,
|
||||
paramName: apiParamName,
|
||||
paramValue: apiParamValue,
|
||||
paramSource: apiParamSource,
|
||||
}
|
||||
: undefined;
|
||||
|
||||
// authServiceName과 dataArrayPath 전달
|
||||
// authTokenMode에 따라 올바른 값 전달
|
||||
const result = await BatchManagementAPI.previewRestApiData(
|
||||
first.from_api_url,
|
||||
first.from_api_key || "",
|
||||
authTokenMode === "direct" ? fromApiKey : "", // 직접 입력일 때만 API 키 전달
|
||||
first.from_table_name,
|
||||
method,
|
||||
paramInfo,
|
||||
first.from_api_body || undefined,
|
||||
authServiceName || undefined,
|
||||
authTokenMode === "db" ? authServiceName : undefined, // DB 선택 모드일 때 서비스명 전달
|
||||
dataArrayPath || undefined
|
||||
);
|
||||
|
||||
|
|
@ -584,9 +586,9 @@ export default function BatchEditPage() {
|
|||
isActive,
|
||||
mappings: finalMappings,
|
||||
saveMode,
|
||||
conflictKey: saveMode === "UPSERT" ? conflictKey : undefined,
|
||||
authServiceName: authTokenMode === "db" ? authServiceName : undefined,
|
||||
dataArrayPath: dataArrayPath || undefined
|
||||
conflictKey: saveMode === "UPSERT" ? conflictKey : null, // INSERT면 null로 명시적 삭제
|
||||
authServiceName: authTokenMode === "db" ? authServiceName : null, // 직접입력이면 null로 명시적 삭제
|
||||
dataArrayPath: dataArrayPath || null
|
||||
});
|
||||
|
||||
toast.success("배치 설정이 성공적으로 수정되었습니다.");
|
||||
|
|
|
|||
Loading…
Reference in New Issue