Files
sunscope/api/journal-delete.php
T
fraxle 71860b9dd9 5.4.0
Restructure
New Journal entries
Colour tabs update with wind
2026-08-31 15:12:45 +01:00

19 lines
467 B
PHP

<?php
// POST { id } -> deletes an entry the caller owns.
require __DIR__ . '/../lib/bootstrap.php';
require_method('POST');
$user = require_user();
$body = json_body();
$id = (int)($body['id'] ?? 0);
if ($id <= 0) json_error('Invalid id.');
$stmt = db()->prepare('DELETE FROM journal_entries WHERE id = ? AND user_id = ?');
$stmt->execute([$id, $user['id']]);
if ($stmt->rowCount() === 0) {
json_error('Entry not found.', 404);
}
json_out(['ok' => true]);