update
This commit is contained in:
parent
91a6c880b4
commit
3b92608523
@ -72,6 +72,31 @@ async def tryon(
|
|||||||
else:
|
else:
|
||||||
return StandardResponse(code=500, message="试穿任务提交失败")
|
return StandardResponse(code=500, message="试穿任务提交失败")
|
||||||
|
|
||||||
|
@router.get("/histories/all", tags=["tryon"])
|
||||||
|
async def get_all_tryon_histories(
|
||||||
|
db: AsyncSession = Depends(deps.get_db)
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
获取所有试穿历史
|
||||||
|
"""
|
||||||
|
histories = await db.execute(select(TryonHistory).where(TryonHistory.status == TryonStatus.COMPLETED).order_by(TryonHistory.create_time.desc()))
|
||||||
|
tryon_histories = histories.scalars().all()
|
||||||
|
|
||||||
|
result = []
|
||||||
|
for history in tryon_histories:
|
||||||
|
item = {
|
||||||
|
"id": history.id,
|
||||||
|
"person_image_url": history.person_image_url,
|
||||||
|
"top_clothing_url": history.top_clothing_url,
|
||||||
|
"bottom_clothing_url": history.bottom_clothing_url,
|
||||||
|
"completion_url": history.completion_url,
|
||||||
|
"comment": history.comment,
|
||||||
|
"score": history.score,
|
||||||
|
"create_time": history.create_time,
|
||||||
|
}
|
||||||
|
result.append(item)
|
||||||
|
return StandardResponse(code=200, message="试穿历史获取成功", data=result)
|
||||||
|
|
||||||
@router.get("/histories", tags=["tryon"])
|
@router.get("/histories", tags=["tryon"])
|
||||||
async def get_tryon_histories(
|
async def get_tryon_histories(
|
||||||
db: AsyncSession = Depends(deps.get_db),
|
db: AsyncSession = Depends(deps.get_db),
|
||||||
@ -95,6 +120,9 @@ async def get_tryon_histories(
|
|||||||
"status": history.status,
|
"status": history.status,
|
||||||
"task_id": history.task_id,
|
"task_id": history.task_id,
|
||||||
"completion_url": history.completion_url,
|
"completion_url": history.completion_url,
|
||||||
|
"comment": history.comment,
|
||||||
|
"score": history.score,
|
||||||
|
"create_time": history.create_time,
|
||||||
}
|
}
|
||||||
result.append(item)
|
result.append(item)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user