|
|
@@ -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
|
|
|
}
|
|
|
|