feat: persist feature research and versioned alpha assessments
This commit is contained in:
@@ -65,8 +65,8 @@ class Assets:
|
||||
if body.kind == "feature":
|
||||
from ..catalog.service import Catalog
|
||||
|
||||
for input_id in content["input_ids"]:
|
||||
await Catalog(self.db).input(input_id)
|
||||
snapshots = [await Catalog(self.db).input(input_id) for input_id in content["input_ids"]]
|
||||
provenance = {**(provenance or {}), "inputs": snapshots}
|
||||
if asset_id:
|
||||
if body.version is None:
|
||||
raise HTTPException(422, "更新需要素材版本")
|
||||
@@ -87,7 +87,12 @@ class Assets:
|
||||
self.db.add(ResearchAsset(id=asset_id, kind=body.kind, name=content["name"], version=version))
|
||||
await self.db.flush()
|
||||
self.db.add(
|
||||
ResearchRevision(asset_id=asset_id, version=version, content=content, provenance=provenance or {})
|
||||
ResearchRevision(
|
||||
asset_id=asset_id,
|
||||
version=version,
|
||||
content=content,
|
||||
provenance=jsonable_encoder(provenance or {}),
|
||||
)
|
||||
)
|
||||
await self.db.flush()
|
||||
return await self.get(asset_id, version)
|
||||
|
||||
Reference in New Issue
Block a user