From c1fdc1f9a6907d9fea57d54786cedb6fda2f93bf Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Tue, 25 Mar 2025 18:53:59 +1100 Subject: [PATCH] bugfix GetIncidentReport --- db/queries/query.sql | 2 +- db/queries/query.sql.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db/queries/query.sql b/db/queries/query.sql index 25f8801..938855e 100644 --- a/db/queries/query.sql +++ b/db/queries/query.sql @@ -56,7 +56,7 @@ WHERE incident_number = sqlc.arg('incidentNumber'); SELECT * FROM incidents; -- name: GetIncidentReport :many -SELECT incidents.*, GROUP_CONCAT(worknotes.note, '
') AS all_notes +SELECT incidents.*, IFNULL(GROUP_CONCAT(worknotes.note, '
'), ' ') AS all_notes FROM incidents LEFT JOIN worknotes ON incidents.incident_number = worknotes.incident_number GROUP BY incidents.id; diff --git a/db/queries/query.sql.go b/db/queries/query.sql.go index c569d33..65af69b 100644 --- a/db/queries/query.sql.go +++ b/db/queries/query.sql.go @@ -184,7 +184,7 @@ func (q *Queries) GetIncident(ctx context.Context, incidentnumber sql.NullString } const getIncidentReport = `-- name: GetIncidentReport :many -SELECT incidents.id, incidents.external_id, incidents.created_at, incidents.incident_number, incidents.description, incidents.short_description, incidents.urgency, incidents.impact, incidents.state, incidents.assignment_group, incidents.assigned_to, incidents.category, incidents.sub_category, incidents.sys_id, GROUP_CONCAT(worknotes.note, '
') AS all_notes +SELECT incidents.id, incidents.external_id, incidents.created_at, incidents.incident_number, incidents.description, incidents.short_description, incidents.urgency, incidents.impact, incidents.state, incidents.assignment_group, incidents.assigned_to, incidents.category, incidents.sub_category, incidents.sys_id, IFNULL(GROUP_CONCAT(worknotes.note, '
'), ' ') AS all_notes FROM incidents LEFT JOIN worknotes ON incidents.incident_number = worknotes.incident_number GROUP BY incidents.id ` @@ -204,7 +204,7 @@ type GetIncidentReportRow struct { Category sql.NullString SubCategory sql.NullString SysID sql.NullString - AllNotes string + AllNotes interface{} } func (q *Queries) GetIncidentReport(ctx context.Context) ([]GetIncidentReportRow, error) {