Audit and complete the Crowd Lists module: - Add CrowdListType enum (internal/external) with proper casts - Create CrowdListService for business logic (add/remove person, max_persons enforcement, auto_approve, activity logging) - Create CrowdListFactory with Dutch names and states - Create AddPersonToCrowdListRequest form request - Fix FormRequests to use Rule::enum instead of hardcoded strings - Fix CrowdListResource to use enum->value and add is_full field - Refactor controller to be thin (delegates to service) - Add eager loading for crowdType and recipientCompany - Write 18 comprehensive tests (CRUD, auth, edge cases) - Update API.md with request/response documentation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
31 lines
832 B
PHP
31 lines
832 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Requests\Api\V1;
|
|
|
|
use App\Enums\CrowdListType;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
final class UpdateCrowdListRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/** @return array<string, mixed> */
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'crowd_type_id' => ['sometimes', 'ulid', 'exists:crowd_types,id'],
|
|
'name' => ['sometimes', 'string', 'max:255'],
|
|
'type' => ['sometimes', Rule::enum(CrowdListType::class)],
|
|
'recipient_company_id' => ['nullable', 'ulid', 'exists:companies,id'],
|
|
'auto_approve' => ['sometimes', 'boolean'],
|
|
'max_persons' => ['nullable', 'integer', 'min:1'],
|
|
];
|
|
}
|
|
}
|