sync update from LAN repo (source master @ ca48c4ec)
This commit is contained in:
1 parent
8bc8b0e082
commit
ea9dcff9c0
873 files changed
+107866
-14011
No files matched your search
+13
@@ -15,6 +15,19 @@ class DuplicateLightAppNameError(ValueError):
|
||||
|
||||
|
||||
class LightAppStore(ABC):
|
||||
async def list_sidebar_apps(self) -> list[dict[str, Any]]:
|
||||
"""Return only the columns needed to render iframe app menu entries."""
|
||||
rows = await self.list_apps(app_type="iframe", enabled_only=True)
|
||||
return [
|
||||
{
|
||||
"app_id": row.get("app_id"),
|
||||
"name": row.get("name"),
|
||||
"mount_location": row.get("mount_location"),
|
||||
"sort_order": row.get("sort_order", 0),
|
||||
}
|
||||
for row in rows
|
||||
]
|
||||
|
||||
@abstractmethod
|
||||
async def list_apps(
|
||||
self,
|
||||
|
||||
+16
@@ -65,6 +65,22 @@ class LightAppRepository(LightAppStore):
|
||||
result = await session.execute(stmt)
|
||||
return [_to_dict(row) for row in result.scalars()]
|
||||
|
||||
async def list_sidebar_apps(self) -> list[dict[str, Any]]:
|
||||
"""Avoid loading descriptions, icons, route JSON, tags, and audit data."""
|
||||
stmt = (
|
||||
select(
|
||||
LightAppRow.app_id,
|
||||
LightAppRow.name,
|
||||
LightAppRow.mount_location,
|
||||
LightAppRow.sort_order,
|
||||
)
|
||||
.where(LightAppRow.app_type == "iframe", LightAppRow.enabled.is_(True))
|
||||
.order_by(LightAppRow.sort_order.asc(), LightAppRow.created_at.desc())
|
||||
)
|
||||
async with self._sf() as session:
|
||||
result = await session.execute(stmt)
|
||||
return [dict(row._mapping) for row in result]
|
||||
|
||||
async def get_app(self, app_id: str) -> dict[str, Any] | None:
|
||||
async with self._sf() as session:
|
||||
row = await session.get(LightAppRow, app_id)
|
||||
|
||||
Reference in new issue
Block a user