mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-12-20 17:58: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
|
||||
}), nil
|
||||
}
|
||||
@ -235,11 +239,18 @@ func (a *Access) GetAdvisoryByCodeAndYearAndNum(code string, year int, num int)
|
||||
|
||||
return false
|
||||
})
|
||||
|
||||
if len(advisories) == 0 {
|
||||
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) {
|
||||
|
@ -120,6 +120,7 @@ func (a *Access) GetAllAdvisories(filters *apollopb.AdvisoryFilters, page int32,
|
||||
a.reboot_suggested,
|
||||
a.published_at,
|
||||
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(
|
||||
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')
|
||||
|
Loading…
Reference in New Issue
Block a user