Foundational layer for the YouTube Content Creation System project, built as a fully independent domain per the earlier decision (task #47) — no foreign keys into the existing projects/tasks/ideas tables. Schema: video_projects, workflow_steps, assets, ai_providers, workflow_templates (named to avoid colliding with the existing Post-templates `templates` table). WorkflowEngine (app/Support/VideoWorkflow/) drives a project's step sequence: start/startFromTemplate, currentStep, completeStep (with optional approval gating), approveStep/rejectStep, failStep/retryStep, skipStep. It only manages state transitions — actual step execution (AI calls, rendering, etc.) is out of scope here (tasks #33+). Also fixes four Publisher classes (WordPress/Reddit/Twitter/LinkedIn) that were missing a `use App\Models\SocialAccount;` import after an earlier interface change, which broke the entire test suite at bootstrap; and PostFactory, which still set the now-removed `social_account_id` column instead of the SocialAccount pivot. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AiProvider extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public const PROVIDERS = ['openai', 'stability_ai', 'elevenlabs', 'other'];
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'provider',
|
||||
'api_key',
|
||||
'config',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'config' => 'array',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Asset extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public const TYPES = ['script', 'image', 'video', 'audio', 'other'];
|
||||
|
||||
protected $fillable = [
|
||||
'video_project_id',
|
||||
'workflow_step_id',
|
||||
'type',
|
||||
'disk_path',
|
||||
'mime_type',
|
||||
'size_bytes',
|
||||
'version',
|
||||
'metadata',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'metadata' => 'array',
|
||||
];
|
||||
|
||||
public function videoProject(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(VideoProject::class);
|
||||
}
|
||||
|
||||
public function workflowStep(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(WorkflowStep::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class VideoProject extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
public const STATUSES = ['draft', 'in_progress', 'completed', 'archived'];
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'description',
|
||||
'status',
|
||||
'workflow_template_id',
|
||||
];
|
||||
|
||||
public function workflowTemplate(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(WorkflowTemplate::class);
|
||||
}
|
||||
|
||||
public function steps(): HasMany
|
||||
{
|
||||
return $this->hasMany(WorkflowStep::class)->orderBy('order');
|
||||
}
|
||||
|
||||
public function assets(): HasMany
|
||||
{
|
||||
return $this->hasMany(Asset::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class WorkflowStep extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
// Mirrors the content-generation modules in the YouTube Content
|
||||
// Creation System project (script through publish).
|
||||
public const TYPES = [
|
||||
'script_generation',
|
||||
'tts_voiceover',
|
||||
'storyboard',
|
||||
'video_generation',
|
||||
'video_editing',
|
||||
'thumbnail_generation',
|
||||
'metadata_generation',
|
||||
'youtube_publish',
|
||||
];
|
||||
|
||||
public const STATUSES = [
|
||||
'pending', 'in_progress', 'awaiting_approval',
|
||||
'completed', 'rejected', 'failed', 'skipped',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'video_project_id',
|
||||
'type',
|
||||
'order',
|
||||
'status',
|
||||
'requires_approval',
|
||||
'input',
|
||||
'output',
|
||||
'error',
|
||||
'started_at',
|
||||
'completed_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'requires_approval' => 'boolean',
|
||||
'input' => 'array',
|
||||
'output' => 'array',
|
||||
'started_at' => 'datetime',
|
||||
'completed_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function videoProject(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(VideoProject::class);
|
||||
}
|
||||
|
||||
public function assets(): HasMany
|
||||
{
|
||||
return $this->hasMany(Asset::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class WorkflowTemplate extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'description',
|
||||
'steps',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'steps' => 'array',
|
||||
];
|
||||
|
||||
public function videoProjects(): HasMany
|
||||
{
|
||||
return $this->hasMany(VideoProject::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user