aboutsummaryrefslogtreecommitdiff
path: root/common/src
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-08-07 11:10:10 +0200
committermetamuffin <metamuffin@disroot.org>2023-08-07 11:59:59 +0200
commitdc7ed1ccaa5e727b3ab0569fd7fe56a2d0084bd5 (patch)
treeeb724ec5c0de92abef03549365eba01e07c06d90 /common/src
parent55eba6fdc6742d2850d003059220284bace059fc (diff)
downloadjellything-dc7ed1ccaa5e727b3ab0569fd7fe56a2d0084bd5.tar
jellything-dc7ed1ccaa5e727b3ab0569fd7fe56a2d0084bd5.tar.bz2
jellything-dc7ed1ccaa5e727b3ab0569fd7fe56a2d0084bd5.tar.zst
node sort ui
Diffstat (limited to 'common/src')
-rw-r--r--common/src/impl.rs8
-rw-r--r--common/src/lib.rs21
2 files changed, 13 insertions, 16 deletions
diff --git a/common/src/impl.rs b/common/src/impl.rs
index d7759af..55364ab 100644
--- a/common/src/impl.rs
+++ b/common/src/impl.rs
@@ -3,7 +3,7 @@
which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
Copyright (C) 2023 metamuffin <metamuffin.org>
*/
-use crate::{NodeKind, SourceTrack, SourceTrackKind};
+use crate::{SourceTrack, SourceTrackKind};
impl SourceTrackKind {
pub fn letter(&self) -> char {
@@ -34,9 +34,3 @@ impl std::fmt::Display for SourceTrack {
))
}
}
-
-impl Default for NodeKind {
- fn default() -> Self {
- Self::Collection
- }
-}
diff --git a/common/src/lib.rs b/common/src/lib.rs
index a96df9e..9d5a31e 100644
--- a/common/src/lib.rs
+++ b/common/src/lib.rs
@@ -7,6 +7,7 @@ pub mod config;
pub mod r#impl;
use bincode::{Decode, Encode};
+use rocket::{FromFormField, UriDisplayQuery};
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
@@ -57,17 +58,19 @@ pub enum AssetLocation {
Assets(PathBuf),
}
-#[derive(Debug, Clone, Deserialize, Serialize)]
+#[rustfmt::skip]
+#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, Default)]
+#[cfg_attr(feature = "rocket", derive(FromFormField, UriDisplayQuery))]
#[serde(rename_all = "snake_case")]
pub enum NodeKind {
- Movie,
- Video,
- Collection,
- Channel,
- Show,
- Series,
- Season,
- Episode,
+ #[cfg_attr(feature = "rocket", field(value = "movie"))] #[default] Movie,
+ #[cfg_attr(feature = "rocket", field(value = "video"))] Video,
+ #[cfg_attr(feature = "rocket", field(value = "collection"))] Collection,
+ #[cfg_attr(feature = "rocket", field(value = "channel"))] Channel,
+ #[cfg_attr(feature = "rocket", field(value = "show"))] Show,
+ #[cfg_attr(feature = "rocket", field(value = "series"))] Series,
+ #[cfg_attr(feature = "rocket", field(value = "season"))] Season,
+ #[cfg_attr(feature = "rocket", field(value = "episode"))] Episode,
}
#[derive(Debug, Clone, Deserialize, Serialize)]