Untitled
Anonymous
plain_text
10/10/2024 12:34 PM
1.2 KB
16
Indexable
from datetime import datetime
from typing import Optional
from strawberry import ID, Parent, field, type
from app.graphql.schema import Info
from app.models import User
from .relay_types import Connection, Edge, PageInfo, paginate
@type(name="User")
class UserType:
id: ID
login: str
user_app_status: str
first_name: str
last_name: str
email: str
grp_typ_cd: str
active: str
created_date: datetime
created_by_id: str
updated_date: datetime
updated_by_id: str
@field
@staticmethod
async def created_by(info: Info, parent: Parent["User"]) -> Optional["UserType"]:
return await info.context.load_user_by_login.load(parent.created_by_id)
@field
@staticmethod
async def updated_by(info: Info, parent: Parent["User"]) -> Optional["UserType"]:
return await info.context.load_user_by_login.load(parent.updated_by_id)Editor is loading...
Leave a Comment