Add project listing selector, confirmed revision and private 3MF renders

This commit is contained in:
2026-11-08 18:49:32 +00:00
parent e62b6800a6
commit 4e675510fd
29 changed files with 3394 additions and 14 deletions
+9 -1
View File
@@ -16,7 +16,10 @@ class Project extends Model
/** @var list<string> */
public const STAGES = ['design', 'ready', 'live', 'retired'];
protected $fillable = ['reference', 'title', 'notes', 'stage', 'currency', 'created_by', 'archived_at'];
protected $fillable = [
'reference', 'title', 'notes', 'stage', 'currency', 'created_by', 'archived_at',
'current_revision_id', 'lock_version',
];
protected function casts(): array
{
@@ -30,6 +33,11 @@ class Project extends Model
return $this->belongsTo(User::class, 'created_by');
}
public function currentRevision(): BelongsTo
{
return $this->belongsTo(ProjectRevision::class, 'current_revision_id');
}
public function revisions(): HasMany
{
return $this->hasMany(ProjectRevision::class);
+6
View File
@@ -6,6 +6,7 @@ use Database\Factories\ProjectFileFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
class ProjectFile extends Model
{
@@ -29,4 +30,9 @@ class ProjectFile extends Model
{
return $this->belongsTo(User::class, 'uploaded_by');
}
public function render(): HasOne
{
return $this->hasOne(ProjectFileRender::class);
}
}
+41
View File
@@ -0,0 +1,41 @@
<?php
namespace App\Models;
use Database\Factories\ProjectFileRenderFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ProjectFileRender extends Model
{
/** @use HasFactory<ProjectFileRenderFactory> */
use HasFactory;
public const RENDERER_GD = 'gd';
public const RENDERER_SVG = 'svg';
protected $fillable = [
'project_file_id', 'renderer', 'mime_type', 'storage_key', 'width', 'height',
'triangle_count', 'instance_count', 'alt_text', 'byte_size', 'sha256',
'generated_by', 'generated_at',
];
protected function casts(): array
{
return [
'generated_at' => 'datetime',
];
}
public function projectFile(): BelongsTo
{
return $this->belongsTo(ProjectFile::class);
}
public function generator(): BelongsTo
{
return $this->belongsTo(User::class, 'generated_by');
}
}