skip null worknotes
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-03-26 12:17:21 +11:00
parent 0e9591e6fc
commit 34552985b7

View File

@@ -109,9 +109,11 @@ func (h *Handler) GetIncident(w http.ResponseWriter, r *http.Request) {
// get worknotes for this incident // get worknotes for this incident
for _, note := range wknList { for _, note := range wknList {
if note.IncidentNumber == inc.IncidentNumber.String { if note.IncidentNumber == inc.IncidentNumber.String {
if note.Note.Valid {
wkn = append(wkn, note.Note.String) wkn = append(wkn, note.Note.String)
} }
} }
}
// transform inc to SingleIncidentResponse // transform inc to SingleIncidentResponse
r := models.SingleIncidentResponse{ r := models.SingleIncidentResponse{
@@ -214,9 +216,12 @@ func (h *Handler) getSingleIncident(number string, ctx context.Context) ([]byte,
} }
for _, note := range wknotes { for _, note := range wknotes {
if note.Note.Valid {
wkn = append(wkn, note.Note.String) wkn = append(wkn, note.Note.String)
} }
}
// convert from database resposne to expected json format // convert from database resposne to expected json format
r := models.SingleIncidentResponse{ r := models.SingleIncidentResponse{
Number: incResult.IncidentNumber.String, Number: incResult.IncidentNumber.String,