🐛 修复用户名订阅失败

This commit is contained in:
xtaodada 2022-11-27 14:20:18 +08:00
parent 836ae880e6
commit abb83c0cd4
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -117,7 +117,7 @@ class FragmentSub:
async def get_by_cid_and_username(cid: int, username: str) -> Optional[Fragment]: async def get_by_cid_and_username(cid: int, username: str) -> Optional[Fragment]:
async with sqlite.Session() as session: async with sqlite.Session() as session:
session = cast(AsyncSession, session) session = cast(AsyncSession, session)
statement = select(Fragment).where(Fragment.cid == cid and Fragment.username == username) statement = select(Fragment).where(Fragment.cid == cid).where(Fragment.username == username)
results = await session.exec(statement) results = await session.exec(statement)
return post[0] if (post := results.first()) else None return post[0] if (post := results.first()) else None