feat: add asset ID history API
This commit is contained in:
1 parent
a87ab2709f
commit
d738b8e27e
6 files changed
+254
-9
No files matched your search
@@ -13,6 +13,7 @@ from app.inventory.exceptions import (
|
||||
MinerNotFound,
|
||||
)
|
||||
from app.inventory.models import (
|
||||
InventoryAssetIDHistoryResponse,
|
||||
InventoryCreateRequest,
|
||||
InventoryListMeta,
|
||||
InventoryMetadataUpdateRequest,
|
||||
@@ -120,6 +121,27 @@ def list_inventory_miners(
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/{miner_id}/asset-id-history",
|
||||
response_model=InventoryAssetIDHistoryResponse,
|
||||
)
|
||||
def get_inventory_miner_asset_id_history(
|
||||
miner_id: UUID,
|
||||
service: InventoryServiceDependency,
|
||||
current_user: InventoryReadUser,
|
||||
) -> InventoryAssetIDHistoryResponse:
|
||||
del current_user
|
||||
try:
|
||||
history = service.get_asset_id_history(miner_id)
|
||||
except MinerNotFound as exc:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_404_NOT_FOUND,
|
||||
detail="Miner not found",
|
||||
) from exc
|
||||
|
||||
return InventoryAssetIDHistoryResponse(data=history)
|
||||
|
||||
|
||||
@router.get("/{miner_id}", response_model=InventoryMinerDetailResponse)
|
||||
def get_inventory_miner(
|
||||
miner_id: UUID,
|
||||
|
||||
Reference in new issue
Block a user