pub async fn refresh_swag_inventory_items() {
    let db = Database::new();

    // Get gsuite token.
    let token = get_gsuite_token("").await;

    // Initialize the Google Drive client.
    let drive_client = GoogleDrive::new(token);

    // Get all the records from Airtable.
    let results: Vec<airtable_api::Record<SwagInventoryItem>> = SwagInventoryItem::airtable().list_records(&SwagInventoryItem::airtable_table(), "Grid view", vec![]).await.unwrap();
    for inventory_item_record in results {
        let mut inventory_item: NewSwagInventoryItem = inventory_item_record.fields.into();
        inventory_item.expand(&drive_client).await;

        let mut db_inventory_item = inventory_item.upsert_in_db(&db);
        db_inventory_item.airtable_record_id = inventory_item_record.id.to_string();
        db_inventory_item.update(&db).await;
    }
}
/// Sync swag inventory items from Airtable.
Sync swag inventory items from Airtable.
Sync swag inventory items from Airtable .
pub async fn refresh_swag_inventory_items() {
    let db = Database::new();
    // Get gsuite token.
    let token = get_gsuite_token("").await;
    // Initialize the Google Drive client.
    let drive_client = GoogleDrive::new(token);
    // Get all the records from Airtable.
    let results: Vec<airtable_api::Record<SwagInventoryItem>> = SwagInventoryItem::airtable().list_records(&SwagInventoryItem::airtable_table(), "Grid view", vec![]).await.unwrap();
    for inventory_item_record in results {
        let mut inventory_item: NewSwagInventoryItem = inventory_item_record.fields.into();
        inventory_item.expand(&drive_client).await;
        let mut db_inventory_item = inventory_item.upsert_in_db(&db);
        db_inventory_item.airtable_record_id = inventory_item_record.id.to_string();
        db_inventory_item.update(&db).await;
    }
}
pub async fn refresh_swag_inventory_items ( ) { let db = Database :: new ( ) ; // Get gsuite token. let token = get_gsuite_token ( " " ) . await ; // Initialize the Google Drive client. let drive_client = GoogleDrive :: new ( token ) ; // Get all the records from Airtable. let results : Vec < airtable_api :: Record < SwagInventoryItem > > = SwagInventoryItem :: airtable ( ) . list_records ( & SwagInventoryItem :: airtable_table ( ) , " " , vec ! [ ] ) . await . unwrap ( ) ; for inventory_item_record in results { let mut inventory_item : NewSwagInventoryItem = inventory_item_record . fields . into ( ) ; inventory_item . expand ( & drive_client ) . await ; let mut db_inventory_item = inventory_item . upsert_in_db ( & db ) ; db_inventory_item . airtable_record_id = inventory_item_record . id . to_string ( ) ; db_inventory_item . update ( & db ) . await ; } }
Sync swag inventory items from Airtable.
Sync swag inventory items from Airtable .