mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-12-21 02:08:29 +00:00
Merge pull request #88 from NeilHanlon/apollo/87/advisories-fixes
Make GetAllAdvisories return fixes in the sql query
This commit is contained in:
commit
26777167c4
@ -223,6 +223,10 @@ func (a *Access) GetAllAdvisories(filters *apollopb.AdvisoryFilters, page int32,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if advisory.Fixes != nil && len(advisory.Fixes) < 1 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}), nil
|
}), nil
|
||||||
}
|
}
|
||||||
@ -235,11 +239,18 @@ func (a *Access) GetAdvisoryByCodeAndYearAndNum(code string, year int, num int)
|
|||||||
|
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
|
||||||
if len(advisories) == 0 {
|
if len(advisories) == 0 {
|
||||||
return nil, sql.ErrNoRows
|
return nil, sql.ErrNoRows
|
||||||
}
|
}
|
||||||
|
|
||||||
return advisories[0], nil
|
advisory := advisories[0]
|
||||||
|
|
||||||
|
if advisory.Fixes != nil && len(advisory.Fixes) < 1 {
|
||||||
|
return nil, fmt.Errorf("Expected advisory fixes. Was empty.")
|
||||||
|
}
|
||||||
|
|
||||||
|
return advisory, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Access) CreateAdvisory(advisory *apollodb.Advisory) (*apollodb.Advisory, error) {
|
func (a *Access) CreateAdvisory(advisory *apollodb.Advisory) (*apollodb.Advisory, error) {
|
||||||
|
@ -120,6 +120,7 @@ func (a *Access) GetAllAdvisories(filters *apollopb.AdvisoryFilters, page int32,
|
|||||||
a.reboot_suggested,
|
a.reboot_suggested,
|
||||||
a.published_at,
|
a.published_at,
|
||||||
array_remove(array_agg(distinct p.name), NULL) as affected_products,
|
array_remove(array_agg(distinct p.name), NULL) as affected_products,
|
||||||
|
(select array_agg(distinct(f.ticket || ':::' || f.source_by || ':::' || f.source_link || ':::' || f.description)) from advisory_fixes adf inner join fixes f on f.id = adf.fix_id where adf.advisory_id = a.id) as fixes,
|
||||||
(select array_agg(distinct(
|
(select array_agg(distinct(
|
||||||
case when c.content is null then c.source_by || ':::' || c.source_link || ':::' || c.id || ':::::::::'
|
case when c.content is null then c.source_by || ':::' || c.source_link || ':::' || c.id || ':::::::::'
|
||||||
else c.source_by || ':::' || c.source_link || ':::' || c.id || ':::' || jsonb_extract_path_text(c.content, 'cvss3', 'cvss3_scoring_vector') || ':::' || jsonb_extract_path_text(c.content, 'cvss3', 'cvss3_base_score') || ':::' || jsonb_extract_path_text(c.content, 'cwe')
|
else c.source_by || ':::' || c.source_link || ':::' || c.id || ':::' || jsonb_extract_path_text(c.content, 'cvss3', 'cvss3_scoring_vector') || ':::' || jsonb_extract_path_text(c.content, 'cvss3', 'cvss3_base_score') || ':::' || jsonb_extract_path_text(c.content, 'cwe')
|
||||||
|
Loading…
Reference in New Issue
Block a user