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:
@@ -30,4 +30,4 @@ return new class extends Migration
|
||||
{
|
||||
Schema::dropIfExists('projects');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -29,4 +29,4 @@ return new class extends Migration
|
||||
{
|
||||
Schema::dropIfExists('phases');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -25,4 +25,4 @@ return new class extends Migration
|
||||
{
|
||||
Schema::dropIfExists('layers');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -25,4 +25,4 @@ return new class extends Migration
|
||||
{
|
||||
Schema::dropIfExists('progress_updates');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -22,4 +22,4 @@ return new class extends Migration
|
||||
{
|
||||
Schema::dropIfExists('pending_syncs');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -21,4 +21,4 @@ return new class extends Migration
|
||||
{
|
||||
Schema::dropIfExists('project_user');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -30,4 +30,4 @@ return new class extends Migration
|
||||
{
|
||||
Schema::dropIfExists('media');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -36,4 +36,4 @@ return new class extends Migration
|
||||
{
|
||||
Schema::dropIfExists('companies');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -30,4 +30,4 @@ return new class extends Migration
|
||||
{
|
||||
Schema::dropIfExists('company_project');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
+11
-3
@@ -32,7 +32,9 @@ return new class extends Migration
|
||||
foreach ($rows as $r) {
|
||||
// Evitar duplicados; si el proyecto ya no existe lo ignoramos
|
||||
$projectExists = DB::table('projects')->where('id', $r->project_id)->exists();
|
||||
if (! $projectExists) continue;
|
||||
if (! $projectExists) {
|
||||
continue;
|
||||
}
|
||||
|
||||
DB::table('inspection_template_project')->updateOrInsert(
|
||||
['inspection_template_id' => $r->id, 'project_id' => $r->project_id],
|
||||
@@ -46,9 +48,15 @@ return new class extends Migration
|
||||
Schema::table('inspection_templates', function (Blueprint $table) {
|
||||
// 1) FK primero: si no la dropeamos, MySQL rechaza soltar el índice
|
||||
// que la sustenta ("needed in a foreign key constraint").
|
||||
try { $table->dropForeign(['phase_id']); } catch (\Throwable $e) { /* sqlite sin FKs / ya inexistente */ }
|
||||
try {
|
||||
$table->dropForeign(['phase_id']);
|
||||
} catch (Throwable $e) { /* sqlite sin FKs / ya inexistente */
|
||||
}
|
||||
// 2) Índice después (nombre por convención de Laravel).
|
||||
try { $table->dropIndex('inspection_templates_phase_id_index'); } catch (\Throwable $e) { /* ya no existe */ }
|
||||
try {
|
||||
$table->dropIndex('inspection_templates_phase_id_index');
|
||||
} catch (Throwable $e) { /* ya no existe */
|
||||
}
|
||||
// 3) Columna al final.
|
||||
$table->dropColumn('phase_id');
|
||||
});
|
||||
|
||||
@@ -48,4 +48,4 @@ return new class extends Migration
|
||||
{
|
||||
Schema::dropIfExists('tasks');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -30,4 +30,4 @@ return new class extends Migration
|
||||
{
|
||||
Schema::dropIfExists('comments');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -21,4 +21,4 @@ return new class extends Migration
|
||||
$table->dropColumn(['baseline_start', 'baseline_end']);
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
+2
-2
@@ -24,8 +24,8 @@ return new class extends Migration
|
||||
$table->dropColumn([
|
||||
'planned_start', 'planned_end',
|
||||
'actual_start', 'actual_end',
|
||||
'baseline_start', 'baseline_end'
|
||||
'baseline_start', 'baseline_end',
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ return new class extends Migration
|
||||
$table->string('method')->default('manual'); // manual|inspection|task|geometry|hybrid
|
||||
$table->json('metadata')->nullable(); // {earned_value, planned_value, actual_cost, spi, cpi, ...}
|
||||
$table->timestamps();
|
||||
|
||||
|
||||
// Short index name for MySQL 64-char limit
|
||||
$table->unique(['trackable_type', 'trackable_id', 'snapshot_date'], 'ps_trackable_date_unique');
|
||||
$table->index(['trackable_type', 'trackable_id', 'snapshot_date'], 'ps_trackable_date_idx');
|
||||
@@ -32,4 +32,4 @@ return new class extends Migration
|
||||
{
|
||||
Schema::dropIfExists('progress_snapshots');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -22,7 +22,6 @@ class DatabaseSeeder extends Seeder
|
||||
'email' => 'test@example.com',
|
||||
]);*/
|
||||
|
||||
|
||||
$this->call([
|
||||
RolesAndPermissionsSeeder::class,
|
||||
PermissionCatalogSeeder::class,
|
||||
|
||||
@@ -19,64 +19,64 @@ class PermissionCatalogSeeder extends Seeder
|
||||
|
||||
$catalog = [
|
||||
'Proyectos' => [
|
||||
'view projects' => 'Ver listado y fichas de proyectos',
|
||||
'create projects' => 'Crear proyectos',
|
||||
'edit projects' => 'Editar datos del proyecto',
|
||||
'delete projects' => 'Eliminar proyectos',
|
||||
'export projects' => 'Exportar proyectos (Excel/PDF)',
|
||||
'view projects' => 'Ver listado y fichas de proyectos',
|
||||
'create projects' => 'Crear proyectos',
|
||||
'edit projects' => 'Editar datos del proyecto',
|
||||
'delete projects' => 'Eliminar proyectos',
|
||||
'export projects' => 'Exportar proyectos (Excel/PDF)',
|
||||
],
|
||||
'Fases y progreso' => [
|
||||
'view phases' => 'Ver fases del proyecto',
|
||||
'manage phases' => 'Crear, editar, ordenar y eliminar fases',
|
||||
'update progress' => 'Actualizar el porcentaje de progreso',
|
||||
'view phases' => 'Ver fases del proyecto',
|
||||
'manage phases' => 'Crear, editar, ordenar y eliminar fases',
|
||||
'update progress' => 'Actualizar el porcentaje de progreso',
|
||||
],
|
||||
'Capas y elementos' => [
|
||||
'view layers' => 'Ver capas y elementos en el mapa',
|
||||
'upload layers' => 'Subir/importar capas',
|
||||
'edit layers' => 'Editar capas y elementos',
|
||||
'delete layers' => 'Eliminar capas/elementos',
|
||||
'view layers' => 'Ver capas y elementos en el mapa',
|
||||
'upload layers' => 'Subir/importar capas',
|
||||
'edit layers' => 'Editar capas y elementos',
|
||||
'delete layers' => 'Eliminar capas/elementos',
|
||||
],
|
||||
'Inspecciones' => [
|
||||
'view inspections' => 'Ver inspecciones e historial',
|
||||
'view inspections' => 'Ver inspecciones e historial',
|
||||
'create inspections' => 'Registrar inspecciones',
|
||||
'edit inspections' => 'Editar inspecciones existentes',
|
||||
'edit inspections' => 'Editar inspecciones existentes',
|
||||
'delete inspections' => 'Eliminar inspecciones',
|
||||
'manage templates' => 'Gestionar plantillas de inspección',
|
||||
'manage templates' => 'Gestionar plantillas de inspección',
|
||||
],
|
||||
'Incidencias' => [
|
||||
'view issues' => 'Ver incidencias',
|
||||
'create issues' => 'Crear incidencias',
|
||||
'edit issues' => 'Editar, resolver y cerrar incidencias',
|
||||
'delete issues' => 'Eliminar incidencias',
|
||||
'view issues' => 'Ver incidencias',
|
||||
'create issues' => 'Crear incidencias',
|
||||
'edit issues' => 'Editar, resolver y cerrar incidencias',
|
||||
'delete issues' => 'Eliminar incidencias',
|
||||
],
|
||||
'Empresas' => [
|
||||
'view companies' => 'Ver empresas',
|
||||
'create companies' => 'Crear empresas',
|
||||
'edit companies' => 'Editar empresas',
|
||||
'delete companies' => 'Eliminar empresas',
|
||||
'assign companies' => 'Asignar empresas/roles a proyectos',
|
||||
'view companies' => 'Ver empresas',
|
||||
'create companies' => 'Crear empresas',
|
||||
'edit companies' => 'Editar empresas',
|
||||
'delete companies' => 'Eliminar empresas',
|
||||
'assign companies' => 'Asignar empresas/roles a proyectos',
|
||||
],
|
||||
'Usuarios' => [
|
||||
'view users' => 'Ver usuarios',
|
||||
'create users' => 'Crear usuarios',
|
||||
'edit users' => 'Editar usuarios',
|
||||
'delete users' => 'Eliminar usuarios',
|
||||
'assign users' => 'Asignar usuarios/roles a proyectos',
|
||||
'view users' => 'Ver usuarios',
|
||||
'create users' => 'Crear usuarios',
|
||||
'edit users' => 'Editar usuarios',
|
||||
'delete users' => 'Eliminar usuarios',
|
||||
'assign users' => 'Asignar usuarios/roles a proyectos',
|
||||
],
|
||||
'Roles' => [
|
||||
'manage roles' => 'Crear/editar/borrar roles y asignar permisos',
|
||||
'manage roles' => 'Crear/editar/borrar roles y asignar permisos',
|
||||
],
|
||||
'Informes' => [
|
||||
'view reports' => 'Ver panel de informes',
|
||||
'export reports' => 'Exportar informes',
|
||||
'view reports' => 'Ver panel de informes',
|
||||
'export reports' => 'Exportar informes',
|
||||
],
|
||||
'Archivos' => [
|
||||
'view media' => 'Ver archivos/galería',
|
||||
'upload media' => 'Subir archivos',
|
||||
'delete media' => 'Eliminar archivos',
|
||||
'view media' => 'Ver archivos/galería',
|
||||
'upload media' => 'Subir archivos',
|
||||
'delete media' => 'Eliminar archivos',
|
||||
],
|
||||
'General' => [
|
||||
'manage all' => 'Súper-admin: acceso total al sistema',
|
||||
'manage all' => 'Súper-admin: acceso total al sistema',
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\Project;
|
||||
use App\Models\Phase;
|
||||
use App\Models\Layer;
|
||||
use App\Models\Feature;
|
||||
use App\Models\Inspection;
|
||||
use App\Models\InspectionTemplate;
|
||||
use App\Models\Layer;
|
||||
use App\Models\Phase;
|
||||
use App\Models\Project;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ProjectExampleSeeder extends Seeder
|
||||
{
|
||||
@@ -16,7 +17,7 @@ class ProjectExampleSeeder extends Seeder
|
||||
{
|
||||
// Obtener usuario admin
|
||||
$admin = User::where('email', 'admin@email.com')->first();
|
||||
if (!$admin) {
|
||||
if (! $admin) {
|
||||
$admin = User::first();
|
||||
}
|
||||
|
||||
@@ -56,7 +57,7 @@ class ProjectExampleSeeder extends Seeder
|
||||
['name' => 'progress', 'label' => 'Progreso de vertido', 'type' => 'percentage', 'required' => true],
|
||||
['name' => 'calidad', 'label' => 'Calidad del hormigón', 'type' => 'select', 'options' => 'Excelente,Bueno,Regular,Deficiente', 'required' => true],
|
||||
['name' => 'observaciones', 'label' => 'Observaciones', 'type' => 'textarea', 'required' => false],
|
||||
]
|
||||
],
|
||||
]);
|
||||
|
||||
$templateAcero = InspectionTemplate::create([
|
||||
@@ -65,7 +66,7 @@ class ProjectExampleSeeder extends Seeder
|
||||
'fields' => [
|
||||
['name' => 'progress', 'label' => '% de acero colocado', 'type' => 'percentage', 'required' => true],
|
||||
['name' => 'diametros', 'label' => 'Diámetros verificados', 'type' => 'text', 'required' => false],
|
||||
]
|
||||
],
|
||||
]);
|
||||
|
||||
// Crear capa (sin geojson_data)
|
||||
@@ -88,8 +89,8 @@ class ProjectExampleSeeder extends Seeder
|
||||
[-3.702, 40.415],
|
||||
[-3.702, 40.418],
|
||||
[-3.705, 40.418],
|
||||
[-3.705, 40.415]
|
||||
]]
|
||||
[-3.705, 40.415],
|
||||
]],
|
||||
],
|
||||
'properties' => ['description' => 'Zapata esquina noroeste'],
|
||||
'template_id' => $templateHormigon->id,
|
||||
@@ -107,8 +108,8 @@ class ProjectExampleSeeder extends Seeder
|
||||
[-3.697, 40.415],
|
||||
[-3.697, 40.418],
|
||||
[-3.700, 40.418],
|
||||
[-3.700, 40.415]
|
||||
]]
|
||||
[-3.700, 40.415],
|
||||
]],
|
||||
],
|
||||
'properties' => ['description' => 'Zapata lado este'],
|
||||
'template_id' => $templateAcero->id,
|
||||
@@ -121,7 +122,7 @@ class ProjectExampleSeeder extends Seeder
|
||||
'name' => 'Punto de control topográfico',
|
||||
'geometry' => [
|
||||
'type' => 'Point',
|
||||
'coordinates' => [-3.703, 40.4165]
|
||||
'coordinates' => [-3.703, 40.4165],
|
||||
],
|
||||
'properties' => ['tipo' => 'estación total'],
|
||||
'template_id' => null,
|
||||
@@ -130,7 +131,7 @@ class ProjectExampleSeeder extends Seeder
|
||||
]);
|
||||
|
||||
// (Opcional) Crear una inspección de ejemplo
|
||||
\App\Models\Inspection::create([
|
||||
Inspection::create([
|
||||
'project_id' => $project->id,
|
||||
'layer_id' => $layer->id,
|
||||
'feature_id' => $feature1->id,
|
||||
@@ -139,8 +140,8 @@ class ProjectExampleSeeder extends Seeder
|
||||
'data' => [
|
||||
'progress' => 45,
|
||||
'calidad' => 'Bueno',
|
||||
'observaciones' => 'Vertido completado en un 45%, sin fisuras aparentes.'
|
||||
'observaciones' => 'Vertido completado en un 45%, sin fisuras aparentes.',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user