|
|
|
@ -196,12 +196,6 @@ func (pgSQL *pgSQL) insertVulnerability(vulnerability database.Vulnerability) er
|
|
|
|
|
tx.Rollback()
|
|
|
|
|
return handleError("i_vulnerability", err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create NewVulnerabilityNotification.
|
|
|
|
|
notification := database.VulnerabilityNotification{NewVulnerability: vulnerability}
|
|
|
|
|
if err := pgSQL.insertNotification(tx, notification); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// Update vulnerability
|
|
|
|
|
if vulnerability.Description != existingVulnerability.Description ||
|
|
|
|
@ -228,6 +222,22 @@ func (pgSQL *pgSQL) insertVulnerability(vulnerability database.Vulnerability) er
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create notification.
|
|
|
|
|
var notification database.VulnerabilityNotification
|
|
|
|
|
if existingVulnerability.ID == 0 {
|
|
|
|
|
notification = database.VulnerabilityNotification{
|
|
|
|
|
NewVulnerability: vulnerability,
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
notification = database.VulnerabilityNotification{
|
|
|
|
|
OldVulnerability: &existingVulnerability,
|
|
|
|
|
NewVulnerability: vulnerability,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if err := pgSQL.insertNotification(tx, notification); err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Commit transaction.
|
|
|
|
|
err = tx.Commit()
|
|
|
|
|
if err != nil {
|
|
|
|
|