Add subscription link field to user model
- Add subscription_link column to users table (nullable, unique) - Add SUBSCRIPTION_URL to config settings - Update user creation to include subscription link from Remnawave - Add support subscription ticket creation with formatted message - Add "update link" button to main menu - Refactor support subscription formatting to include user details
This commit is contained in:
@@ -16,7 +16,11 @@ class UserRepository:
|
||||
return result.scalar_one_or_none()
|
||||
|
||||
async def create_user(self, session: AsyncSession, user_data: NewUserDTO) -> User:
|
||||
user = User(id=user_data.id, referal_id=user_data.referal)
|
||||
user = User(
|
||||
id=user_data.id,
|
||||
referal_id=user_data.referal,
|
||||
subscription_link=user_data.link,
|
||||
)
|
||||
session.add(user)
|
||||
await session.commit()
|
||||
|
||||
@@ -32,3 +36,14 @@ class UserRepository:
|
||||
|
||||
await session.commit()
|
||||
return user
|
||||
|
||||
async def update_user_link(
|
||||
self, session: AsyncSession, user_id: int, link: str
|
||||
) -> Optional[User]:
|
||||
user = await self.get_user_by_id(session, user_id=user_id)
|
||||
if not user:
|
||||
return None
|
||||
user.subscription_link = link
|
||||
|
||||
await session.commit()
|
||||
return user
|
||||
|
||||
Reference in New Issue
Block a user