This commit is contained in:
itqop 2024-04-15 14:57:31 +03:00
parent 9cb00eec52
commit 8ef95ec7e8
2 changed files with 4 additions and 2 deletions

View File

@ -167,7 +167,7 @@ class Database:
async def delete_expired_subscriptions(self): async def delete_expired_subscriptions(self):
async with self.AsyncSessionLocal() as session: async with self.AsyncSessionLocal() as session:
try: try:
await session.execute(delete(Subscribe).where(Subscribe.expiry < datetime.now(datetime.timezone.utc))) await session.execute(delete(Subscribe).where(Subscribe.expiry < datetime.datetime.now(datetime.timezone.utc)))
await session.commit() await session.commit()
except Exception as e: except Exception as e:
print("Ошибка при удалении устаревших подписок:", e) print("Ошибка при удалении устаревших подписок:", e)

View File

@ -1,9 +1,11 @@
from pydantic import PositiveInt from pydantic import PositiveInt
from .UUIDSchema import UUIDSchema from .UUIDSchema import UUIDSchema
from .TabSchema import TabSchema
class UserSchema(UUIDSchema): class UserSchema(UUIDSchema):
username: str username: str
discord_id: str discord_id: str
has_sub: bool has_sub: bool
expiry: PositiveInt = 1 expiry: PositiveInt = 1
tab: TabSchema = TabSchema()