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:
@@ -381,8 +381,8 @@ fn default_true() -> bool {
|
||||
}
|
||||
|
||||
/// Session information from Jellyfin
|
||||
#[derive(Debug, Clone, Deserialize, serde::Serialize)]
|
||||
#[serde(rename_all(deserialize = "PascalCase", serialize = "camelCase"))]
|
||||
#[derive(specta::Type, Debug, Clone, Deserialize, serde::Serialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct SessionInfo {
|
||||
#[serde(default)]
|
||||
pub id: Option<String>,
|
||||
@@ -414,8 +414,8 @@ pub struct SessionInfo {
|
||||
pub supported_commands: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, serde::Serialize)]
|
||||
#[serde(rename_all(deserialize = "PascalCase", serialize = "camelCase"))]
|
||||
#[derive(specta::Type, Debug, Clone, Deserialize, serde::Serialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct NowPlayingItem {
|
||||
pub id: Option<String>,
|
||||
pub name: Option<String>,
|
||||
@@ -431,8 +431,8 @@ pub struct NowPlayingItem {
|
||||
pub item_type: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, serde::Serialize)]
|
||||
#[serde(rename_all(deserialize = "PascalCase", serialize = "camelCase"))]
|
||||
#[derive(specta::Type, Debug, Clone, Deserialize, serde::Serialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
pub struct PlayState {
|
||||
#[serde(default)]
|
||||
pub position_ticks: Option<i64>,
|
||||
|
||||
Reference in New Issue
Block a user