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:
@@ -3,17 +3,19 @@
|
||||
namespace Tests\Feature\Api;
|
||||
|
||||
use App\Models\Feature;
|
||||
use App\Models\FeatureType;
|
||||
use App\Models\Inspection;
|
||||
use App\Models\InspectionTemplate;
|
||||
use App\Models\Issue;
|
||||
use App\Models\IssueComment;
|
||||
use App\Models\IssueTask;
|
||||
use App\Models\Layer;
|
||||
use App\Models\Media;
|
||||
use App\Models\Phase;
|
||||
use App\Models\Project;
|
||||
use App\Models\ProgressUpdate;
|
||||
use App\Models\User;
|
||||
use App\Models\Project;
|
||||
use App\Models\SyncLog;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Carbon;
|
||||
@@ -38,15 +40,15 @@ class MobileApiTest extends TestCase
|
||||
private function makeProject(?User $member = null): Project
|
||||
{
|
||||
$project = Project::create([
|
||||
'reference' => 'TEST-1',
|
||||
'name' => 'Proyecto Test',
|
||||
'address' => 'Calle Falsa 123',
|
||||
'lat' => 40.0,
|
||||
'lng' => -3.0,
|
||||
'start_date' => now()->toDateString(),
|
||||
'reference' => 'TEST-1',
|
||||
'name' => 'Proyecto Test',
|
||||
'address' => 'Calle Falsa 123',
|
||||
'lat' => 40.0,
|
||||
'lng' => -3.0,
|
||||
'start_date' => now()->toDateString(),
|
||||
'end_date_estimated' => now()->addMonths(6)->toDateString(),
|
||||
'status' => 'in_progress',
|
||||
'created_by' => $member?->id ?? User::factory()->create()->id,
|
||||
'status' => 'in_progress',
|
||||
'created_by' => $member?->id ?? User::factory()->create()->id,
|
||||
]);
|
||||
|
||||
if ($member) {
|
||||
@@ -59,10 +61,10 @@ class MobileApiTest extends TestCase
|
||||
private function makePhase(Project $project, string $name = 'Fase 1'): Phase
|
||||
{
|
||||
return Phase::create([
|
||||
'project_id' => $project->id,
|
||||
'name' => $name,
|
||||
'order' => 1,
|
||||
'color' => '#3b82f6',
|
||||
'project_id' => $project->id,
|
||||
'name' => $name,
|
||||
'order' => 1,
|
||||
'color' => '#3b82f6',
|
||||
'progress_percent' => 0,
|
||||
]);
|
||||
}
|
||||
@@ -70,10 +72,10 @@ class MobileApiTest extends TestCase
|
||||
private function makeLayer(Phase $phase): Layer
|
||||
{
|
||||
return Layer::create([
|
||||
'project_id' => $phase->project_id,
|
||||
'phase_id' => $phase->id,
|
||||
'name' => 'Capa 1',
|
||||
'color' => '#10b981',
|
||||
'project_id' => $phase->project_id,
|
||||
'phase_id' => $phase->id,
|
||||
'name' => 'Capa 1',
|
||||
'color' => '#10b981',
|
||||
'uploaded_by' => $phase->project->created_by,
|
||||
]);
|
||||
}
|
||||
@@ -82,10 +84,10 @@ class MobileApiTest extends TestCase
|
||||
{
|
||||
return Feature::create([
|
||||
'layer_id' => $layer->id,
|
||||
'name' => 'Elemento 1',
|
||||
'name' => 'Elemento 1',
|
||||
'geometry' => ['type' => 'Point', 'coordinates' => [-3.0, 40.0]],
|
||||
'progress' => 0,
|
||||
'status' => 'planned',
|
||||
'status' => 'planned',
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -96,8 +98,8 @@ class MobileApiTest extends TestCase
|
||||
$user = User::factory()->create();
|
||||
|
||||
$res = $this->postJson('/api/v1/login', [
|
||||
'email' => $user->email,
|
||||
'password' => 'password',
|
||||
'email' => $user->email,
|
||||
'password' => 'password',
|
||||
'device_name' => 'Pixel-Test',
|
||||
]);
|
||||
|
||||
@@ -110,8 +112,8 @@ class MobileApiTest extends TestCase
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->postJson('/api/v1/login', [
|
||||
'email' => $user->email,
|
||||
'password' => 'incorrecta',
|
||||
'email' => $user->email,
|
||||
'password' => 'incorrecta',
|
||||
'device_name' => 'Pixel-Test',
|
||||
])->assertStatus(422);
|
||||
}
|
||||
@@ -239,7 +241,7 @@ class MobileApiTest extends TestCase
|
||||
$new = $this->makePhase($project, 'Fase nueva');
|
||||
|
||||
Sanctum::actingAs($user, ['mobile-sync']);
|
||||
$res = $this->getJson("/api/v1/projects/{$project->id}/bundle?since=" . urlencode($since->toIso8601String()))->assertOk();
|
||||
$res = $this->getJson("/api/v1/projects/{$project->id}/bundle?since=".urlencode($since->toIso8601String()))->assertOk();
|
||||
|
||||
$ids = collect($res->json('phases'))->pluck('id');
|
||||
$this->assertTrue($ids->contains($new->id));
|
||||
@@ -262,7 +264,7 @@ class MobileApiTest extends TestCase
|
||||
$feature->delete(); // soft delete
|
||||
|
||||
Sanctum::actingAs($user, ['mobile-sync']);
|
||||
$res = $this->getJson("/api/v1/projects/{$project->id}/bundle?since=" . urlencode($since->toIso8601String()))->assertOk();
|
||||
$res = $this->getJson("/api/v1/projects/{$project->id}/bundle?since=".urlencode($since->toIso8601String()))->assertOk();
|
||||
|
||||
$this->assertContains($feature->id, $res->json('deleted.features'));
|
||||
|
||||
@@ -274,7 +276,7 @@ class MobileApiTest extends TestCase
|
||||
$user = User::factory()->create();
|
||||
$project = $this->makeProject($user);
|
||||
$tpl = InspectionTemplate::create([
|
||||
'name' => 'Plantilla A',
|
||||
'name' => 'Plantilla A',
|
||||
'fields' => [['name' => 'ok', 'label' => 'OK', 'type' => 'boolean']],
|
||||
]);
|
||||
$project->inspectionTemplates()->attach($tpl->id);
|
||||
@@ -362,7 +364,7 @@ class MobileApiTest extends TestCase
|
||||
$user->givePermissionTo('update progress');
|
||||
$project = $this->makeProject($user);
|
||||
$feature = $this->makeFeature($this->makeLayer($this->makePhase($project)));
|
||||
$type = \App\Models\FeatureType::create(['name' => 'Pilar', 'color' => '#ffffff']);
|
||||
$type = FeatureType::create(['name' => 'Pilar', 'color' => '#ffffff']);
|
||||
|
||||
Sanctum::actingAs($user, ['mobile-sync']);
|
||||
$this->postJson('/api/v1/sync', ['operations' => [[
|
||||
@@ -431,7 +433,7 @@ class MobileApiTest extends TestCase
|
||||
'file' => UploadedFile::fake()->image('foto.jpg'),
|
||||
])->assertOk()->assertJsonPath('status', 'duplicate');
|
||||
|
||||
$this->assertEquals(1, \App\Models\Media::where('uuid', $uuid)->count());
|
||||
$this->assertEquals(1, Media::where('uuid', $uuid)->count());
|
||||
}
|
||||
|
||||
// ── Issue tasks / comments (enriquecimiento incidencias) ─────────────────────
|
||||
@@ -439,10 +441,10 @@ class MobileApiTest extends TestCase
|
||||
private function makeIssue(Project $project, ?User $reporter = null): Issue
|
||||
{
|
||||
return Issue::create([
|
||||
'project_id' => $project->id,
|
||||
'title' => 'Incidencia test',
|
||||
'status' => 'open',
|
||||
'priority' => 'medium',
|
||||
'project_id' => $project->id,
|
||||
'title' => 'Incidencia test',
|
||||
'status' => 'open',
|
||||
'priority' => 'medium',
|
||||
'reported_by' => $reporter?->id ?? $project->created_by,
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user