Add files via upload
This commit is contained in:
commit
ed083e4268
13 changed files with 833 additions and 0 deletions
28
models.py
Normal file
28
models.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
from sqlite3 import Row
|
||||
from typing import List, Optional
|
||||
|
||||
from fastapi import Query
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class Target(BaseModel):
|
||||
wallet: str
|
||||
source: str
|
||||
percent: float
|
||||
tag: str
|
||||
alias: Optional[str]
|
||||
|
||||
@classmethod
|
||||
def from_row(cls, row: Row):
|
||||
return cls(**dict(row))
|
||||
|
||||
|
||||
class TargetPutList(BaseModel):
|
||||
wallet: str = Query(...)
|
||||
alias: str = Query("")
|
||||
percent: float = Query(..., ge=0, lt=100)
|
||||
tag: str
|
||||
|
||||
|
||||
class TargetPut(BaseModel):
|
||||
__root__: List[TargetPutList]
|
||||
Loading…
Add table
Add a link
Reference in a new issue