Use a context struct
This commit is contained in:
parent
60208331ba
commit
a0d9bfa97b
10 changed files with 134 additions and 45 deletions
|
@ -10,17 +10,14 @@ use vcard4::{
|
|||
};
|
||||
|
||||
use crate::{
|
||||
context::Context,
|
||||
types::{PersonResponseDto, PersonUpdateDto},
|
||||
utils::people::fetch_all_contacts,
|
||||
Client,
|
||||
};
|
||||
|
||||
pub async fn sync_date_of_birth(
|
||||
client: &Client,
|
||||
vcard_file: &PathBuf,
|
||||
dry_run: bool,
|
||||
) -> Result<()> {
|
||||
let server_contacts = fetch_all_contacts(client).await?;
|
||||
pub async fn sync_date_of_birth(ctx: Context, vcard_file: &PathBuf) -> Result<()> {
|
||||
let server_contacts = fetch_all_contacts(&ctx.client).await?;
|
||||
|
||||
let filtered_contacts: Vec<_> = server_contacts
|
||||
.iter()
|
||||
|
@ -55,7 +52,7 @@ pub async fn sync_date_of_birth(
|
|||
formatted_name
|
||||
);
|
||||
} else if bday.year() > 0 {
|
||||
update_person_bday(c, bday, client, dry_run).await?;
|
||||
update_person_bday(c, bday, &ctx.client, ctx.dry_run).await?;
|
||||
updated_dobs += 1;
|
||||
} else {
|
||||
debug!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue