14 lines
231 B
Python
14 lines
231 B
Python
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)
|