Workstream E (backend): wire tauri-specta — annotate commands, derive Type, generate-ready Builder
- Add #[specta::specta] to all 201 #[tauri::command] functions. - Derive specta::Type on all IPC DTOs (repository/types, settings, player/storage/ download command DTOs, player enums, jellyfin SessionInfo/NowPlayingItem/PlayState, ThumbnailCacheStats, DownloadInfo, CacheConfig, etc.). - Replace tauri::generate_handler! with a tauri_specta::Builder + collect_commands! in lib.rs (exports bindings.ts in debug builds). Two contract changes required by specta constraints (frontend migration follows): - specta caps command arity at 10 args: download_item_and_start / download_item / download_video now take a single request struct (params bundled, body unchanged via destructuring). - specta can't parse split serde rename_all: SessionInfo/NowPlayingItem/PlayState switched to rename_all = "PascalCase" (Jellyfin deserialization preserved; these now serialize PascalCase to the frontend). cargo check --lib is clean (0 errors). Frontend migration to bindings.ts is the next step.
This commit is contained in:
@@ -9,7 +9,7 @@ use crate::storage::db_service::{DatabaseService, Query, QueryParam};
|
||||
|
||||
|
||||
/// Cached person info returned to frontend
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(specta::Type, Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CachedPerson {
|
||||
pub id: String,
|
||||
@@ -22,7 +22,7 @@ pub struct CachedPerson {
|
||||
}
|
||||
|
||||
/// Item-person association for caching
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[derive(specta::Type, Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CachedItemPerson {
|
||||
pub item_id: String,
|
||||
@@ -35,6 +35,7 @@ pub struct CachedItemPerson {
|
||||
|
||||
/// Save a person to the cache
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn storage_save_person(
|
||||
db: State<'_, DatabaseWrapper>,
|
||||
person: CachedPerson,
|
||||
@@ -66,6 +67,7 @@ pub async fn storage_save_person(
|
||||
|
||||
/// Get a cached person by ID
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn storage_get_person(
|
||||
db: State<'_, DatabaseWrapper>,
|
||||
person_id: String,
|
||||
@@ -101,6 +103,7 @@ pub async fn storage_get_person(
|
||||
|
||||
/// Save item-person associations (batch)
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn storage_save_item_people(
|
||||
db: State<'_, DatabaseWrapper>,
|
||||
associations: Vec<CachedItemPerson>,
|
||||
@@ -139,6 +142,7 @@ pub async fn storage_save_item_people(
|
||||
|
||||
/// Get people for an item (with person details joined)
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn storage_get_item_people(
|
||||
db: State<'_, DatabaseWrapper>,
|
||||
item_id: String,
|
||||
|
||||
Reference in New Issue
Block a user