Add a command dumping missing date of births

This commit is contained in:
Marc Plano-Lesay 2024-10-28 15:27:35 +11:00
parent bc09979a62
commit dfac23a225
7 changed files with 47 additions and 17 deletions

View file

@ -11,6 +11,7 @@ use vcard4::{
use crate::{
types::{PersonResponseDto, PersonUpdateDto},
utils::people::fetch_all_contacts,
Client,
};
@ -118,20 +119,3 @@ async fn update_person_bday(
Ok(())
}
async fn fetch_all_contacts(client: &Client) -> Result<Vec<PersonResponseDto>> {
let mut all_people = Vec::new();
let mut page_number = 1;
let mut has_next_page = true;
while has_next_page {
let fetched = client
.get_all_people(Some(page_number.into()), None, Some(true))
.await?;
all_people.extend(fetched.people.clone());
has_next_page = fetched.has_next_page.expect("Missing has_next_page");
page_number += 1;
}
Ok(all_people)
}