feat(backend): complete Module 5 (drop-off points + auto-assign)

drop_off_points (with SPATIAL INDEX on coordinates) +
drop_off_capacity_logs. Public nearby query via ST_Distance_Sphere
returns DOPs sorted by distance with distance_meters in payload.
Admin CRUD plus capacity-log endpoint. Household creation auto-assigns
to the nearest active DOP within 25km; resident can re-run the lookup
via POST /households/{uuid}/reassign-drop-off.

97 feature tests passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-30 00:11:22 +08:00
parent 4eb2d14e52
commit 1150a518e8
23 changed files with 1040 additions and 9 deletions

View File

@@ -0,0 +1,22 @@
<?php
namespace App\Http\Requests\DropOff;
use Illuminate\Foundation\Http\FormRequest;
class StoreCapacityLogRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'fill_percent' => ['required', 'integer', 'min:0', 'max:100'],
'recorded_at' => ['nullable', 'date'],
'notes' => ['nullable', 'string', 'max:500'],
];
}
}