5.4.0
Restructure New Journal entries Colour tabs update with wind
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
// GET -> { ok:true, entries: [{ id, date, endDate, note, profile, solarEnv, reading, locationName, lat, lon, createdAt }, ...] }, newest first.
|
||||
require __DIR__ . '/../lib/bootstrap.php';
|
||||
|
||||
$user = require_user();
|
||||
|
||||
$stmt = db()->prepare(
|
||||
'SELECT id, entry_date, end_date, note, profile, solar_env, reading, location_name, lat, lon, created_at
|
||||
FROM journal_entries
|
||||
WHERE user_id = ?
|
||||
ORDER BY entry_date DESC, id DESC'
|
||||
);
|
||||
$stmt->execute([$user['id']]);
|
||||
|
||||
$entries = array_map(fn($r) => [
|
||||
'id' => (int)$r['id'],
|
||||
'date' => $r['entry_date'],
|
||||
'endDate' => $r['end_date'],
|
||||
'note' => $r['note'],
|
||||
'profile' => $r['profile'],
|
||||
'solarEnv' => $r['solar_env'],
|
||||
'reading' => $r['reading'] !== null ? (float)$r['reading'] : null,
|
||||
'locationName' => $r['location_name'],
|
||||
'lat' => $r['lat'] !== null ? (float)$r['lat'] : null,
|
||||
'lon' => $r['lon'] !== null ? (float)$r['lon'] : null,
|
||||
'createdAt' => $r['created_at'],
|
||||
], $stmt->fetchAll());
|
||||
|
||||
json_out(['ok' => true, 'entries' => $entries]);
|
||||
Reference in New Issue
Block a user