ソースを参照

fix: UpdateStatus SQL — разделить параметр \ чтобы избежать type conflict в pgx

neyrogovnarik 1 ヶ月 前
コミット
43b629359d
1 ファイル変更3 行追加3 行削除
  1. 3 3
      backend/internal/repository/places.go

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

@@ -157,9 +157,9 @@ func (r *PlaceRepo) Update(ctx context.Context, p *models.Place) error {
 func (r *PlaceRepo) UpdateStatus(ctx context.Context, id, status, comment string) error {
 	_, err := r.pool.Exec(ctx,
 		`UPDATE places SET status=$1, moderation_comment=$2, updated_at=now(),
-		 published_at = CASE WHEN $1 = 'published' THEN now() ELSE published_at END
-		 WHERE id=$3 AND deleted_at IS NULL`,
-		status, comment, id)
+		 published_at = CASE WHEN $3 THEN now() ELSE published_at END
+		 WHERE id=$4 AND deleted_at IS NULL`,
+		status, comment, status == "published", id)
 	return err
 }