catalogue operations, db migr and so on.
pre release version.
This commit is contained in:
11
misc/mapper.py
Normal file
11
misc/mapper.py
Normal file
@@ -0,0 +1,11 @@
|
||||
def parse_cat_id(value: str) -> int | None | bool:
|
||||
if value == "root":
|
||||
return None
|
||||
if str(value).isdigit():
|
||||
return int(value)
|
||||
|
||||
raise Exception("Invalid Category Id.")
|
||||
|
||||
|
||||
def serialize_cat_id(cat_id: int | None) -> str:
|
||||
return "root" if cat_id is None else str(cat_id)
|
||||
Reference in New Issue
Block a user