First commite
This commit is contained in:
30
cv/services/dowload/base.py
Normal file
30
cv/services/dowload/base.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from io import BytesIO
|
||||
from typing import Any, Dict, Protocol
|
||||
|
||||
|
||||
class ProfileSerializer:
|
||||
"""Сериализатор данных профиля для рендереров."""
|
||||
|
||||
def serialize(self, profile) -> Dict[str, Any]:
|
||||
return {
|
||||
"full_name": profile.full_name,
|
||||
"role": getattr(profile, "role", ""),
|
||||
"summary": getattr(profile, "summary", ""),
|
||||
"location": getattr(profile, "location", ""),
|
||||
"languages": getattr(profile, "languages", []) or [],
|
||||
"contacts": {
|
||||
"email": getattr(profile, "email", ""),
|
||||
"phone": getattr(profile, "phone", ""),
|
||||
"telegram": getattr(profile, "telegram", ""),
|
||||
},
|
||||
"experience": list(profile.experience.all()),
|
||||
"skills_map": list(profile.skills_map.all()),
|
||||
}
|
||||
|
||||
|
||||
class Renderer(Protocol):
|
||||
def render(self, profile) -> BytesIO: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user