Consolidates the previously separate omsorgapp and omsorgCore repos (each had their own nested .git with GitHub history) plus the old root-level website/mitarbeiter-app into a single monorepo, matching the structure already documented in the root CLAUDE.md. Also moves the PHP employee app aside as omsorgWeb/mitarbeiter-app-legacy/ to serve as a template for a ground-up rewrite. Fixes .gitignore in the same pass: the config-secrets/uploads/data patterns were unanchored (relative to repo root, not depth-agnostic), so they silently stopped matching once the app moved under omsorgWeb/. Patterns are now **/-prefixed and cover both mitarbeiter-app and mitarbeiter-app-legacy, keeping DB/SMTP credentials and uploaded employee documents out of version control. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
46 lines
1.0 KiB
PHP
46 lines
1.0 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../lib/auth.php';
|
|
require_admin();
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
if (($_SERVER['HTTP_X_REQUESTED_WITH'] ?? '') !== 'XMLHttpRequest') {
|
|
echo json_encode(['ok' => false, 'error' => 'forbidden']);
|
|
exit;
|
|
}
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
|
echo json_encode(['ok' => false, 'error' => 'method']);
|
|
exit;
|
|
}
|
|
|
|
$body = file_get_contents('php://input');
|
|
$data = json_decode($body, true);
|
|
$order = $data['order'] ?? null;
|
|
|
|
if (!is_array($order)) {
|
|
echo json_encode(['ok' => false, 'error' => 'invalid']);
|
|
exit;
|
|
}
|
|
|
|
$ids = array_values(array_filter(array_map('intval', $order), fn($v) => $v > 0));
|
|
|
|
if (empty($ids)) {
|
|
echo json_encode(['ok' => true]);
|
|
exit;
|
|
}
|
|
|
|
$now = date('c');
|
|
$pos = 10;
|
|
$stmt = db()->prepare('UPDATE downloads SET sort_order = ?, updated_at = ? WHERE id = ?');
|
|
|
|
db()->beginTransaction();
|
|
foreach ($ids as $id) {
|
|
$stmt->execute([$pos, $now, $id]);
|
|
$pos += 10;
|
|
}
|
|
db()->commit();
|
|
|
|
echo json_encode(['ok' => true]);
|
|
exit;
|