fix(douyu): 修复供给目标缺少 target_id
This commit is contained in:
@@ -218,8 +218,10 @@ def test_supply_target_configuration_route_returns_inventory(db):
|
|||||||
listed = list_supply_targets(db=db, current=user)
|
listed = list_supply_targets(db=db, current=user)
|
||||||
|
|
||||||
assert created.id > 0
|
assert created.id > 0
|
||||||
|
assert created.target_id == created.id
|
||||||
assert created.covered_shortage == 12
|
assert created.covered_shortage == 12
|
||||||
assert listed[0].id == created.id
|
assert listed[0].id == created.id
|
||||||
|
assert listed[0].target_id == created.id
|
||||||
assert listed[0].needs_replenishment is True
|
assert listed[0].needs_replenishment is True
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -698,6 +698,7 @@ def _supply_target_out(
|
|||||||
inventory = evaluate_supply_target(db, target)
|
inventory = evaluate_supply_target(db, target)
|
||||||
return DouyuSupplyTargetOut(
|
return DouyuSupplyTargetOut(
|
||||||
id=int(target.id),
|
id=int(target.id),
|
||||||
|
target_id=int(target.id),
|
||||||
platform=target.platform,
|
platform=target.platform,
|
||||||
scope=target.scope,
|
scope=target.scope,
|
||||||
commodity_id=target.commodity_id,
|
commodity_id=target.commodity_id,
|
||||||
|
|||||||
@@ -1603,6 +1603,8 @@ class DouyuSupplyTargetUpdate(BaseModel):
|
|||||||
|
|
||||||
class DouyuSupplyTargetOut(BaseModel):
|
class DouyuSupplyTargetOut(BaseModel):
|
||||||
id: int
|
id: int
|
||||||
|
# 2026-11-22:平台状态接口使用 target_id,配置列表使用 id;同时返回兼容两者。
|
||||||
|
target_id: int
|
||||||
platform: str
|
platform: str
|
||||||
scope: str
|
scope: str
|
||||||
commodity_id: str
|
commodity_id: str
|
||||||
|
|||||||
Reference in New Issue
Block a user