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:
@@ -3,7 +3,7 @@ use std::path::PathBuf;
|
||||
|
||||
/// Context for the current queue - where did the queue items come from?
|
||||
/// This is used for remote playback transfer to send album/playlist context.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
|
||||
#[derive(specta::Type, Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
|
||||
#[serde(tag = "type", rename_all = "lowercase")]
|
||||
pub enum QueueContext {
|
||||
/// Playing from a specific album
|
||||
@@ -23,7 +23,7 @@ pub enum QueueContext {
|
||||
}
|
||||
|
||||
/// Represents a subtitle track
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
#[derive(specta::Type, Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
pub struct SubtitleTrack {
|
||||
/// Stream index in the media source
|
||||
pub index: i32,
|
||||
@@ -40,7 +40,7 @@ pub struct SubtitleTrack {
|
||||
/// Represents a media item that can be played
|
||||
///
|
||||
/// TRACES: UR-003, UR-004 | DR-002
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
#[derive(specta::Type, Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct MediaItem {
|
||||
/// Unique identifier
|
||||
@@ -106,7 +106,7 @@ pub struct MediaItem {
|
||||
pub server_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(specta::Type, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum MediaType {
|
||||
Audio,
|
||||
@@ -114,7 +114,7 @@ pub enum MediaType {
|
||||
}
|
||||
|
||||
/// TRACES: UR-002, UR-003, UR-004, UR-011 | DR-003
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
#[derive(specta::Type, Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(tag = "type", rename_all = "lowercase")]
|
||||
pub enum MediaSource {
|
||||
/// Streaming from Jellyfin server
|
||||
|
||||
Reference in New Issue
Block a user