Files
Aegis/backend/app/infrastructure/persistence/mappers/technique_mapper.py

21 lines
677 B
Python

"""Technique ORM model <-> domain entity mapper."""
from __future__ import annotations
from app.domain.entities.technique import TechniqueEntity
from app.domain.enums import TechniqueStatus
class TechniqueMapper:
"""Converts between SQLAlchemy Technique model and TechniqueEntity."""
@staticmethod
def to_entity(model: object) -> TechniqueEntity:
"""Convert an ORM Technique model to a domain TechniqueEntity."""
return TechniqueEntity.from_orm(model)
@staticmethod
def to_model_updates(entity: TechniqueEntity, model: object) -> None:
"""Apply entity changes back onto an existing ORM model."""
entity.apply_to(model)