This commit is contained in:
benarc
2021-11-12 04:14:55 +00:00
parent 860709f48c
commit 267dea4f75
61 changed files with 23219 additions and 13297 deletions
@@ -10,6 +10,7 @@ class Target(BaseModel):
percent: int
alias: Optional[str]
class TargetPutList(BaseModel):
wallet: str = Query(...)
alias: str = Query("")
+8 -5
View File
@@ -38,8 +38,7 @@ async def api_targets_set(
if wallet.id == wal.wallet.id:
raise HTTPException(
status_code=HTTPStatus.BAD_REQUEST,
detail="Can't split to itself.",
status_code=HTTPStatus.BAD_REQUEST, detail="Can't split to itself."
)
if entry.percent < 0:
@@ -49,14 +48,18 @@ async def api_targets_set(
)
targets.append(
Target(wallet=wallet.id, source=wal.wallet.id, percent=entry.percent, alias=entry.alias)
Target(
wallet=wallet.id,
source=wal.wallet.id,
percent=entry.percent,
alias=entry.alias,
)
)
percent_sum = sum([target.percent for target in targets])
if percent_sum > 100:
raise HTTPException(
status_code=HTTPStatus.BAD_REQUEST,
detail="Splitting over 100%.",
status_code=HTTPStatus.BAD_REQUEST, detail="Splitting over 100%."
)
await set_targets(wal.wallet.id, targets)