- Event-Medien tragen Typ (image/video/audio), Dauer und Notiz; Videos bekommen ein Poster, Audio wird per ffmpeg nach AAC (audio/mp4) gewandelt, Originale werden mit Range-Unterstützung gestreamt. - Upload nimmt eine Notiz (caption) direkt mit, PATCH ändert sie später. - Neue Event-Felder: Zeitraum (end_date), Kategorie, Personen, Meilenstein. Regeln zentral in EventFields, damit CRUD und Sync gleich prüfen. - Titel darf leer sein: ein Event entsteht mit dem ersten Eintrag. - Artisan-Befehl media:transcode-voice-notes wandelt alte WebM/Ogg-Notizen, die Safari nicht abspielen kann. - Login-Throttling, Settings-Validierung, Sync-Fehlercodes ohne Rohtext. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
33 lines
1.2 KiB
PHP
33 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class EventResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->client_id,
|
|
'title' => $this->title,
|
|
'date' => substr((string) $this->date, 0, 10),
|
|
'endDate' => $this->end_date ? substr((string) $this->end_date, 0, 10) : null,
|
|
'location' => $this->location ?? '',
|
|
'category' => $this->category,
|
|
'people' => $this->people ?? [],
|
|
'emotion' => (float) $this->emotion,
|
|
'milestone' => (bool) $this->milestone,
|
|
'customColor' => $this->custom_color,
|
|
'gradientPreset' => $this->gradient_preset,
|
|
'image' => $this->image,
|
|
'keyImageTitle' => $this->key_image_title ?? '',
|
|
'note' => $this->note ?? '',
|
|
'media' => EventMediaResource::collection($this->whenLoaded('media')),
|
|
'syncStatus' => 'synced',
|
|
'createdAt' => $this->created_at->getTimestampMs(),
|
|
'updatedAt' => $this->updated_at->getTimestampMs(),
|
|
];
|
|
}
|
|
}
|