Add ID type for filters
This commit is contained in:
parent
9f4327f546
commit
c5f199b460
|
@ -35,7 +35,7 @@ use time::{serde::iso8601, OffsetDateTime};
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
pub struct Filter {
|
pub struct Filter {
|
||||||
/// The ID of the Filter in the database.
|
/// The ID of the Filter in the database.
|
||||||
pub id: String,
|
pub id: FilterId,
|
||||||
/// A title given by the user to name the filter.
|
/// A title given by the user to name the filter.
|
||||||
pub title: String,
|
pub title: String,
|
||||||
/// The contexts in which the filter should be applied.
|
/// The contexts in which the filter should be applied.
|
||||||
|
@ -51,6 +51,17 @@ pub struct Filter {
|
||||||
pub statuses: Vec<Status>,
|
pub statuses: Vec<Status>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Wrapper type for a filter ID string
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
|
#[serde(transparent)]
|
||||||
|
pub struct FilterId(String);
|
||||||
|
|
||||||
|
impl AsRef<str> for FilterId {
|
||||||
|
fn as_ref(&self) -> &str {
|
||||||
|
&self.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Represents the various types of Filter contexts
|
/// Represents the various types of Filter contexts
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
|
|
Loading…
Reference in New Issue