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:
2026-06-20 18:20:25 +02:00
parent 55f1b85f12
commit ada3ed64ab
40 changed files with 598 additions and 354 deletions
+7
View File
@@ -11,6 +11,7 @@ use super::repository::RepositoryManagerWrapper;
/// Create a new playlist
#[tauri::command]
#[specta::specta]
pub async fn playlist_create(
manager: State<'_, RepositoryManagerWrapper>,
handle: String,
@@ -27,6 +28,7 @@ pub async fn playlist_create(
/// Delete a playlist
#[tauri::command]
#[specta::specta]
pub async fn playlist_delete(
manager: State<'_, RepositoryManagerWrapper>,
handle: String,
@@ -41,6 +43,7 @@ pub async fn playlist_delete(
/// Rename a playlist
#[tauri::command]
#[specta::specta]
pub async fn playlist_rename(
manager: State<'_, RepositoryManagerWrapper>,
handle: String,
@@ -56,6 +59,7 @@ pub async fn playlist_rename(
/// Get playlist items with PlaylistItemId
#[tauri::command]
#[specta::specta]
pub async fn playlist_get_items(
manager: State<'_, RepositoryManagerWrapper>,
handle: String,
@@ -70,6 +74,7 @@ pub async fn playlist_get_items(
/// Add items to a playlist
#[tauri::command]
#[specta::specta]
pub async fn playlist_add_items(
manager: State<'_, RepositoryManagerWrapper>,
handle: String,
@@ -85,6 +90,7 @@ pub async fn playlist_add_items(
/// Remove items from a playlist (uses PlaylistItemId entry IDs, NOT media item IDs)
#[tauri::command]
#[specta::specta]
pub async fn playlist_remove_items(
manager: State<'_, RepositoryManagerWrapper>,
handle: String,
@@ -100,6 +106,7 @@ pub async fn playlist_remove_items(
/// Move a playlist item to a new position
#[tauri::command]
#[specta::specta]
pub async fn playlist_move_item(
manager: State<'_, RepositoryManagerWrapper>,
handle: String,