@@ -7,7 +7,7 @@ use chrono::{DateTime, Utc};
77use diesel:: prelude:: * ;
88use serde:: { Deserialize , Serialize } ;
99
10- #[ derive( Queryable , Selectable , Debug , Serialize , Deserialize , Identifiable ) ]
10+ #[ derive( Queryable , Identifiable , Debug , Selectable ) ]
1111#[ diesel( table_name = media) ]
1212#[ diesel( check_for_backend( diesel:: pg:: Pg ) ) ]
1313pub struct Media {
@@ -16,6 +16,7 @@ pub struct Media {
1616 pub route : String ,
1717 pub file_name : String ,
1818 pub file_path : String ,
19+ pub original_path : Option < String > ,
1920 pub media_type : String ,
2021 pub usable : Option < bool > ,
2122 pub highlight : Option < bool > ,
@@ -53,6 +54,13 @@ pub struct MediaUpdate {
5354 pub description : String ,
5455}
5556
57+ // Add a specific struct for updating original_path
58+ #[ derive( AsChangeset , Debug , Selectable ) ]
59+ #[ diesel( table_name = media) ]
60+ pub struct MediaOriginalPathUpdate {
61+ pub original_path : Option < String > ,
62+ }
63+
5664#[ derive( Queryable , Selectable , Debug , Insertable , Associations , Identifiable ) ]
5765#[ diesel( belongs_to( Media , foreign_key = media_id) ) ]
5866#[ diesel( belongs_to( Tag , foreign_key = tag_id) ) ]
0 commit comments