API - workouts refactoring
This commit is contained in:
17
fittrackee/workouts/utils/short_id.py
Normal file
17
fittrackee/workouts/utils/short_id.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from uuid import UUID
|
||||
|
||||
import shortuuid
|
||||
|
||||
|
||||
def encode_uuid(uuid_value: UUID) -> str:
|
||||
"""
|
||||
Return short id string from a UUID
|
||||
"""
|
||||
return shortuuid.encode(uuid_value)
|
||||
|
||||
|
||||
def decode_short_id(short_id: str) -> UUID:
|
||||
"""
|
||||
Return UUID from a short id string
|
||||
"""
|
||||
return shortuuid.decode(short_id)
|
||||
Reference in New Issue
Block a user