feat: introduce attribute management system for sandbox

- Added AttrMap and AttrKey classes for type-safe attribute storage.
- Implemented AppAssetsAttrs and SkillAttrs for managing application and skill attributes.
- Refactored Sandbox and initializers to utilize the new attribute management system, enhancing modularity and clarity in asset handling.
This commit is contained in:
Harry
2026-01-22 15:05:35 +08:00
parent ecd6c44a32
commit e7c3e4cd21
13 changed files with 524 additions and 49 deletions

View File

@ -58,6 +58,22 @@ class AppAssetService:
session.commit()
return assets
@staticmethod
def get_tenant_app_assets(tenant_id: str, assets_id: str) -> AppAssets:
with Session(db.engine, expire_on_commit=False) as session:
app_assets = (
session.query(AppAssets)
.filter(
AppAssets.tenant_id == tenant_id,
AppAssets.id == assets_id,
)
.first()
)
if not app_assets:
raise ValueError(f"App assets not found for tenant_id={tenant_id}, assets_id={assets_id}")
return app_assets
@staticmethod
def get_assets(tenant_id: str, app_id: str, user_id: str, *, is_draft: bool) -> AppAssets | None:
with Session(db.engine, expire_on_commit=False) as session: