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:
@@ -24,6 +24,7 @@ pub struct PlaybackReporterWrapper(pub Arc<TokioMutex<Option<PlaybackReporter>>>
|
||||
|
||||
/// Initialize playback reporter (called after login)
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn playback_reporter_init(
|
||||
reporter_wrapper: State<'_, PlaybackReporterWrapper>,
|
||||
db: State<'_, DatabaseWrapper>,
|
||||
@@ -66,6 +67,7 @@ pub async fn playback_reporter_init(
|
||||
|
||||
/// Destroy playback reporter (called on logout)
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn playback_reporter_destroy(
|
||||
reporter_wrapper: State<'_, PlaybackReporterWrapper>,
|
||||
) -> Result<(), String> {
|
||||
@@ -76,6 +78,7 @@ pub async fn playback_reporter_destroy(
|
||||
|
||||
/// Report playback start
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn playback_report_start(
|
||||
reporter: State<'_, PlaybackReporterWrapper>,
|
||||
connectivity: State<'_, ConnectivityMonitorWrapper>,
|
||||
@@ -110,6 +113,7 @@ pub async fn playback_report_start(
|
||||
|
||||
/// Report playback progress
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn playback_report_progress(
|
||||
reporter: State<'_, PlaybackReporterWrapper>,
|
||||
connectivity: State<'_, ConnectivityMonitorWrapper>,
|
||||
@@ -138,6 +142,7 @@ pub async fn playback_report_progress(
|
||||
|
||||
/// Report playback stopped
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn playback_report_stopped(
|
||||
reporter: State<'_, PlaybackReporterWrapper>,
|
||||
connectivity: State<'_, ConnectivityMonitorWrapper>,
|
||||
@@ -164,6 +169,7 @@ pub async fn playback_report_stopped(
|
||||
|
||||
/// Mark item as played
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn playback_mark_played(
|
||||
reporter: State<'_, PlaybackReporterWrapper>,
|
||||
connectivity: State<'_, ConnectivityMonitorWrapper>,
|
||||
|
||||
Reference in New Issue
Block a user