feat: implement subscription management and billing enhancements
This commit is contained in:
@@ -72,3 +72,18 @@ class SubscriptionRepository:
|
||||
result = await session.execute(stmt)
|
||||
await session.commit()
|
||||
return result.scalar_one_or_none()
|
||||
|
||||
async def update_subscription_autorenew(
|
||||
self, session: AsyncSession, user_id: int, autorenew: bool
|
||||
) -> Subscription | None:
|
||||
stmt = (
|
||||
update(Subscription)
|
||||
.where(Subscription.user_id == user_id)
|
||||
.values(
|
||||
autorenew=autorenew,
|
||||
)
|
||||
.returning(Subscription)
|
||||
)
|
||||
result = await session.execute(stmt)
|
||||
await session.commit()
|
||||
return result.scalar_one_or_none()
|
||||
|
||||
Reference in New Issue
Block a user