use crate::database::schema::{favorites, image_exif, photo_insights, users, video_preview_clips}; use serde::Serialize; #[derive(Insertable)] #[diesel(table_name = users)] pub struct InsertUser<'a> { pub username: &'a str, pub password: &'a str, } #[derive(Serialize, Queryable, Clone, Debug)] pub struct User { pub id: i32, pub username: String, #[serde(skip_serializing)] pub password: String, } #[derive(Insertable)] #[diesel(table_name = favorites)] pub struct InsertFavorite<'a> { pub userid: &'a i32, pub path: &'a str, } #[derive(Serialize, Queryable, Clone, Debug)] pub struct Favorite { pub id: i32, pub userid: i32, pub path: String, } #[derive(Insertable)] #[diesel(table_name = image_exif)] pub struct InsertImageExif { pub file_path: String, pub camera_make: Option, pub camera_model: Option, pub lens_model: Option, pub width: Option, pub height: Option, pub orientation: Option, pub gps_latitude: Option, pub gps_longitude: Option, pub gps_altitude: Option, pub focal_length: Option, pub aperture: Option, pub shutter_speed: Option, pub iso: Option, pub date_taken: Option, pub created_time: i64, pub last_modified: i64, } #[derive(Serialize, Queryable, Clone, Debug)] pub struct ImageExif { pub id: i32, pub file_path: String, pub camera_make: Option, pub camera_model: Option, pub lens_model: Option, pub width: Option, pub height: Option, pub orientation: Option, pub gps_latitude: Option, pub gps_longitude: Option, pub gps_altitude: Option, pub focal_length: Option, pub aperture: Option, pub shutter_speed: Option, pub iso: Option, pub date_taken: Option, pub created_time: i64, pub last_modified: i64, } #[derive(Insertable)] #[diesel(table_name = photo_insights)] pub struct InsertPhotoInsight { pub file_path: String, pub title: String, pub summary: String, pub generated_at: i64, pub model_version: String, } #[derive(Serialize, Queryable, Clone, Debug)] pub struct PhotoInsight { pub id: i32, pub file_path: String, pub title: String, pub summary: String, pub generated_at: i64, pub model_version: String, } #[derive(Insertable)] #[diesel(table_name = video_preview_clips)] pub struct InsertVideoPreviewClip { pub file_path: String, pub status: String, pub created_at: String, pub updated_at: String, } #[derive(Serialize, Queryable, Clone, Debug)] pub struct VideoPreviewClip { pub id: i32, pub file_path: String, pub status: String, pub duration_seconds: Option, pub file_size_bytes: Option, pub error_message: Option, pub created_at: String, pub updated_at: String, }