13 lines
404 B
Python
13 lines
404 B
Python
import logging
|
|
from typing import Optional
|
|
from uuid import NAMESPACE_DNS, UUID, uuid5
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def generate_user_uuid5(email: str, shop_id: Optional[int]) -> UUID:
|
|
unique_string = f"{email}-{shop_id}" if shop_id else email
|
|
generated_uuid = uuid5(NAMESPACE_DNS, unique_string)
|
|
logger.debug("Generated user UUID5 - %s", generated_uuid)
|
|
return generated_uuid
|