async def update_source_connection(
        self,
        db: AsyncSession,
        source_connection_id: UUID,
        source_connection_in: schemas.SourceConnectionUpdate,
        current_user: schemas.User,
    ) -> schemas.SourceConnection:
        """Update a source connection and related objects.

        This method:
        1. Updates the source connection
        2. Updates the sync cron schedule if changed
        3. Updates the auth fields in the integration credential if provided

        Args:
            db: The database session
            source_connection_id: The ID of the source connection to update
            source_connection_in: The updated source connection data
            current_user: The current user

        Returns:
            The updated source connection

        Raises:
            HTTPException: If the source connection is not found
        """
        source_connection = await crud.source_connection.get(
            db=db, id=source_connection_id, current_user=current_user
        )
        if not source_connection:
            raise HTTPException(status_code=404, detail="Source connection not found")

        async with UnitOfWork(db) as uow:
            # Validate config fields if they're being updated
            if source_connection_in.config_fields is not None:
                validated_config_fields = await self._validate_config_fields(
                    uow.session,
                    source_connection.short_name,
                    (
                        source_connection_in.config_fields.model_dump()
                        if hasattr(source_connection_in.config_fields, "model_dump")
                        else source_connection_in.config_fields
                    ),
                )
                source_connection_in.config_fields = validated_config_fields

            # 1. Update source connection
            source_connection = await crud.source_connection.update(
                db=uow.session,
                db_obj=source_connection,
                obj_in=source_connection_in,
                current_user=current_user,
                uow=uow,
            )

            # 2. If cron_schedule was updated, also update the related sync
            if source_connection_in.cron_schedule is not None and source_connection.sync_id:
                sync = await crud.sync.get(
                    uow.session,
                    id=source_connection.sync_id,
                    current_user=current_user,
                    with_connections=False,
                )
                if sync:
                    sync_update = schemas.SyncUpdate(
                        cron_schedule=source_connection_in.cron_schedule
                    )
                    await crud.sync.update(
                        uow.session,
                        db_obj=sync,
                        obj_in=sync_update,
                        current_user=current_user,
                        uow=uow,
                    )

            # 3. If auth_fields are provided, update the integration credential
            if source_connection_in.auth_fields and source_connection.connection_id:
                # First get the connection to get the credential ID
                connection = await crud.connection.get(
                    uow.session, id=source_connection.connection_id, current_user=current_user
                )

                if connection and connection.integration_credential_id:
                    # Get the credential and update it
                    integration_credential = await crud.integration_credential.get(
                        uow.session,
                        id=connection.integration_credential_id,
                        current_user=current_user,
                    )

                    if integration_credential:
                        auth_fields_dict = source_connection_in.auth_fields.model_dump()
                        validated_auth_fields = await self._validate_auth_fields(
                            uow.session,
                            source_connection.short_name,
                            auth_fields_dict,
                        )
                        credential_update = schemas.IntegrationCredentialUpdate(
                            encrypted_credentials=credentials.encrypt(validated_auth_fields)
                        )
                        await crud.integration_credential.update(
                            uow.session,
                            db_obj=integration_credential,
                            obj_in=credential_update,
                            current_user=current_user,
                            uow=uow,
                        )

            await uow.commit()

            # Get the updated source connection with related data
            return await self.get_source_connection(
                db=uow.session, source_connection_id=source_connection_id, current_user=current_user
            )
Update a source connection and related objects.

        This method:
        1. Updates the source connection
        2. Updates the sync cron schedule if changed
        3. Updates the auth fields in the integration credential if provided

        Args:
            db: The database session
            source_connection_id: The ID of the source connection to update
            source_connection_in: The updated source connection data
            current_user: The current user

        Returns:
            The updated source connection

        Raises:
            HTTPException: If the source connection is not found
        
backend/airweave/core/source_connection_service.py