tuwunel_admin/media/
delete_range.rs1use tuwunel_core::{Err, Result, utils::time::parse_timepoint_ago};
2
3use crate::admin_command;
4
5#[admin_command]
6pub(super) async fn delete_range(
7 &self,
8 duration: String,
9 older_than: bool,
10 newer_than: bool,
11 yes_i_want_to_delete_local_media: bool,
12) -> Result {
13 if older_than == newer_than {
14 return Err!("Please pick only one of --older_than or --newer_than.",);
15 }
16
17 let duration = parse_timepoint_ago(&duration)?;
18 let deleted_count = self
19 .services
20 .media
21 .delete_range(duration, older_than, newer_than, yes_i_want_to_delete_local_media)
22 .await?;
23
24 write!(self, "Deleted {deleted_count} total files.").await
25}