@@ -64,16 +64,32 @@ pub trait PodcastEpisodeTranscriptRepository: Send + Sync {
6464 type Error ;
6565 /// Upsert keyed on (episode_id, original_url); returns the row's id.
6666 fn upsert ( & self , transcript : UpsertTranscript ) -> Result < Uuid , Self :: Error > ;
67- fn get_by_episode_id ( & self , episode_id : Uuid ) -> Result < Vec < PodcastEpisodeTranscript > , Self :: Error > ;
67+ fn get_by_episode_id (
68+ & self ,
69+ episode_id : Uuid ,
70+ ) -> Result < Vec < PodcastEpisodeTranscript > , Self :: Error > ;
6871 /// Every transcript row across all episodes. Used by `reparse_all`, which
6972 /// needs to walk the whole table rather than a single episode's rows.
7073 fn get_all ( & self ) -> Result < Vec < PodcastEpisodeTranscript > , Self :: Error > ;
7174 fn get_by_id ( & self , id : Uuid ) -> Result < Option < PodcastEpisodeTranscript > , Self :: Error > ;
7275 fn set_file_path ( & self , id : Uuid , file_path : & str ) -> Result < ( ) , Self :: Error > ;
73- fn set_status ( & self , id : Uuid , status : TranscriptStatus , error : Option < & str > ) -> Result < ( ) , Self :: Error > ;
74- fn set_preferred ( & self , episode_id : Uuid , preferred_id : Option < Uuid > ) -> Result < ( ) , Self :: Error > ;
76+ fn set_status (
77+ & self ,
78+ id : Uuid ,
79+ status : TranscriptStatus ,
80+ error : Option < & str > ,
81+ ) -> Result < ( ) , Self :: Error > ;
82+ fn set_preferred (
83+ & self ,
84+ episode_id : Uuid ,
85+ preferred_id : Option < Uuid > ,
86+ ) -> Result < ( ) , Self :: Error > ;
7587 /// Deletes the transcript's old segments and inserts the new ones in one transaction.
76- fn replace_segments ( & self , transcript_id : Uuid , segments : & [ TranscriptSegment ] ) -> Result < ( ) , Self :: Error > ;
88+ fn replace_segments (
89+ & self ,
90+ transcript_id : Uuid ,
91+ segments : & [ TranscriptSegment ] ,
92+ ) -> Result < ( ) , Self :: Error > ;
7793 fn get_segments ( & self , transcript_id : Uuid ) -> Result < Vec < TranscriptSegment > , Self :: Error > ;
7894 fn search (
7995 & self ,
@@ -106,7 +122,12 @@ pub trait TranscriptionJobRepository: Send + Sync {
106122 /// Enqueues a job; returns Ok(None) if one already exists for the episode (UNIQUE).
107123 fn enqueue ( & self , episode_id : Uuid ) -> Result < Option < TranscriptionJob > , Self :: Error > ;
108124 fn next_pending ( & self ) -> Result < Option < TranscriptionJob > , Self :: Error > ;
109- fn set_status ( & self , id : Uuid , status : TranscriptionJobStatus , error : Option < & str > ) -> Result < ( ) , Self :: Error > ;
125+ fn set_status (
126+ & self ,
127+ id : Uuid ,
128+ status : TranscriptionJobStatus ,
129+ error : Option < & str > ,
130+ ) -> Result < ( ) , Self :: Error > ;
110131 fn increment_attempts ( & self , id : Uuid ) -> Result < i32 , Self :: Error > ;
111132 fn reset_running_to_pending ( & self ) -> Result < usize , Self :: Error > ;
112133 fn get_by_episode_id ( & self , episode_id : Uuid ) -> Result < Option < TranscriptionJob > , Self :: Error > ;
@@ -188,8 +209,14 @@ mod tests {
188209
189210 #[ test]
190211 fn transcript_source_from_str ( ) {
191- assert_eq ! ( TranscriptSource :: from_str( "feed" ) , Some ( TranscriptSource :: Feed ) ) ;
192- assert_eq ! ( TranscriptSource :: from_str( "generated" ) , Some ( TranscriptSource :: Generated ) ) ;
212+ assert_eq ! (
213+ TranscriptSource :: from_str( "feed" ) ,
214+ Some ( TranscriptSource :: Feed )
215+ ) ;
216+ assert_eq ! (
217+ TranscriptSource :: from_str( "generated" ) ,
218+ Some ( TranscriptSource :: Generated )
219+ ) ;
193220 assert_eq ! ( TranscriptSource :: from_str( "unknown" ) , None ) ;
194221 }
195222
@@ -211,10 +238,22 @@ mod tests {
211238
212239 #[ test]
213240 fn transcript_status_from_str ( ) {
214- assert_eq ! ( TranscriptStatus :: from_str( "pending" ) , Some ( TranscriptStatus :: Pending ) ) ;
215- assert_eq ! ( TranscriptStatus :: from_str( "downloaded" ) , Some ( TranscriptStatus :: Downloaded ) ) ;
216- assert_eq ! ( TranscriptStatus :: from_str( "parsed" ) , Some ( TranscriptStatus :: Parsed ) ) ;
217- assert_eq ! ( TranscriptStatus :: from_str( "failed" ) , Some ( TranscriptStatus :: Failed ) ) ;
241+ assert_eq ! (
242+ TranscriptStatus :: from_str( "pending" ) ,
243+ Some ( TranscriptStatus :: Pending )
244+ ) ;
245+ assert_eq ! (
246+ TranscriptStatus :: from_str( "downloaded" ) ,
247+ Some ( TranscriptStatus :: Downloaded )
248+ ) ;
249+ assert_eq ! (
250+ TranscriptStatus :: from_str( "parsed" ) ,
251+ Some ( TranscriptStatus :: Parsed )
252+ ) ;
253+ assert_eq ! (
254+ TranscriptStatus :: from_str( "failed" ) ,
255+ Some ( TranscriptStatus :: Failed )
256+ ) ;
218257 assert_eq ! ( TranscriptStatus :: from_str( "unknown" ) , None ) ;
219258 }
220259
@@ -241,10 +280,22 @@ mod tests {
241280
242281 #[ test]
243282 fn transcription_job_status_from_str ( ) {
244- assert_eq ! ( TranscriptionJobStatus :: from_str( "pending" ) , Some ( TranscriptionJobStatus :: Pending ) ) ;
245- assert_eq ! ( TranscriptionJobStatus :: from_str( "running" ) , Some ( TranscriptionJobStatus :: Running ) ) ;
246- assert_eq ! ( TranscriptionJobStatus :: from_str( "done" ) , Some ( TranscriptionJobStatus :: Done ) ) ;
247- assert_eq ! ( TranscriptionJobStatus :: from_str( "failed" ) , Some ( TranscriptionJobStatus :: Failed ) ) ;
283+ assert_eq ! (
284+ TranscriptionJobStatus :: from_str( "pending" ) ,
285+ Some ( TranscriptionJobStatus :: Pending )
286+ ) ;
287+ assert_eq ! (
288+ TranscriptionJobStatus :: from_str( "running" ) ,
289+ Some ( TranscriptionJobStatus :: Running )
290+ ) ;
291+ assert_eq ! (
292+ TranscriptionJobStatus :: from_str( "done" ) ,
293+ Some ( TranscriptionJobStatus :: Done )
294+ ) ;
295+ assert_eq ! (
296+ TranscriptionJobStatus :: from_str( "failed" ) ,
297+ Some ( TranscriptionJobStatus :: Failed )
298+ ) ;
248299 assert_eq ! ( TranscriptionJobStatus :: from_str( "unknown" ) , None ) ;
249300 }
250301
@@ -257,7 +308,10 @@ mod tests {
257308 TranscriptionJobStatus :: Failed ,
258309 ] ;
259310 for variant in variants {
260- assert_eq ! ( TranscriptionJobStatus :: from_str( variant. as_str( ) ) , Some ( variant) ) ;
311+ assert_eq ! (
312+ TranscriptionJobStatus :: from_str( variant. as_str( ) ) ,
313+ Some ( variant)
314+ ) ;
261315 }
262316 }
263317}
0 commit comments