5.4.0
Restructure New Journal entries Colour tabs update with wind
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?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]);
|
||||
Reference in New Issue
Block a user