fix(services): initialize slices to empty array to prevent null json response
This commit is contained in:
parent
2fafd5ab37
commit
06ed927ef4
2 changed files with 3 additions and 3 deletions
|
|
@ -38,7 +38,7 @@ func (s *NotificationService) ListNotifications(ctx context.Context, userID stri
|
|||
}
|
||||
defer rows.Close()
|
||||
|
||||
var notifications []models.Notification
|
||||
notifications := []models.Notification{}
|
||||
for rows.Next() {
|
||||
var n models.Notification
|
||||
if err := rows.Scan(
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ func (s *TicketService) ListTickets(ctx context.Context, userID string) ([]model
|
|||
}
|
||||
defer rows.Close()
|
||||
|
||||
var tickets []models.Ticket
|
||||
tickets := []models.Ticket{}
|
||||
for rows.Next() {
|
||||
var t models.Ticket
|
||||
if err := rows.Scan(
|
||||
|
|
@ -92,7 +92,7 @@ func (s *TicketService) GetTicket(ctx context.Context, ticketID string, userID s
|
|||
}
|
||||
defer rows.Close()
|
||||
|
||||
var messages []models.TicketMessage
|
||||
messages := []models.TicketMessage{}
|
||||
for rows.Next() {
|
||||
var m models.TicketMessage
|
||||
if err := rows.Scan(
|
||||
|
|
|
|||
Loading…
Reference in a new issue