From f007cb56fd85e14ed1a52287012430f261367968 Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 30 Aug 2024 14:34:31 +0200 Subject: [PATCH] feat(spot): addComment fix (null -> 0 for array_lenght method) --- backend/pkg/spot/service/spot.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/pkg/spot/service/spot.go b/backend/pkg/spot/service/spot.go index c9ee133cb..03345cee0 100644 --- a/backend/pkg/spot/service/spot.go +++ b/backend/pkg/spot/service/spot.go @@ -287,7 +287,7 @@ func (s *spotsImpl) addComment(spotID uint64, newComment *Comment, user *auth.Us sql := `WITH updated AS ( UPDATE spots SET comments = array_append(comments, $1), updated_at = $2 - WHERE spot_id = $3 AND tenant_id = $4 AND deleted_at IS NULL AND array_length(comments, 1) < $5 + WHERE spot_id = $3 AND tenant_id = $4 AND deleted_at IS NULL AND COALESCE(array_length(comments, 1), 0) < $5 RETURNING *) SELECT COUNT(*) FROM updated` encodedComment := s.encodeComment(newComment)