import strawberry from api.models import UserModel @strawberry.type class User: id: int name: str @classmethod def from_instance(cls, instance: UserModel): return cls(id=instance.id, name=instance.name)