feat: slected after buy
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user