feat: mejora lógica de inscripción de vehículos y logging
- Se actualizó la validación de asignación de módulo de tags. - Se mejoró el registro de eventos (logging).
This commit is contained in:
parent
2fd337bd16
commit
2c7ab0cb2e
@ -56,7 +56,7 @@ services:
|
|||||||
MYSQL_PASSWORD: ${DB_PASSWORD}
|
MYSQL_PASSWORD: ${DB_PASSWORD}
|
||||||
MYSQL_USER: ${DB_USERNAME}
|
MYSQL_USER: ${DB_USERNAME}
|
||||||
ports:
|
ports:
|
||||||
- "${DB_PORT_FORWARD}:3306"
|
- "${DB_PORT}:3306"
|
||||||
volumes:
|
volumes:
|
||||||
- mysql_data:/var/lib/mysql
|
- mysql_data:/var/lib/mysql
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
@ -75,6 +75,13 @@ public function vehicleInscription(VehicleStoreRequest $request)
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$tag->module_id) {
|
||||||
|
return ApiResponse::BAD_REQUEST->response([
|
||||||
|
'message' => 'El tag no tiene módulo asignado. Debe asignarse a un módulo antes de poder usarse.',
|
||||||
|
'folio' => $folio,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
// Iniciar transacción
|
// Iniciar transacción
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
|
|
||||||
@ -194,10 +201,12 @@ public function vehicleInscription(VehicleStoreRequest $request)
|
|||||||
$tag->markAsAssigned($vehicle->id, $folio);
|
$tag->markAsAssigned($vehicle->id, $folio);
|
||||||
|
|
||||||
VehicleTagLog::create([
|
VehicleTagLog::create([
|
||||||
'vehicle_id' => $vehicle->id,
|
'vehicle_id' => $vehicle->id,
|
||||||
'tag_id' => $tag->id,
|
'tag_id' => $tag->id,
|
||||||
'action_type' => $actionType,
|
'action_type' => $actionType,
|
||||||
'performed_by' => Auth::id(),
|
'folio_anterior' => $actionType === 'sustitucion' ? $folioRepuve : null,
|
||||||
|
'cancellation_at' => $actionType === 'sustitucion' ? now() : null,
|
||||||
|
'performed_by' => Auth::id(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Crear registro
|
// Crear registro
|
||||||
@ -205,7 +214,7 @@ public function vehicleInscription(VehicleStoreRequest $request)
|
|||||||
'folio' => $folio,
|
'folio' => $folio,
|
||||||
'vehicle_id' => $vehicle->id,
|
'vehicle_id' => $vehicle->id,
|
||||||
'user_id' => Auth::id(),
|
'user_id' => Auth::id(),
|
||||||
'module_id' => Auth::user()->module_id,
|
'module_id' => $tag->module_id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Procesar archivos
|
// Procesar archivos
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user