Protect recordings per user, seed a demo login on container start, and bind-mount the app with Vite HMR for local Compose development.
42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Recording;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class TranscribePendingController extends Controller
|
|
{
|
|
/**
|
|
* Queue local transcription for recordings that still need a transcript.
|
|
*/
|
|
public function __invoke(Request $request): RedirectResponse
|
|
{
|
|
$queued = 0;
|
|
|
|
$request->user()->recordings()
|
|
->whereIn('transcription_status', ['pending', 'failed', 'cancelled'])
|
|
->orderBy('id')
|
|
->each(function (Recording $recording) use (&$queued): void {
|
|
if ($recording->hasActiveTranscriptionJob()) {
|
|
return;
|
|
}
|
|
|
|
$recording->queueLocalTranscription();
|
|
$queued++;
|
|
});
|
|
|
|
if ($queued === 0) {
|
|
return back()->with('error', 'No recordings need transcription right now.');
|
|
}
|
|
|
|
return back()->with(
|
|
'success',
|
|
$queued === 1
|
|
? 'Queued 1 recording for transcription.'
|
|
: "Queued {$queued} recordings for transcription.",
|
|
);
|
|
}
|
|
}
|