Gestalte den Mitgliederbereich fuer den Kursraum
Deploy Test / test (push) Successful in 17s
Deploy Test / deploy (push) Successful in 23s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-16 08:43:13 +01:00
1 parent abcdc6908e
commit 1d8315c9a4
21 files changed
+1064 -169

No files matched your search

+46 -6
View File
@@ -7,9 +7,12 @@
use App\Domain\Catalog\CompositionDisplayRelease;
use App\Domain\Catalog\ContentService;
use App\Domain\Catalog\EditorialContentKind;
use App\Domain\Catalog\Offer;
use App\Domain\Catalog\OfferService;
use App\Domain\Entitlement\GrantIssuer;
use App\Models\User;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Hash;
class SeedLibraryReview extends Command
{
@@ -25,12 +28,31 @@ public function handle(
): int {
$existing = Composition::query()->where('designation', 'Prüfprogramm Abstand')->first();
if ($existing !== null) {
$this->info('Prüfbestand ist bereits vorhanden.');
if ($existing === null) {
$created = $this->createFixture($content, $articles, $offers, $display);
return self::SUCCESS;
if ($created !== self::SUCCESS) {
return $created;
}
} else {
$existing->display_title = 'Prüfprogramm Abstand und ein bewusst langer Titel für die Kursraumansicht';
$existing->summary = 'Gekennzeichneter Prüfbestand für die Testinstanz. Der Titel ist lang, damit die Karte im Kursraum prüfbar bleibt.';
$existing->save();
}
$this->ensureTrainer();
$this->info('Prüfbestand und Trainingskonto sind bereit.');
return self::SUCCESS;
}
private function createFixture(
ContentService $content,
ArticleService $articles,
OfferService $offers,
CompositionDisplayRelease $display,
): int {
$actor = User::query()->find($this->option('actor')) ?? User::query()->orderBy('id')->first();
if ($actor === null) {
@@ -53,8 +75,8 @@ public function handle(
);
$composition = $content->createComposition('Prüfprogramm Abstand');
$composition->editorial_content_kind_id = $kind->id;
$composition->display_title = 'Prüfprogramm Abstand';
$composition->summary = 'Gekennzeichneter Prüfbestand für die Testinstanz.';
$composition->display_title = 'Prüfprogramm Abstand und ein bewusst langer Titel für die Kursraumansicht';
$composition->summary = 'Gekennzeichneter Prüfbestand für die Testinstanz. Der Titel ist lang, damit die Karte im Kursraum prüfbar bleibt.';
$composition->thumbnail_error = 'Prüfhinweis: kein Vorschaubild.';
$composition->save();
$version = $content->publishComposition($composition, [
@@ -74,8 +96,26 @@ public function handle(
['target' => $article->fresh(), 'rights' => $rights],
], ['grant_kind' => 'auf_abruf', 'composition_version_id' => $version->id]);
$display->release($version, $actor, 'Prüffreigabe');
$this->info('Prüfbestand angelegt. Angebot: Prüfprogramm Abstand.');
return self::SUCCESS;
}
private function ensureTrainer(): void
{
$trainer = User::query()->where('email', 'trainer-pruefung@example.test')->first();
if ($trainer === null) {
$trainer = User::factory()->create([
'name' => 'Trainer Prüfung',
'email' => 'trainer-pruefung@example.test',
'password' => Hash::make('Kursraum-Pruefung'),
]);
}
$offer = Offer::query()->where('name', 'Prüfprogramm Abstand')->first();
if ($offer !== null) {
app(GrantIssuer::class)->claim($trainer, $offer);
}
}
}