verify_capability(); if ( $error ) { return $error; } $scan_id = $request->get_param( 'scanId' ); $scan = Scan_Entry::get_by_id( $scan_id ); if ( empty( $scan ) ) { return $this->respond_error_json( [ 'message' => 'Scan not found', 'code' => 'not_found', ] ); } $summary = $scan->summary; if ( $summary['counts']['issuesResolved'] + 1 <= $summary['counts']['violation'] ) { $summary['counts']['issuesResolved']++; Scan_Entry::update_scan_summary( Scans_Table::ID, $scan_id, json_encode( $summary ) ); } return $this->respond_success_json( [ 'message' => 'Resolved', ] ); } catch ( Throwable $t ) { return $this->respond_error_json( [ 'message' => $t->getMessage(), 'code' => 'internal_server_error', ] ); } } }