MCP Feature added
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
require_once __DIR__ . '/../includes/api_bootstrap.php';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'GET') {
|
||||
sendJson(['success' => false, 'error' => 'Method not allowed'], 405);
|
||||
}
|
||||
|
||||
$people = normalizePeopleList(readJsonFile('people.json'));
|
||||
requireActivePerson($people);
|
||||
|
||||
$allowed = [
|
||||
'people' => 'people.json',
|
||||
'chores' => 'chores.json',
|
||||
'stores' => 'stores.json',
|
||||
'grocery_lists' => 'grocery_lists.json',
|
||||
'grocery_catalog' => 'grocery_catalog.json',
|
||||
'meals' => 'meals.json',
|
||||
'meal_plans' => 'meal_plans.json',
|
||||
'family_settings' => 'family_settings.json',
|
||||
'expenses' => 'expenses.json',
|
||||
];
|
||||
|
||||
$type = isset($_GET['type']) ? trim((string) $_GET['type']) : '';
|
||||
if ($type === '' || !isset($allowed[$type])) {
|
||||
sendJson(['success' => false, 'error' => 'type must be one of: ' . implode(', ', array_keys($allowed))], 400);
|
||||
}
|
||||
|
||||
$data = readJsonFile($allowed[$type]);
|
||||
sendJson(['success' => true, 'type' => $type, 'data' => $data]);
|
||||
Reference in New Issue
Block a user