Ver Fonte

fix: COALESCE type mismatch jsonb vs json in GetByIDWithDetails SQL

neyrogovnarik há 1 mês atrás
pai
commit
a59276a75f
1 ficheiros alterados com 4 adições e 4 exclusões
  1. 4 4
      backend/internal/repository/places.go

+ 4 - 4
backend/internal/repository/places.go

@@ -67,10 +67,10 @@ func (r *PlaceRepo) GetByIDWithDetails(ctx context.Context, id string) (*models.
 		       p.cover_image, p.access_info, p.status, p.moderation_comment,
 		       p.rating, p.reviews_count, p.hourly_rate, p.currency, p.min_hours, p.booking_url,
 		       p.created_at, p.updated_at, p.published_at, p.deleted_at,
-		       COALESCE(json_agg(DISTINCT jsonb_build_object('id', t.id, 'name', t.name, 'category', t.category))
-		                FILTER (WHERE t.id IS NOT NULL), '[]'::jsonb) as tags,
-		       COALESCE(json_agg(DISTINCT jsonb_build_object('id', f.id, 'name', f.name, 'category', f.category, 'icon', f.icon))
-		                FILTER (WHERE f.id IS NOT NULL), '[]'::jsonb) as features
+	       COALESCE(json_agg(DISTINCT jsonb_build_object('id', t.id, 'name', t.name, 'category', t.category))
+	                FILTER (WHERE t.id IS NOT NULL), '[]'::json) as tags,
+	       COALESCE(json_agg(DISTINCT jsonb_build_object('id', f.id, 'name', f.name, 'category', f.category, 'icon', f.icon))
+	                FILTER (WHERE f.id IS NOT NULL), '[]'::json) as features
 		FROM places p
 		LEFT JOIN place_tags pt ON pt.place_id = p.id
 		LEFT JOIN tags t ON t.id = pt.tag_id