Skip to content

Commit

Permalink
Merge pull request #361 from planetarium/bugfix/mileage-schema
Browse files Browse the repository at this point in the history
Re-use planet into mileage schema
  • Loading branch information
U-lis authored Dec 17, 2024
2 parents f433915 + be34b41 commit d63cd25
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion iap/api/mileage.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@

@router.get("", response_model=MileageSchema)
def get_mileage(agent_addr: str, planet_id: str, sess: Session = Depends(session)):
return get_mileage_fn(sess, PlanetID(bytes(planet_id, "utf-8")), agent_addr)
mileage = get_mileage_fn(sess, agent_addr)
schema = MileageSchema(**mileage.__dict__, planet_id=PlanetID(bytes(planet_id, "utf-8")))
return schema
1 change: 1 addition & 0 deletions iap/schemas/mileage.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def __post_init__(self):

class MileageSchema(BaseSchema):
id: int
planet_id: PlanetID
agent_addr: str
mileage: int

Expand Down

0 comments on commit d63cd25

Please sign in to comment.