Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
748 B
2
Indexable
from sqlalchemy.orm import Session
from typing import List
from app.models.content import Content
from app.graphql.types.content_type import ContentType
from app.graphql.schema import Info

async def get_quick_links(self, info: Info) -> List[ContentType]:
       session: Session = info.context.session
       # Ensure this matches the field name in the SQLAlchemy model
       quick_links = session.query(Content).filter_by(type="Quick Links").all()
       return [ContentType(
           id=item.id,
           type=item.type,
           text=item.text,
           link=item.link,
           order=item.order,
           created_date=item.created_date,
           updated_date=item.updated_date
       ) for item in quick_links]
Leave a Comment