Actualiser api/index.php
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
Security Scan (Trivy) / Trivy — Docker image scan (push) Has been cancelled
Security Scan (Trivy) / Trivy — Filesystem scan (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
Security Scan (Trivy) / Trivy — Docker image scan (push) Has been cancelled
Security Scan (Trivy) / Trivy — Filesystem scan (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
This commit is contained in:
+7
-5
@@ -12431,7 +12431,7 @@ function recipeLibraryToggleFavorite(PDO $db): void {
|
||||
}
|
||||
|
||||
function recipeTagsList(PDO $db): void {
|
||||
$rows = $db->query("SELECT id, key, label, icon, sort_order FROM recipe_tags ORDER BY sort_order ASC, id ASC")->fetchAll();
|
||||
$rows = $db->query("SELECT id, key, label, icon, sort_order, keywords FROM recipe_tags ORDER BY sort_order ASC, id ASC")->fetchAll();
|
||||
echo json_encode(['success' => true, 'tags' => $rows]);
|
||||
}
|
||||
|
||||
@@ -12439,6 +12439,7 @@ function recipeTagsAdd(PDO $db): void {
|
||||
$input = json_decode(file_get_contents('php://input'), true) ?? [];
|
||||
$label = trim($input['label'] ?? '');
|
||||
$icon = trim($input['icon'] ?? '🏷️');
|
||||
$keywords = trim($input['keywords'] ?? '');
|
||||
|
||||
if ($label === '') {
|
||||
echo json_encode(['success' => false, 'error' => 'label required']);
|
||||
@@ -12462,8 +12463,8 @@ function recipeTagsAdd(PDO $db): void {
|
||||
|
||||
$maxOrder = (int)$db->query("SELECT COALESCE(MAX(sort_order), 0) FROM recipe_tags")->fetchColumn();
|
||||
|
||||
$stmt = $db->prepare("INSERT INTO recipe_tags (key, label, icon, sort_order) VALUES (?, ?, ?, ?)");
|
||||
$stmt->execute([$key, $label, $icon, $maxOrder + 1]);
|
||||
$stmt = $db->prepare("INSERT INTO recipe_tags (key, label, icon, sort_order, keywords) VALUES (?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$key, $label, $icon, $maxOrder + 1, $keywords]);
|
||||
|
||||
echo json_encode(['success' => true, 'key' => $key]);
|
||||
}
|
||||
@@ -12495,6 +12496,7 @@ function recipeTagsUpdate(PDO $db): void {
|
||||
$key = trim($input['key'] ?? '');
|
||||
$label = trim($input['label'] ?? '');
|
||||
$icon = trim($input['icon'] ?? '');
|
||||
$keywords = trim($input['keywords'] ?? '');
|
||||
|
||||
if ($key === '' || $label === '') {
|
||||
echo json_encode(['success' => false, 'error' => 'key and label required']);
|
||||
@@ -12508,8 +12510,8 @@ function recipeTagsUpdate(PDO $db): void {
|
||||
return;
|
||||
}
|
||||
|
||||
$stmt = $db->prepare("UPDATE recipe_tags SET label = ?, icon = ? WHERE key = ?");
|
||||
$stmt->execute([$label, $icon ?: '🏷️', $key]);
|
||||
$stmt = $db->prepare("UPDATE recipe_tags SET label = ?, icon = ?, keywords = ? WHERE key = ?");
|
||||
$stmt->execute([$label, $icon ?: '🏷️', $keywords, $key]);
|
||||
|
||||
echo json_encode(['success' => true]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user