Revert "proposal to allow decimal valued items in fiat"

This reverts commit e58a6923fc.
This commit is contained in:
Tiago vasconcelos
2021-10-25 18:42:36 +01:00
parent ee30950b97
commit 0125c07c6b
5 changed files with 22 additions and 33 deletions
+4 -9
View File
@@ -27,7 +27,7 @@ from .models import ShopCounter
@offlineshop_ext.get("/api/v1/currencies")
async def api_list_currencies_available():
return list(currencies.keys())
return json.dumps(list(currencies.keys()))
@offlineshop_ext.get("/api/v1/offlineshop")
@@ -37,12 +37,7 @@ async def api_shop_from_wallet(
):
shop = await get_or_create_shop_by_wallet(wallet.wallet.id)
items = await get_items(shop.id)
#revert millicents to unit
for item in items:
if item.unit != 'sat':
item.price = item.price / 1000
try:
return {
**shop.dict(),
@@ -65,11 +60,11 @@ class CreateItemsData(BaseModel):
@offlineshop_ext.post("/api/v1/offlineshop/items")
@offlineshop_ext.put("/api/v1/offlineshop/items/{item_id}")
# @api_check_wallet_key("invoice")
async def api_add_or_update_item(
data: CreateItemsData, item_id=None, wallet: WalletTypeInfo = Depends(get_key_type)
):
shop = await get_or_create_shop_by_wallet(wallet.wallet.id)
shop = await get_or_create_shop_by_wallet(wallet.wallet.id)
if item_id == None:
await add_item(
shop.id, data.name, data.description, data.image, data.price, data.unit