feat: Add barcode_type field to the Card model and its WebSocket handlers for creation and updates.

This commit is contained in:
thekiwismarthome
2026-02-27 17:35:49 +13:00
parent d412764cba
commit 402881c687
2 changed files with 4 additions and 0 deletions
@@ -103,6 +103,7 @@ class LoyaltyCard:
name: str
number: str
barcode: str = ""
barcode_type: str = "barcode" # "barcode" or "qrcode"
logo: str = ""
notes: str = ""
color: str = "#9fa8da"
@@ -1094,6 +1094,7 @@ async def websocket_get_loyalty_cards(
vol.Required("name"): str,
vol.Required("number"): str,
vol.Optional("barcode", default=""): str,
vol.Optional("barcode_type", default="barcode"): str,
vol.Optional("logo", default=""): str,
vol.Optional("notes", default=""): str,
vol.Optional("color", default="#9fa8da"): str,
@@ -1115,6 +1116,7 @@ async def websocket_add_loyalty_card(
name=msg["name"],
number=msg["number"],
barcode=msg.get("barcode", ""),
barcode_type=msg.get("barcode_type", "barcode"),
logo=msg.get("logo", ""),
notes=msg.get("notes", ""),
color=msg.get("color", "#9fa8da"),
@@ -1128,6 +1130,7 @@ async def websocket_add_loyalty_card(
vol.Optional("name"): str,
vol.Optional("number"): str,
vol.Optional("barcode"): str,
vol.Optional("barcode_type"): str,
vol.Optional("logo"): str,
vol.Optional("notes"): str,
vol.Optional("color"): str,