Add HL3D branding, Etsy Live/Draft paging and Projects lifecycle
Deploy HickLab3D Dashboard / Deploy to production (push) Failing after 23s
Deploy HickLab3D Dashboard / Deploy to production (push) Failing after 23s
Replace the old touchmark/PNG identity with the supplied lockup and monogram, segmented role-aware navigation, Live/Draft listing filters with generation-based cache invalidation, and admin Projects covering immutable file revisions, listing live pointers, and exact-decimal filament/packaging/shipping costing. Additive schema only; no Etsy publication. Isolated clone tests: 301 tests, 1162 assertions.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\ProjectCostLine;
|
||||
use App\Models\ProjectCostSnapshot;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<ProjectCostLine>
|
||||
*/
|
||||
class ProjectCostLineFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'cost_snapshot_id' => ProjectCostSnapshot::factory(),
|
||||
'category' => ProjectCostLine::CATEGORY_FILAMENT,
|
||||
'description' => 'PLA black',
|
||||
'quantity' => '100.000',
|
||||
'quantity_unit' => 'g',
|
||||
'unit_rate' => '20.000000',
|
||||
'waste_quantity' => '0.000',
|
||||
'line_total' => '2.0000',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Project;
|
||||
use App\Models\ProjectCostSnapshot;
|
||||
use App\Models\ProjectRevision;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<ProjectCostSnapshot>
|
||||
*/
|
||||
class ProjectCostSnapshotFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'project_id' => Project::factory(),
|
||||
'revision_id' => ProjectRevision::factory(),
|
||||
'currency' => 'GBP',
|
||||
'basis' => ProjectCostSnapshot::BASIS_ESTIMATE,
|
||||
'batch_units' => 1,
|
||||
'filament_total' => null,
|
||||
'packaging_total' => null,
|
||||
'shipping_total' => null,
|
||||
'grand_total' => null,
|
||||
'recorded_by' => User::factory()->create(['role' => 'admin'])->id,
|
||||
'recorded_at' => now(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Project;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<Project>
|
||||
*/
|
||||
class ProjectFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'reference' => 'PRJ-'.fake()->unique()->numerify('####'),
|
||||
'title' => fake()->words(3, true),
|
||||
'notes' => null,
|
||||
'stage' => 'design',
|
||||
'currency' => 'GBP',
|
||||
'created_by' => User::factory()->create(['role' => 'admin'])->id,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\ProjectFile;
|
||||
use App\Models\ProjectRevision;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<ProjectFile>
|
||||
*/
|
||||
class ProjectFileFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'revision_id' => ProjectRevision::factory(),
|
||||
'role' => 'body',
|
||||
'original_filename' => 'body.stl',
|
||||
'storage_key' => fake()->unique()->uuid().'.stl',
|
||||
'extension' => 'stl',
|
||||
'media_type' => 'model/stl',
|
||||
'byte_size' => 1024,
|
||||
'sha256' => hash('sha256', fake()->unique()->uuid()),
|
||||
'uploaded_by' => User::factory()->create(['role' => 'admin'])->id,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Project;
|
||||
use App\Models\ProjectListingLink;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<ProjectListingLink>
|
||||
*/
|
||||
class ProjectListingLinkFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'project_id' => Project::factory(),
|
||||
'shop_id' => 42,
|
||||
'listing_id' => fake()->unique()->numberBetween(1000, 999999),
|
||||
'variation_key' => ProjectListingLink::ALL_VARIATIONS,
|
||||
'title_snapshot' => fake()->words(3, true),
|
||||
'state_snapshot' => 'active',
|
||||
'synced_at' => now(),
|
||||
'created_by' => User::factory()->create(['role' => 'admin'])->id,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Project;
|
||||
use App\Models\ProjectRelease;
|
||||
use App\Models\ProjectRevision;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<ProjectRelease>
|
||||
*/
|
||||
class ProjectReleaseFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'project_id' => Project::factory(),
|
||||
'revision_id' => ProjectRevision::factory(),
|
||||
'cost_snapshot_id' => null,
|
||||
'action' => ProjectRelease::ACTION_RELEASE,
|
||||
'released_by' => User::factory()->create(['role' => 'admin'])->id,
|
||||
'released_at' => now(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Project;
|
||||
use App\Models\ProjectRevision;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<ProjectRevision>
|
||||
*/
|
||||
class ProjectRevisionFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'project_id' => Project::factory(),
|
||||
'revision_number' => 1,
|
||||
'change_notes' => 'Initial revision.',
|
||||
'status' => ProjectRevision::STATUS_DRAFT,
|
||||
'created_by' => User::factory()->create(['role' => 'admin'])->id,
|
||||
];
|
||||
}
|
||||
|
||||
public function approved(): static
|
||||
{
|
||||
return $this->state(fn (): array => [
|
||||
'status' => ProjectRevision::STATUS_APPROVED,
|
||||
'approved_by' => User::factory()->create(['role' => 'admin'])->id,
|
||||
'approved_at' => now(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('projects', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('reference')->unique();
|
||||
$table->string('title');
|
||||
$table->text('notes')->nullable();
|
||||
$table->string('stage')->default('design');
|
||||
$table->string('currency', 3)->default('GBP');
|
||||
$table->foreignId('created_by')->constrained('users')->restrictOnDelete();
|
||||
$table->timestamp('archived_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('projects');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('project_revisions', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('project_id')->constrained('projects')->cascadeOnDelete();
|
||||
$table->unsignedInteger('revision_number');
|
||||
$table->text('change_notes')->nullable();
|
||||
$table->string('status')->default('draft');
|
||||
$table->foreignId('created_by')->constrained('users')->restrictOnDelete();
|
||||
$table->foreignId('approved_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamp('approved_at')->nullable();
|
||||
$table->string('fusion_project_id')->nullable();
|
||||
$table->string('fusion_document_id')->nullable();
|
||||
$table->string('fusion_version')->nullable();
|
||||
$table->timestamps();
|
||||
$table->unique(['project_id', 'revision_number']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('project_revisions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('project_files', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('revision_id')->constrained('project_revisions')->cascadeOnDelete();
|
||||
$table->string('role');
|
||||
$table->string('original_filename');
|
||||
$table->string('storage_key')->unique();
|
||||
$table->string('extension', 16);
|
||||
$table->string('media_type');
|
||||
$table->unsignedBigInteger('byte_size');
|
||||
$table->string('sha256', 64);
|
||||
$table->foreignId('uploaded_by')->constrained('users')->restrictOnDelete();
|
||||
$table->string('printer_profile')->nullable();
|
||||
$table->string('material')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('project_files');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('project_cost_snapshots', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('project_id')->constrained('projects')->cascadeOnDelete();
|
||||
$table->foreignId('revision_id')->constrained('project_revisions')->cascadeOnDelete();
|
||||
$table->string('currency', 3);
|
||||
$table->string('basis');
|
||||
$table->unsignedInteger('batch_units');
|
||||
$table->decimal('filament_total', 14, 4)->nullable();
|
||||
$table->decimal('packaging_total', 14, 4)->nullable();
|
||||
$table->decimal('shipping_total', 14, 4)->nullable();
|
||||
$table->decimal('grand_total', 14, 4)->nullable();
|
||||
$table->string('source_reference')->nullable();
|
||||
$table->text('notes')->nullable();
|
||||
$table->foreignId('recorded_by')->constrained('users')->restrictOnDelete();
|
||||
$table->timestamp('recorded_at');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('project_cost_snapshots');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('project_cost_lines', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('cost_snapshot_id')->constrained('project_cost_snapshots')->cascadeOnDelete();
|
||||
$table->string('category');
|
||||
$table->string('description');
|
||||
$table->decimal('quantity', 12, 3);
|
||||
$table->string('quantity_unit', 16);
|
||||
$table->decimal('unit_rate', 14, 6);
|
||||
$table->decimal('waste_quantity', 12, 3)->default(0);
|
||||
$table->decimal('line_total', 14, 4);
|
||||
$table->date('source_price_date')->nullable();
|
||||
$table->string('source_reference')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('project_cost_lines');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('project_releases', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('project_id')->constrained('projects')->cascadeOnDelete();
|
||||
$table->foreignId('revision_id')->constrained('project_revisions')->restrictOnDelete();
|
||||
$table->foreignId('cost_snapshot_id')->nullable()->constrained('project_cost_snapshots')->restrictOnDelete();
|
||||
$table->string('action')->default('release');
|
||||
$table->foreignId('released_by')->constrained('users')->restrictOnDelete();
|
||||
$table->timestamp('released_at');
|
||||
$table->text('notes')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('project_releases');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('project_listing_links', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('project_id')->constrained('projects')->cascadeOnDelete();
|
||||
$table->unsignedBigInteger('shop_id');
|
||||
$table->unsignedBigInteger('listing_id');
|
||||
$table->string('variation_key')->default('all');
|
||||
$table->string('title_snapshot')->nullable();
|
||||
$table->string('state_snapshot')->nullable();
|
||||
$table->timestamp('remote_updated_at')->nullable();
|
||||
$table->timestamp('synced_at')->nullable();
|
||||
$table->foreignId('live_release_id')->nullable()->constrained('project_releases')->nullOnDelete();
|
||||
$table->unsignedInteger('lock_version')->default(0);
|
||||
$table->foreignId('created_by')->constrained('users')->restrictOnDelete();
|
||||
$table->timestamp('detached_at')->nullable();
|
||||
$table->timestamps();
|
||||
$table->unique(['shop_id', 'listing_id', 'variation_key']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('project_listing_links');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('project_events', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('project_id')->constrained('projects')->cascadeOnDelete();
|
||||
$table->string('event_type');
|
||||
$table->foreignId('actor_id')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->string('subject_type')->nullable();
|
||||
$table->unsignedBigInteger('subject_id')->nullable();
|
||||
$table->json('metadata')->nullable();
|
||||
$table->timestamp('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('project_events');
|
||||
}
|
||||
};
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('project_cost_lines', function (Blueprint $table): void {
|
||||
$table->unsignedInteger('units_per_parcel')->nullable()->after('quantity_unit');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('project_cost_lines', function (Blueprint $table): void {
|
||||
$table->dropColumn('units_per_parcel');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user