25 lines
676 B
Python
25 lines
676 B
Python
from datetime import datetime
|
|
from typing import Dict, Optional
|
|
from models import UserEntity
|
|
|
|
|
|
class UserMapper:
|
|
@staticmethod
|
|
def from_google_payload(
|
|
google_id: str, email: str, payload: Dict[str, Optional[str]]
|
|
) -> UserEntity:
|
|
return UserEntity(
|
|
google_id=google_id,
|
|
email=email,
|
|
name=payload.get("name"),
|
|
pic_url=payload.get("picture"),
|
|
birth_date=None,
|
|
phone=None,
|
|
role="user",
|
|
is_active=True,
|
|
address=None,
|
|
created_at=datetime.now(),
|
|
updated_at=datetime.now(),
|
|
verification_token=None,
|
|
)
|