refactor: 사용자 컨텍스트 메뉴에서 삭제 옵션 제거
This commit is contained in:
@@ -124,7 +124,7 @@ public function clone(int $id)
|
||||
}
|
||||
|
||||
/**
|
||||
* JSON 유효성 검사 (HTMX)
|
||||
* JSON 유효성 검사 및 메타 정보 추출
|
||||
*/
|
||||
public function validateJson(Request $request)
|
||||
{
|
||||
@@ -159,9 +159,38 @@ public function validateJson(Request $request)
|
||||
]);
|
||||
}
|
||||
|
||||
// meta 정보 추출
|
||||
$meta = $data['meta'] ?? [];
|
||||
$tags = $meta['tags'] ?? [];
|
||||
|
||||
// 카테고리 추론: tags[0] 또는 첫 번째 endpoint에서 추출
|
||||
$category = $tags[0] ?? null;
|
||||
if (! $category && ! empty($data['steps'])) {
|
||||
$firstEndpoint = $data['steps'][0]['endpoint'] ?? '';
|
||||
// /item-master/pages → item-master
|
||||
if (preg_match('#^/([^/]+)#', $firstEndpoint, $matches)) {
|
||||
$category = $matches[1];
|
||||
}
|
||||
}
|
||||
|
||||
// 이름 추론: meta.name 또는 description 첫 부분
|
||||
$name = $meta['name'] ?? null;
|
||||
if (! $name && ! empty($meta['description'])) {
|
||||
// 설명의 첫 번째 줄 또는 50자까지
|
||||
$name = mb_substr(strtok($meta['description'], "\n"), 0, 50);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'valid' => true,
|
||||
'stepCount' => count($data['steps'] ?? []),
|
||||
'extracted' => [
|
||||
'name' => $name,
|
||||
'description' => $meta['description'] ?? null,
|
||||
'category' => $category,
|
||||
'author' => $meta['author'] ?? null,
|
||||
'tags' => $tags,
|
||||
'version' => $data['version'] ?? '1.0',
|
||||
],
|
||||
]);
|
||||
} catch (\JsonException $e) {
|
||||
return response()->json([
|
||||
|
||||
Reference in New Issue
Block a user