1- use rusqlite:: { types:: { FromSql , FromSqlError , FromSqlResult , ToSqlOutput , ValueRef } , ToSql } ;
1+ use rusqlite:: {
2+ types:: { FromSql , FromSqlError , FromSqlResult , ToSqlOutput , ValueRef } ,
3+ ToSql ,
4+ } ;
25use serde:: { Deserialize , Serialize } ;
36use strum_macros:: { Display , EnumString } ;
47
58use super :: ElementAction ;
69
7-
810#[ derive( Debug , Serialize , Deserialize , Clone , Default ) ]
911pub struct ServerLibrary {
1012 pub id : String ,
11- pub name : String ,
12- pub source : String ,
13+ pub name : String ,
14+ pub source : String ,
1315 pub root : Option < String > ,
1416 #[ serde( rename = "type" ) ]
1517 pub kind : LibraryType ,
@@ -22,19 +24,17 @@ pub struct ServerLibrary {
2224 pub hidden : bool ,
2325}
2426
25-
2627#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq , EnumString , Default ) ]
27- #[ serde( rename_all = "camelCase" ) ]
28+ #[ serde( rename_all = "camelCase" ) ]
2829#[ strum( serialize_all = "camelCase" ) ]
2930pub enum LibraryRole {
30- Admin ,
31- Read ,
32- Write ,
31+ Admin ,
32+ Read ,
33+ Write ,
3334 #[ default]
34- None ,
35+ None ,
3536}
3637
37-
3838#[ derive( Debug , Serialize , Deserialize , Clone , Default , PartialEq ) ]
3939pub struct LibraryLimits {
4040 #[ serde( default ) ]
@@ -47,7 +47,6 @@ pub struct LibraryLimits {
4747 pub delay : Option < i64 > ,
4848 #[ serde( default ) ]
4949 pub user_id : Option < String > ,
50-
5150}
5251
5352impl LibraryLimits {
@@ -74,32 +73,27 @@ impl ToSql for LibraryLimits {
7473 }
7574}
7675
77-
78-
79-
80-
8176#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq , Default , EnumString , Display ) ]
82- #[ serde( rename_all = "camelCase" ) ]
77+ #[ serde( rename_all = "camelCase" ) ]
8378#[ strum( serialize_all = "camelCase" ) ]
8479pub enum LibraryType {
85- Photos ,
86- Shows ,
87- Movies ,
88- Iptv ,
80+ Photos ,
81+ Shows ,
82+ Movies ,
83+ Iptv ,
8984 #[ default]
9085 Other ,
9186}
9287
93-
9488#[ derive( Debug , Serialize , Deserialize , Clone ) ]
95- #[ serde( rename_all = "camelCase" ) ]
89+ #[ serde( rename_all = "camelCase" ) ]
9690pub struct UserMapping {
9791 pub from : String ,
98- pub to : String
92+ pub to : String ,
9993}
10094
10195#[ derive( Debug , Serialize , Deserialize , Clone , Default ) ]
102- #[ serde( rename_all = "camelCase" ) ]
96+ #[ serde( rename_all = "camelCase" ) ]
10397pub struct ServerLibrarySettings {
10498 #[ serde( skip_serializing_if = "Option::is_none" ) ]
10599 pub face_threshold : Option < f32 > ,
@@ -111,21 +105,16 @@ pub struct ServerLibrarySettings {
111105 pub map_progress : Option < Vec < UserMapping > > ,
112106}
113107
114-
115-
116-
117-
118-
119108#[ derive( Debug , Serialize , Deserialize , Clone ) ]
120- #[ serde( rename_all = "camelCase" ) ]
109+ #[ serde( rename_all = "camelCase" ) ]
121110pub struct LibraryMessage {
122111 pub action : ElementAction ,
123- pub library : ServerLibrary
112+ pub library : ServerLibrary ,
124113}
125114
126115#[ derive( Debug , Serialize , Deserialize , Clone ) ]
127- #[ serde( rename_all = "camelCase" ) ]
116+ #[ serde( rename_all = "camelCase" ) ]
128117pub struct LibraryStatusMessage {
129118 pub message : String ,
130- pub library : String
131- }
119+ pub library : String ,
120+ }
0 commit comments