54 lines
1.7 KiB
PHP
54 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\TranscriptionProject;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
/** @extends Factory<TranscriptionProject> */
|
|
class TranscriptionProjectFactory extends Factory
|
|
{
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'uuid' => (string) Str::uuid(),
|
|
'title' => fake()->sentence(4),
|
|
'description' => fake()->optional()->sentence(),
|
|
'owner_user_id' => User::factory(),
|
|
'original_filename' => fake()->word() . '.mp3',
|
|
'stored_audio_path' => 'transcriptions/' . Str::uuid() . '/audio/' . Str::random(20) . '.mp3',
|
|
'mime_type' => 'audio/mpeg',
|
|
'file_size' => fake()->numberBetween(100000, 50000000),
|
|
'duration_seconds' => fake()->optional()->numberBetween(60, 3600),
|
|
'language' => 'ms',
|
|
'transcription_status' => 'pending',
|
|
'transcription_engine' => 'faster-whisper',
|
|
'transcript_text' => null,
|
|
];
|
|
}
|
|
|
|
public function completed(): static
|
|
{
|
|
return $this->state(fn () => [
|
|
'transcription_status' => 'completed',
|
|
'transcript_text' => fake()->paragraphs(3, true),
|
|
'processed_at' => now(),
|
|
]);
|
|
}
|
|
|
|
public function failed(): static
|
|
{
|
|
return $this->state(fn () => [
|
|
'transcription_status' => 'failed',
|
|
'error_message' => 'Connection refused',
|
|
]);
|
|
}
|
|
|
|
public function processing(): static
|
|
{
|
|
return $this->state(fn () => ['transcription_status' => 'processing']);
|
|
}
|
|
}
|