chore: cleanup dead code + format with Pint
- Remove unused FeaturesController (empty stubs, no routes) - Remove ConvertSpatialFile CLI command (unused; service used in LayerManager) - Remove MigrateGeojsonToFeatures CLI command (one-shot migration, not referenced) - Remove .claude/worktrees/ (11 old agent worktrees from June) - Apply Laravel Pint formatting across 219 files (style only, no functional changes) Tests: 101 passing (319 assertions) API routes: unchanged (8 routes intact)
This commit is contained in:
+74
-33
@@ -2,17 +2,19 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\LogsActivity;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Traits\LogsActivity;
|
||||
|
||||
class Issue extends Model
|
||||
{
|
||||
use SoftDeletes, LogsActivity;
|
||||
use LogsActivity, SoftDeletes;
|
||||
|
||||
const STATUSES = ['open', 'in_review', 'resolved', 'closed'];
|
||||
|
||||
const STATUSES = ['open', 'in_review', 'resolved', 'closed'];
|
||||
const PRIORITIES = ['low', 'medium', 'high', 'critical'];
|
||||
const TYPES = ['defect', 'safety', 'quality', 'documentation', 'other'];
|
||||
|
||||
const TYPES = ['defect', 'safety', 'quality', 'documentation', 'other'];
|
||||
|
||||
protected $fillable = [
|
||||
'project_id', 'feature_id', 'inspection_id',
|
||||
@@ -23,17 +25,55 @@ class Issue extends Model
|
||||
|
||||
protected $casts = ['resolved_at' => 'datetime'];
|
||||
|
||||
public function project() { return $this->belongsTo(Project::class); }
|
||||
public function feature() { return $this->belongsTo(Feature::class); }
|
||||
public function inspection() { return $this->belongsTo(Inspection::class); }
|
||||
public function reporter() { return $this->belongsTo(User::class, 'reported_by'); }
|
||||
public function assignee() { return $this->belongsTo(User::class, 'assigned_to'); }
|
||||
public function media() { return $this->morphMany(Media::class, 'mediable'); }
|
||||
public function tasks() { return $this->hasMany(IssueTask::class)->orderBy('order')->orderBy('id'); }
|
||||
public function comments() { return $this->hasMany(IssueComment::class)->orderBy('created_at'); }
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo(Project::class);
|
||||
}
|
||||
|
||||
public function scopeOpen($q) { return $q->where('status', 'open'); }
|
||||
public function scopeCritical($q) { return $q->where('priority', 'critical'); }
|
||||
public function feature()
|
||||
{
|
||||
return $this->belongsTo(Feature::class);
|
||||
}
|
||||
|
||||
public function inspection()
|
||||
{
|
||||
return $this->belongsTo(Inspection::class);
|
||||
}
|
||||
|
||||
public function reporter()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'reported_by');
|
||||
}
|
||||
|
||||
public function assignee()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'assigned_to');
|
||||
}
|
||||
|
||||
public function media()
|
||||
{
|
||||
return $this->morphMany(Media::class, 'mediable');
|
||||
}
|
||||
|
||||
public function tasks()
|
||||
{
|
||||
return $this->hasMany(IssueTask::class)->orderBy('order')->orderBy('id');
|
||||
}
|
||||
|
||||
public function comments()
|
||||
{
|
||||
return $this->hasMany(IssueComment::class)->orderBy('created_at');
|
||||
}
|
||||
|
||||
public function scopeOpen($q)
|
||||
{
|
||||
return $q->where('status', 'open');
|
||||
}
|
||||
|
||||
public function scopeCritical($q)
|
||||
{
|
||||
return $q->where('priority', 'critical');
|
||||
}
|
||||
|
||||
/** Resolution progress derived from the checklist: done tasks / total. */
|
||||
public function getProgressAttribute(): int
|
||||
@@ -42,6 +82,7 @@ class Issue extends Model
|
||||
if ($total === 0) {
|
||||
return in_array($this->status, ['resolved', 'closed'], true) ? 100 : 0;
|
||||
}
|
||||
|
||||
return (int) round($this->tasks->where('is_done', true)->count() / $total * 100);
|
||||
}
|
||||
|
||||
@@ -53,23 +94,23 @@ class Issue extends Model
|
||||
|
||||
public function getPriorityColorAttribute(): string
|
||||
{
|
||||
return match($this->priority) {
|
||||
'low' => '#6b7280',
|
||||
'medium' => '#f59e0b',
|
||||
'high' => '#ef4444',
|
||||
return match ($this->priority) {
|
||||
'low' => '#6b7280',
|
||||
'medium' => '#f59e0b',
|
||||
'high' => '#ef4444',
|
||||
'critical' => '#7c3aed',
|
||||
default => '#6b7280',
|
||||
default => '#6b7280',
|
||||
};
|
||||
}
|
||||
|
||||
public function getStatusColorAttribute(): string
|
||||
{
|
||||
return match($this->status) {
|
||||
'open' => '#ef4444',
|
||||
return match ($this->status) {
|
||||
'open' => '#ef4444',
|
||||
'in_review' => '#f59e0b',
|
||||
'resolved' => '#10b981',
|
||||
'closed' => '#6b7280',
|
||||
default => '#6b7280',
|
||||
'resolved' => '#10b981',
|
||||
'closed' => '#6b7280',
|
||||
default => '#6b7280',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -77,11 +118,11 @@ class Issue extends Model
|
||||
public static function typeLabels(): array
|
||||
{
|
||||
return [
|
||||
'defect' => 'Defecto',
|
||||
'safety' => 'Seguridad',
|
||||
'quality' => 'Calidad',
|
||||
'defect' => 'Defecto',
|
||||
'safety' => 'Seguridad',
|
||||
'quality' => 'Calidad',
|
||||
'documentation' => 'Documentación',
|
||||
'other' => 'Otro',
|
||||
'other' => 'Otro',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -92,12 +133,12 @@ class Issue extends Model
|
||||
|
||||
public function getTypeColorAttribute(): string
|
||||
{
|
||||
return match($this->type) {
|
||||
'defect' => '#ef4444',
|
||||
'safety' => '#f97316',
|
||||
'quality' => '#0ea5e9',
|
||||
return match ($this->type) {
|
||||
'defect' => '#ef4444',
|
||||
'safety' => '#f97316',
|
||||
'quality' => '#0ea5e9',
|
||||
'documentation' => '#8b5cf6',
|
||||
default => '#6b7280',
|
||||
default => '#6b7280',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user