feat: slected after buy

This commit is contained in:
2026-07-10 01:27:24 +03:30
parent fe0b63083c
commit ceb1c68174
4 changed files with 20 additions and 0 deletions
+5
View File
@@ -99,6 +99,11 @@ func (s *Service) BuyCarpet(ctx context.Context, userID int64, carpetID string)
`INSERT INTO user_carpets (user_id, carpet_id) VALUES (?, ?)`, userID, carpetID); err != nil {
return err
}
// خرید = مالکیت + انتخابِ خودکار.
if _, err := tx.ExecContext(ctx,
`UPDATE users SET selected_carpet = ? WHERE id = ?`, carpetID, userID); err != nil {
return err
}
return tx.Commit()
}