Instagram carousels were stored as content_type=instagram_carousel, which the publisher's match() did not handle — publishing failed with "Unsupported Instagram content type: instagram_carousel" for any post created via API, MCP, or template (the AI flow worked only thanks to an inline band-aid that rewrote carousel to feed before saving). A carousel is just an Instagram feed post with multiple images: the editor, preview, and publisher already treat a multi-image feed as a carousel. So instagram_carousel is a generation format, not a stored content type. Remove it from the ContentType enum entirely; it now lives only as an AI generation-format string (wizard card + slide structure + carousel templates are untouched), and posts always persist as instagram_feed. - ContentType: drop the InstagramCarousel case; InstagramFeed maxMediaCount 1 -> 10 - StreamPostCreation: resolvedContentType() maps carousel -> feed; band-aid removed - StartPostCreationRequest: accept instagram_carousel as a generation format - Frontend: carousel becomes a wizard-local AiFormat; UI/UX unchanged - API/MCP now reject instagram_carousel as a content_type (Rule::in no longer lists it)
38 lines
984 B
PHP
38 lines
984 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Requests\App\Ai;
|
|
|
|
use App\Enums\PostPlatform\ContentType;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class StartPostCreationRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
$allowedFormats = array_map(fn (ContentType $t) => $t->value, ContentType::aiSupported());
|
|
$allowedFormats[] = ContentType::CAROUSEL_FORMAT;
|
|
|
|
return [
|
|
'format' => [
|
|
'required',
|
|
'string',
|
|
Rule::in($allowedFormats),
|
|
],
|
|
'social_account_id' => ['nullable', 'uuid'],
|
|
'image_count' => ['nullable', 'integer', 'min:0', 'max:10'],
|
|
'prompt' => ['required', 'string', 'max:2000'],
|
|
'date' => ['nullable', 'date_format:Y-m-d'],
|
|
];
|
|
}
|
|
}
|