Save workspace changes

This commit is contained in:
2026-04-18 17:02:56 +02:00
parent f02ea9a711
commit 87d60af5a9
4220 changed files with 1388603 additions and 1554 deletions

View File

@@ -0,0 +1,32 @@
<?php
namespace Database\Factories;
use App\Models\Artwork;
use App\Models\ArtworkComment;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class ArtworkCommentFactory extends Factory
{
protected $model = ArtworkComment::class;
public function definition(): array
{
$raw = $this->faker->sentence(12);
return [
'artwork_id' => Artwork::factory(),
'user_id' => User::factory(),
'content' => $raw,
'raw_content' => $raw,
'rendered_content' => '<p>' . e($raw) . '</p>',
'is_approved' => true,
];
}
public function unapproved(): static
{
return $this->state(['is_approved' => false]);
}
}

View File

@@ -0,0 +1,51 @@
<?php
namespace Database\Factories;
use App\Models\Artwork;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class ArtworkFactory extends Factory
{
protected $model = Artwork::class;
public function definition(): array
{
$title = $this->faker->unique()->sentence(3);
$slug = Str::slug($title);
return [
'user_id' => User::factory(),
'title' => $title,
'slug' => $slug !== '' ? $slug : 'artwork',
'description' => $this->faker->paragraph(),
'file_name' => 'image.jpg',
'file_path' => 'uploads/artworks/image.jpg',
'file_size' => 12345,
'mime_type' => 'image/jpeg',
'width' => 800,
'height' => 600,
'is_public' => true,
'visibility' => Artwork::VISIBILITY_PUBLIC,
'is_approved' => true,
'is_mature' => false,
'published_at' => now()->subDay(),
];
}
public function unpublished(): self
{
return $this->state(fn () => ['published_at' => null]);
}
public function private(): self
{
return $this->state(fn () => ['is_public' => false, 'visibility' => Artwork::VISIBILITY_PRIVATE]);
}
public function unapproved(): self
{
return $this->state(fn () => ['is_approved' => false]);
}
}

View File

@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\BlogPost;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends Factory<BlogPost>
*/
final class BlogPostFactory extends Factory
{
protected $model = BlogPost::class;
public function definition(): array
{
$title = $this->faker->sentence(5);
return [
'slug' => Str::slug($title) . '-' . $this->faker->unique()->numberBetween(1, 99999),
'title' => $title,
'body' => '<p>' . implode('</p><p>', $this->faker->paragraphs(3)) . '</p>',
'excerpt' => $this->faker->sentence(15),
'author_id' => null,
'featured_image' => null,
'meta_title' => null,
'meta_description' => null,
'is_published' => true,
'published_at' => $this->faker->dateTimeBetween('-1 year', 'now'),
];
}
public function draft(): static
{
return $this->state(['is_published' => false, 'published_at' => null]);
}
}

View File

@@ -0,0 +1,105 @@
<?php
namespace Database\Factories;
use App\Models\Collection;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class CollectionFactory extends Factory
{
protected $model = Collection::class;
public function definition(): array
{
$title = $this->faker->unique()->sentence(3);
return [
'user_id' => User::factory(),
'managed_by_user_id' => null,
'title' => $title,
'slug' => Str::slug($title),
'lifecycle_state' => Collection::LIFECYCLE_PUBLISHED,
'workflow_state' => Collection::WORKFLOW_APPROVED,
'readiness_state' => Collection::READINESS_READY,
'health_state' => Collection::HEALTH_HEALTHY,
'health_flags_json' => [],
'canonical_collection_id' => null,
'duplicate_cluster_key' => null,
'program_key' => null,
'partner_key' => null,
'trust_tier' => 'standard',
'experiment_key' => null,
'recommendation_tier' => 'secondary',
'ranking_bucket' => 'steady',
'search_boost_tier' => 'standard',
'type' => Collection::TYPE_PERSONAL,
'editorial_owner_mode' => Collection::EDITORIAL_OWNER_CREATOR,
'editorial_owner_user_id' => null,
'editorial_owner_label' => null,
'description' => $this->faker->paragraph(),
'subtitle' => null,
'summary' => null,
'collaboration_mode' => Collection::COLLABORATION_CLOSED,
'allow_submissions' => false,
'allow_comments' => true,
'allow_saves' => true,
'moderation_status' => Collection::MODERATION_ACTIVE,
'visibility' => Collection::VISIBILITY_PUBLIC,
'mode' => Collection::MODE_MANUAL,
'sort_mode' => Collection::SORT_MANUAL,
'artworks_count' => 0,
'comments_count' => 0,
'is_featured' => false,
'profile_order' => null,
'views_count' => 0,
'likes_count' => 0,
'followers_count' => 0,
'shares_count' => 0,
'saves_count' => 0,
'collaborators_count' => 1,
'smart_rules_json' => null,
'layout_modules_json' => null,
'last_activity_at' => null,
'featured_at' => null,
'published_at' => null,
'unpublished_at' => null,
'event_key' => null,
'event_label' => null,
'season_key' => null,
'banner_text' => null,
'badge_label' => null,
'spotlight_style' => Collection::SPOTLIGHT_STYLE_DEFAULT,
'quality_score' => 52.5,
'ranking_score' => 61.0,
'metadata_completeness_score' => 72.0,
'editorial_readiness_score' => 68.0,
'freshness_score' => 64.0,
'engagement_score' => 28.0,
'health_score' => 66.0,
'last_health_check_at' => now(),
'last_recommendation_refresh_at' => now(),
'placement_eligibility' => true,
'analytics_enabled' => true,
'presentation_style' => Collection::PRESENTATION_STANDARD,
'emphasis_mode' => Collection::EMPHASIS_BALANCED,
'theme_token' => null,
'series_key' => null,
'series_title' => null,
'series_description' => null,
'series_order' => null,
'campaign_key' => null,
'campaign_label' => null,
'commercial_eligibility' => false,
'promotion_tier' => null,
'sponsorship_label' => null,
'partner_label' => null,
'monetization_ready_status' => null,
'brand_safe_status' => null,
'archived_at' => null,
'expired_at' => null,
'history_count' => 0,
];
}
}

