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:
43
app/Http/Requests/DropOff/UpdateDropOffPointRequest.php
Normal file
43
app/Http/Requests/DropOff/UpdateDropOffPointRequest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\DropOff;
|
||||
|
||||
use App\Models\DropOffPoint;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateDropOffPointRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
$id = $this->route('drop_off_point')?->id;
|
||||
|
||||
return [
|
||||
'name' => ['sometimes', 'required', 'string', 'max:191'],
|
||||
'code' => [
|
||||
'sometimes', 'required', 'string', 'max:32',
|
||||
Rule::unique('drop_off_points', 'code')->whereNull('deleted_at')->ignore($id),
|
||||
],
|
||||
'barangay_id' => ['sometimes', 'nullable', 'integer', 'exists:barangays,id'],
|
||||
'lat' => ['sometimes', 'required_with:lng', 'numeric', 'between:-90,90'],
|
||||
'lng' => ['sometimes', 'required_with:lat', 'numeric', 'between:-180,180'],
|
||||
'address_line' => ['sometimes', 'required', 'string', 'max:255'],
|
||||
'capacity_kg' => ['sometimes', 'nullable', 'integer', 'min:0'],
|
||||
'operating_hours' => ['sometimes', 'nullable', 'array'],
|
||||
'accepted_waste_types' => ['sometimes', 'nullable', 'array'],
|
||||
'status' => ['sometimes', Rule::in([
|
||||
DropOffPoint::STATUS_ACTIVE,
|
||||
DropOffPoint::STATUS_MAINTENANCE,
|
||||
DropOffPoint::STATUS_CLOSED,
|
||||
])],
|
||||
'photo_path' => ['sometimes', 'nullable', 'string', 'max:255'],
|
||||
'contact_person' => ['sometimes', 'nullable', 'string', 'max:191'],
|
||||
'contact_phone' => ['sometimes', 'nullable', 'string', 'max:32'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user