Show messages when imports succeed.
This commit is contained in:
@ -136,6 +136,7 @@ pub(crate) async fn import_reminders(
|
||||
match base64::decode(&body.body) {
|
||||
Ok(body) => {
|
||||
let mut reader = csv::Reader::from_reader(body.as_slice());
|
||||
let mut count = 0;
|
||||
|
||||
for result in reader.deserialize::<ReminderCsv>() {
|
||||
match result {
|
||||
@ -184,6 +185,8 @@ pub(crate) async fn import_reminders(
|
||||
reminder,
|
||||
)
|
||||
.await?;
|
||||
|
||||
count += 1;
|
||||
}
|
||||
|
||||
Err(_) => {
|
||||
@ -204,7 +207,9 @@ pub(crate) async fn import_reminders(
|
||||
}
|
||||
|
||||
match transaction.commit().await {
|
||||
Ok(_) => Ok(json!({})),
|
||||
Ok(_) => Ok(json!({
|
||||
"message": format!("Imported {} reminders", count)
|
||||
})),
|
||||
|
||||
Err(e) => {
|
||||
warn!("Failed to commit transaction: {:?}", e);
|
||||
|
Reference in New Issue
Block a user