[FIX] ServicesController: entity_type (nis2_entity_type col non esiste) + WebhookService risk.status null-safe

This commit is contained in:
DevEnv nis2-agile 2026-03-09 10:14:30 +01:00
parent 086ffbd675
commit 27ec63c28d
2 changed files with 4 additions and 4 deletions

View File

@ -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,

View File

@ -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'],
],
];