Mirrors the frontend catch-up in 570f17e: a substantial amount of
finished-but-never-committed backend work had accumulated locally.
- New CustomField module: admin-managed field definitions per client,
reorderable, typed values stored per client (backing the frontend's
ClientCustomFieldCard + settings/fields page)
- History entries switch from a hardcoded type enum to a dynamic,
admin-managed HistoryType module (reorderable, backing
settings/history-types)
- New Import module: CSV client import (backing settings/import)
- Clients table gains soft deletes (deleted_at)
- Supporting factories, seeders, policies, and feature tests for all
of the above
All 63 backend tests pass locally before this commit.
34 lines
1.4 KiB
PHP
34 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\History\Resources;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class HistoryEntryResource extends JsonResource
|
|
{
|
|
public function toArray(Request $request): array
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'client_id' => $this->client_id,
|
|
'is_field_change' => $this->isFieldChange(),
|
|
'history_entry_type_id' => $this->history_entry_type_id,
|
|
// Field-change audit rows render under a fixed system label; user
|
|
// entries take their configured type name.
|
|
'type_name' => $this->isFieldChange() ? 'Stammdatenänderung' : $this->entryType?->name,
|
|
'requires_datetime' => $this->entryType?->requires_datetime ?? false,
|
|
// Naive local datetime (no Z/offset) so the user-typed HH:MM
|
|
// round-trips without timezone drift.
|
|
'occurred_at' => $this->occurred_at?->format('Y-m-d\TH:i:s'),
|
|
'body' => $this->body,
|
|
'custom_field_definition_id' => $this->custom_field_definition_id,
|
|
'author_id' => $this->author_id,
|
|
'author_name' => $this->author?->name,
|
|
'updated_by' => $this->updated_by,
|
|
'updated_by_name' => $this->updatedBy?->name,
|
|
'created_at' => $this->created_at->toISOString(),
|
|
'updated_at' => $this->updated_at->toISOString(),
|
|
];
|
|
}
|
|
}
|