View File

@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\Country;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Country>
*/
class CountryFactory extends Factory
{
protected $model = Country::class;
public function definition(): array
{
$iso2 = fake()->unique()->lexify('??');
$iso3 = fake()->unique()->lexify('???');
return [
'iso2' => strtoupper($iso2),
'iso3' => strtoupper($iso3),
'numeric_code' => str_pad((string) fake()->numberBetween(1, 999), 3, '0', STR_PAD_LEFT),
'name_common' => fake()->unique()->country(),
'name_official' => fake()->company().' Republic',
'region' => fake()->randomElement(['Europe', 'Americas', 'Africa', 'Asia', 'Oceania']),
'subregion' => fake()->randomElement(['Central Europe', 'North America', 'Western Africa', 'Eastern Asia']),
'flag_svg_url' => 'https://example.test/flags/'.strtolower($iso2).'.svg',
'flag_png_url' => 'https://example.test/flags/'.strtolower($iso2).'.png',
'flag_emoji' => null,
'active' => true,
'sort_order' => 1000,
'is_featured' => false,
];
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace Database\Factories;
use App\Models\Group;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class GroupFactory extends Factory
{
protected $model = Group::class;
public function definition(): array
{
$name = $this->faker->unique()->company();
return [
'owner_user_id' => User::factory(),
'name' => $name,
'slug' => Str::slug($name),
'headline' => $this->faker->sentence(6),
'bio' => $this->faker->paragraph(),
'visibility' => Group::VISIBILITY_PUBLIC,
'status' => Group::LIFECYCLE_ACTIVE,
'membership_policy' => Group::MEMBERSHIP_INVITE_ONLY,
'website_url' => $this->faker->optional()->url(),
'links_json' => [],
'avatar_path' => null,
'banner_path' => null,
'artworks_count' => 0,
'collections_count' => 0,
'followers_count' => 0,
'last_activity_at' => now(),
];
}
public function private(): self
{
return $this->state(fn (): array => [
'visibility' => Group::VISIBILITY_PRIVATE,
]);
}
}

View File

@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\Page;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends Factory<Page>
*/
final class PageFactory extends Factory
{
protected $model = Page::class;
public function definition(): array
{
$title = $this->faker->sentence(4);
return [
'slug' => Str::slug($title) . '-' . $this->faker->unique()->numberBetween(1, 99999),
'title' => $title,
'body' => '<p>' . implode('</p><p>', $this->faker->paragraphs(2)) . '</p>',
'layout' => 'default',
'meta_title' => null,
'meta_description' => null,
'is_published' => true,
'published_at' => $this->faker->dateTimeBetween('-1 year', 'now'),
];
}
public function draft(): static
{
return $this->state(['is_published' => false, 'published_at' => null]);
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace Database\Factories;
use App\Models\Post;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Post>
*/
class PostFactory extends Factory
{
protected $model = Post::class;
public function definition(): array
{
return [
'user_id' => User::factory(),
'type' => Post::TYPE_TEXT,
'visibility' => Post::VISIBILITY_PUBLIC,
'status' => Post::STATUS_PUBLISHED,
'body' => fake()->paragraph(),
'meta' => null,
'reactions_count' => 0,
'comments_count' => 0,
];
}
public function artworkShare(): static
{
return $this->state(['type' => Post::TYPE_ARTWORK_SHARE]);
}
public function followersOnly(): static
{
return $this->state(['visibility' => Post::VISIBILITY_FOLLOWERS]);
}
public function private(): static
{
return $this->state(['visibility' => Post::VISIBILITY_PRIVATE]);
}
}

View File

@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\Tag;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends Factory<Tag>
*/
final class TagFactory extends Factory
{
protected $model = Tag::class;
public function definition(): array
{
$name = $this->faker->unique()->words(mt_rand(1, 2), true);
return [
'name' => $name,
'slug' => Str::slug($name),
'usage_count' => $this->faker->numberBetween(0, 500),
'is_active' => true,
];
}
public function inactive(): static
{
return $this->state(['is_active' => false]);
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$username = Str::lower(Str::slug(fake()->unique()->userName(), '-'));
$username = preg_replace('/[^a-z0-9_-]/', '-', $username) ?: 'user';
$username = substr(trim($username, '-_'), 0, 20);
if ($username === '') {
$username = 'user' . fake()->unique()->numberBetween(100, 99999);
}
return [
'username' => $username,
'username_changed_at' => now()->subDays(120),
'onboarding_step' => 'complete',
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}