Make inventory items more dynamic

This commit is contained in:
2026-08-27 01:31:10 +03:00
parent 0c195eca1b
commit 100c0797a4
3 changed files with 145 additions and 2 deletions
+10 -1
View File
@@ -221,7 +221,7 @@ def clean(value):
def item_payload(data):
return {
payload = {
"name": clean(data.get("name")),
"item_type": clean(data.get("item_type")),
"brand": clean(data.get("brand")),
@@ -240,6 +240,15 @@ def item_payload(data):
"storage": clean(data.get("storage")),
"media_format": clean(data.get("media_format")),
}
if payload["item_type"] != "Computer":
payload["cpu"] = ""
payload["ram"] = ""
if payload["item_type"] not in {"Computer", "Graphics"}:
payload["gpu"] = ""
payload["storage"] = ""
if payload["item_type"] not in {"CD", "Long play disk", "Audio"}:
payload["media_format"] = ""
return payload
def serialize(row, connection):