update admin settings in db
This commit is contained in:
parent
a72ed98997
commit
42a9af986a
2 changed files with 22 additions and 15 deletions
|
|
@ -6,17 +6,24 @@ from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
class UpdateAdminSettings(BaseModel):
|
class UpdateAdminSettings(BaseModel):
|
||||||
site_title: Optional[str]
|
# users
|
||||||
site_tagline: Optional[str]
|
admin_users: str = Query(None)
|
||||||
site_description: Optional[str]
|
allowed_users: str = Query(None)
|
||||||
allowed_users: Optional[str]
|
admin_ext: str = Query(None)
|
||||||
admin_users: Optional[str]
|
disabled_ext: str = Query(None)
|
||||||
default_wallet_name: Optional[str]
|
funding_source: str = Query(None)
|
||||||
data_folder: Optional[str]
|
# ops
|
||||||
disabled_ext: Optional[str]
|
force_https: bool = Query(None)
|
||||||
force_https: Optional[bool]
|
service_fee: float = Query(None, ge=0)
|
||||||
service_fee: Optional[float]
|
hide_api: bool = Query(None)
|
||||||
funding_source: Optional[str]
|
# Change theme
|
||||||
|
site_title: str = Query(None)
|
||||||
|
site_tagline: str = Query(None)
|
||||||
|
site_description: str = Query(None)
|
||||||
|
default_wallet_name: str = Query(None)
|
||||||
|
denomination: str = Query(None)
|
||||||
|
theme: str = Query(None)
|
||||||
|
ad_space: str = Query(None)
|
||||||
|
|
||||||
class Admin(BaseModel):
|
class Admin(BaseModel):
|
||||||
# users
|
# users
|
||||||
|
|
|
||||||
|
|
@ -12,16 +12,16 @@ from .crud import get_admin, update_admin, update_wallet_balance
|
||||||
|
|
||||||
|
|
||||||
@admin_ext.get("/api/v1/admin/{wallet_id}/{topup_amount}", status_code=HTTPStatus.OK)
|
@admin_ext.get("/api/v1/admin/{wallet_id}/{topup_amount}", status_code=HTTPStatus.OK)
|
||||||
async def api_update_balance(wallet_id, topup_amount, g: WalletTypeInfo = Depends(require_admin_key)):
|
async def api_update_balance(wallet_id, topup_amount: int, g: WalletTypeInfo = Depends(require_admin_key)):
|
||||||
print(g.wallet)
|
|
||||||
try:
|
try:
|
||||||
wallet = await get_wallet(wallet_id)
|
wallet = await get_wallet(wallet_id)
|
||||||
except:
|
except:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=HTTPStatus.FORBIDDEN, detail="Not allowed: not an admin"
|
status_code=HTTPStatus.FORBIDDEN, detail="Not allowed: not an admin"
|
||||||
)
|
)
|
||||||
print(wallet)
|
|
||||||
print(topup_amount)
|
await update_wallet_balance(wallet_id=wallet_id, amount=int(topup_amount))
|
||||||
|
|
||||||
return {"status": "Success"}
|
return {"status": "Success"}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue