add_action( 'mylisting/submission/save-listing-data', function( $listing_id, $fields ){
    $listing = \MyListing\Src\Listing::force_get( $listing_id );
    if ( ! $listing ) {
         return;
     }
 
    if ( ! $fields['job_gallery'] || empty( $fields['job_gallery']['value'] ) ) {
     return;
    }
 
    global $wpdb;
    $attachment = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid='%s';", $fields['job_gallery']['value'][0] ));
    set_post_thumbnail( $listing_id, $attachment[0] );
}, 10e4, 2 );