robokassa nomenclature/ minor fixes for API

This commit is contained in:
Vladless
2025-08-10 23:06:26 +03:00
parent 214c9f0c65
commit b999e4aced
5 changed files with 68 additions and 23 deletions
+4 -2
View File
@@ -18,11 +18,13 @@ async def import_keys_from_3xui_db(db_path: str, session: AsyncSession) -> tuple
skipped = 0
if USE_COUNTRY_SELECTION:
result = await session.execute(select(Server.name).where(Server.enabled is True, Server.panel_type == "3x-ui"))
result = await session.execute(
select(Server.server_name).where(Server.enabled.is_(True), Server.panel_type == "3x-ui")
)
else:
result = await session.execute(
select(Server.cluster_name)
.where(Server.enabled is True, Server.panel_type == "3x-ui", Server.cluster_name.isnot(None))
.where(Server.enabled.is_(True), Server.panel_type == "3x-ui", Server.cluster_name.isnot(None))
.distinct()
)
+5 -1
View File
@@ -123,7 +123,11 @@ class Coupon(DictLikeMixin, Base):
class CouponUsage(DictLikeMixin, Base):
__tablename__ = "coupon_usages"
coupon_id = Column(Integer, ForeignKey("coupons.id"), primary_key=True)
coupon_id = Column(
Integer,
ForeignKey("coupons.id", ondelete="CASCADE"), # Каскадное удаление
primary_key=True
)
user_id = Column(BigInteger, primary_key=True)
used_at = Column(DateTime, default=datetime.utcnow)