sync update from LAN repo (source dhk-1 @ 3b1ec5b4)
This commit is contained in:
1 parent
da6521b6cb
commit
264e2200d6
995 files changed
+148105
-13399
No files matched your search
@@ -109,6 +109,7 @@ class SkillRepository(SkillStore):
|
||||
row.published = bool(data["published"])
|
||||
if "detail" in data:
|
||||
row.detail = data["detail"]
|
||||
row.detail_preview = (str(data["detail"] or "")[:1024] or None)
|
||||
if "name_zh" in data:
|
||||
row.name_zh = data["name_zh"]
|
||||
if "always_on" in data:
|
||||
@@ -131,6 +132,7 @@ class SkillRepository(SkillStore):
|
||||
row.owner_user_id = data["owner_user_id"]
|
||||
if "detail" in data:
|
||||
row.detail = data["detail"]
|
||||
row.detail_preview = (str(data["detail"] or "")[:1024] or None)
|
||||
if "name_zh" in data:
|
||||
row.name_zh = data["name_zh"]
|
||||
if "always_on" in data:
|
||||
@@ -183,6 +185,20 @@ class SkillRepository(SkillStore):
|
||||
result = await session.execute(stmt)
|
||||
return {row[0] for row in result.all()}
|
||||
|
||||
async def list_name_zh(self, names: list[str]) -> dict[str, str]:
|
||||
wanted = list(dict.fromkeys(name for name in names if name))
|
||||
if not wanted:
|
||||
return {}
|
||||
stmt = select(SkillRow.name, SkillRow.name_zh).where(SkillRow.name.in_(wanted))
|
||||
async with self._sf() as session:
|
||||
rows = (await session.execute(stmt)).all()
|
||||
labels: dict[str, str] = {}
|
||||
for name, name_zh in rows:
|
||||
label = (name_zh or "").strip()
|
||||
if label:
|
||||
labels[name] = label
|
||||
return labels
|
||||
|
||||
async def list_favorite_skill_names(self, user_id: str) -> set[str]:
|
||||
stmt = select(SkillFavoriteRow.skill_name).where(SkillFavoriteRow.user_id == user_id)
|
||||
async with self._sf() as session:
|
||||
|
||||
Reference in new issue
Block a user