From 7287390e0398570961fd998652bd180d6fb13b78 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Tue, 20 Sep 2022 15:53:16 +0200 Subject: Run clippy + add doc --- src/models/model.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/models/model.rs') diff --git a/src/models/model.rs b/src/models/model.rs index 80eb5ad..6b7c166 100644 --- a/src/models/model.rs +++ b/src/models/model.rs @@ -194,6 +194,7 @@ impl Model { } impl ModelUser { + /// Returns the author id from the `JsonValue` pub fn author_id(&self) -> JsonValue { match &self.author { Some(json) => json.get("id").unwrap().clone(), @@ -201,10 +202,10 @@ impl ModelUser { } } - pub async fn upload_paths(&self) -> Option> { - if self.uploads.is_none() { - return None; - } + /// Returns a vec of string made by all the filepaths from the model + pub async fn list_upload_filepaths(&self) -> Option> { + // Raise a `None` if `self.uploads` is `None` + self.uploads.as_ref()?; let uploads = ModelUpload::find_by_model(self.id) .await @@ -215,7 +216,7 @@ impl ModelUser { .map(|x| x.filepath.clone()) .collect::>(); - return Some(paths); + Some(paths) } } -- cgit v1.2.3-71-g8e6c