Gets the configured storage path for document files. The storage path determines where document files (like PDFs) will be saved when downloaded through the system. This path is stored in the database configuration and can be modified using [`Database::set_storage_path()`]. # Returns Returns a `Result` containing either: - The configured [`PathBuf`] for document storage - A [`LearnerError`] if t
(&self)
| 174 | /// # } |
| 175 | /// ``` |
| 176 | pub async fn get_storage_path(&self) -> Result<PathBuf> { |
| 177 | Ok( |
| 178 | self |
| 179 | .conn |
| 180 | .call(|conn| { |
| 181 | Ok( |
| 182 | conn |
| 183 | .prepare_cached("SELECT value FROM config WHERE key = 'storage_path'")? |
| 184 | .query_row([], |row| Ok(PathBuf::from(row.get::<_, String>(0)?)))?, |
| 185 | ) |
| 186 | }) |
| 187 | .await?, |
| 188 | ) |
| 189 | } |
| 190 | |
| 191 | /// Sets the storage path for document files, validating that the path is usable. |
| 192 | /// |
no outgoing calls