async def get_with_messages(
        self, db: AsyncSession, id: UUID, current_user: schemas.User
    ) -> Optional[schemas.Chat]:
        """Get a chat by ID including its messages.

        Args:
            db (AsyncSession): The database session
            id (UUID): The chat ID
            current_user (schemas.User): The current user

        Returns:
            Optional[Chat]: The chat with messages
        """
        stmt = select(Chat).where(Chat.id == id)
        result = await db.execute(stmt)
        chat = result.unique().scalar_one_or_none()

        if chat:
            self._validate_if_user_has_permission(chat, current_user)

        return chat
Get a chat by ID including its messages.

        Args:
            db (AsyncSession): The database session
            id (UUID): The chat ID
            current_user (schemas.User): The current user

        Returns:
            Optional[Chat]: The chat with messages
        
backend/airweave/crud/crud_chat.py