feat: add Super Alpha research, management and MCP workflows
Deploy production / deploy (push) Successful in 56s

This commit is contained in:
yuxuanhui
2026-09-13 12:32:16 +08:00
parent 7c8188df9c
commit e256d6fef1
59 changed files with 3766 additions and 125 deletions
+9 -7
View File
@@ -91,27 +91,29 @@ class Business:
else None,
}
async def get_alpha_facets(self):
async def get_alpha_facets(self, management_scope=None):
from .schemas import AlphaFilters
ids = list_statement(AlphaFilters(management_scope=management_scope)).with_only_columns(Alpha.id)
result = {}
for key in ("region", "universe", "alpha_type", "language", "status", "stage"):
column = getattr(Alpha, key)
result[key] = list(
(
await self.db.scalars(
select(column).where(column.is_not(None)).distinct().order_by(column)
select(column).where(column.is_not(None), Alpha.id.in_(ids)).distinct().order_by(column)
)
).all()
)
result["tags"] = list(
(await self.db.scalars(select(ResearchTag.tag).distinct().order_by(ResearchTag.tag))).all()
(await self.db.scalars(select(ResearchTag.tag).where(ResearchTag.alpha_id.in_(ids)).distinct().order_by(ResearchTag.tag))).all()
)
result["total"] = await self.db.scalar(select(func.count()).select_from(Alpha))
result["total"] = await self.db.scalar(select(func.count()).select_from(Alpha).where(Alpha.id.in_(ids)))
result["favorites"] = await self.db.scalar(
select(func.count()).select_from(Research).where(Research.favorite.is_(True))
select(func.count()).select_from(Research).where(Research.favorite.is_(True), Research.alpha_id.in_(ids))
)
result["last_sync"] = await self.db.scalar(select(func.max(Alpha.synced_at)))
result["last_sync"] = await self.db.scalar(select(func.max(Alpha.synced_at)).where(Alpha.id.in_(ids)))
result["source"] = sorted(
{kind for kinds in (await source_kinds(self.db)).values() for kind in kinds}
{kind for kinds in (await source_kinds(self.db, list(await self.db.scalars(ids)))).values() for kind in kinds}
)
return result