Skip to content

Commit

Permalink
Fix subscription record logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ishefi committed Feb 4, 2024
1 parent 6dbc5ee commit c2795c7
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions logic/user_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@ async def subscribe(self, subscription: schemas.Subscription) -> bool:
query = select(tables.UserSubscription)
query = query.where(tables.UserSubscription.uuid == subscription.message_id)
if session.exec(query).one_or_none() is None:
return False

session.add(
tables.UserSubscription(
user_id=user.id,
amount=subscription.amount,
tier_name=subscription.tier_name,
uuid=subscription.message_id,
timestamp=subscription.timestamp,
session.add(
tables.UserSubscription(
user_id=user.id,
amount=subscription.amount,
tier_name=subscription.tier_name,
uuid=subscription.message_id,
timestamp=subscription.timestamp,
)
)
)
return True
return True
else:
return False

def get_subscription_expiry(self, user: tables.User) -> datetime.datetime | None:
with hs_transaction(self.session, expire_on_commit=False) as session:
Expand Down

0 comments on commit c2795c7

Please sign in to comment.