From 27ec63c28d502d8101adc2a5779ad1353ac47d54 Mon Sep 17 00:00:00 2001 From: DevEnv nis2-agile Date: Mon, 9 Mar 2026 10:14:30 +0100 Subject: [PATCH] [FIX] ServicesController: entity_type (nis2_entity_type col non esiste) + WebhookService risk.status null-safe --- application/controllers/ServicesController.php | 6 +++--- application/services/WebhookService.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/application/controllers/ServicesController.php b/application/controllers/ServicesController.php index a591df0..727ef2b 100644 --- a/application/controllers/ServicesController.php +++ b/application/controllers/ServicesController.php @@ -71,7 +71,7 @@ class ServicesController extends BaseController // Cerca in DB $record = Database::fetchOne( - 'SELECT ak.*, o.name as org_name, o.nis2_entity_type, o.sector + 'SELECT ak.*, o.name as org_name, o.entity_type as nis2_entity_type, o.sector FROM api_keys ak JOIN organizations o ON o.id = ak.organization_id WHERE ak.key_hash = ? AND ak.is_active = 1 @@ -888,14 +888,14 @@ class ServicesController extends BaseController ); $org = Database::fetchOne( - 'SELECT name, nis2_entity_type, sector, employee_count FROM organizations WHERE id = ?', + 'SELECT name, entity_type, sector, employee_count FROM organizations WHERE id = ?', [$orgId] ); $this->jsonSuccess([ 'organization' => [ 'name' => $org['name'], - 'entity_type' => $org['nis2_entity_type'], + 'entity_type' => $org['entity_type'], 'sector' => $org['sector'], ], 'overall_score' => $overallScore, diff --git a/application/services/WebhookService.php b/application/services/WebhookService.php index f9dd929..c4763cd 100644 --- a/application/services/WebhookService.php +++ b/application/services/WebhookService.php @@ -264,7 +264,7 @@ class WebhookService 'impact' => $risk['impact'], 'risk_level' => $risk['risk_level'], 'risk_score' => $risk['inherent_risk_score'], - 'status' => $risk['status'], + 'status' => $risk['status'] ?? 'identified', 'created_at' => $risk['created_at'], ], ];