Skip to main content

paperless_api/metadata/
storage_path.rs

1//! Types related to storage paths.
2
3use serde::{Deserialize, Serialize};
4
5use paperless_api_macros::{CreateDto, Item, UpdateDto};
6
7use super::MatchAlgorithm;
8use super::permission::ItemPermissions;
9
10/// A storage path.
11#[derive(Debug, Clone, Deserialize, Serialize, CreateDto, UpdateDto, Item)]
12pub struct StoragePath {
13    /// Unique identifier of the storage path.
14    #[dto(skip)]
15    pub id: crate::id::StoragePathId,
16
17    /// Slug of the storage path.
18    #[dto(skip)]
19    pub slug: String,
20
21    /// Name of the storage path.
22    pub name: String,
23    pub path: String,
24
25    /// Matching pattern for the storage path.
26    #[serde(rename = "match")]
27    pub match_pattern: Option<String>,
28
29    /// Matching algorithm for the storage path.
30    pub matching_algorithm: MatchAlgorithm,
31
32    /// Whether the storage path matching is case-insensitive.
33    pub is_insensitive: bool,
34
35    /// The number of documents associated with this storage path.
36    #[dto(skip)]
37    #[serde(default)]
38    pub document_count: u32,
39
40    /// The user who owns this storage path, if any.
41    pub owner: Option<crate::id::UserId>,
42
43    /// The permissions for this storage path.
44    #[dto(skip)]
45    #[serde(flatten)]
46    pub permissions: ItemPermissions,
47}