Address code review feedback

- Fixed type safety in playTracks by using proper union type instead of any
- Fixed downloads schema import to be at top level
- Fixed comment about audio mime type filtering

Co-authored-by: leinelissen <10154841+leinelissen@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-08 15:28:12 +00:00
co-authored by leinelissen
parent 1ff5b1b341
commit 60a739e5b7
2 changed files with 8 additions and 3 deletions
+3 -2
View File
@@ -7,6 +7,7 @@ import { DocumentDirectoryPath, downloadFile, unlink, exists } from 'react-nativ
import { getActiveSource } from '@/store/settings/db';
import { db } from '@/store/db';
import { tracks } from '@/store/db/schema/tracks';
import { downloads } from '@/store/db/schema/downloads';
import { eq } from 'drizzle-orm';
import { generateTrackUrl } from '@/utility/JellyfinApi/track';
import { getImage } from '@/utility/JellyfinApi/lib';
@@ -125,8 +126,8 @@ export async function removeDownloadedTrack(trackId: string): Promise<void> {
// Get the download from database
const downloadData = await db
.select()
.from(require('@/store/db/schema/downloads').downloads)
.where(eq(require('@/store/db/schema/downloads').downloads.id, trackId))
.from(downloads)
.where(eq(downloads.id, trackId))
.limit(1);
const download = downloadData[0];
+5 -1
View File
@@ -7,6 +7,10 @@ import { useDownloads } from '@/store/downloads/hooks';
import { useSourceId } from '@/store/db/useSourceId';
import type { AlbumTrack } from '@/store/music/types';
import type { DownloadWithMetadata } from '@/store/downloads/db';
import type { DownloadEntity } from '@/store/downloads/types';
// Union type to support both database and Redux formats (for CarPlay compatibility)
type DownloadRecord = Record<string, DownloadWithMetadata | DownloadEntity>;
interface PlayOptions {
play: boolean;
@@ -35,7 +39,7 @@ const defaults: PlayOptions = {
export async function playTracks(
trackIds: string[] | undefined,
tracks: Record<string, AlbumTrack>,
downloads: Record<string, DownloadWithMetadata | any>,
downloads: DownloadRecord,
options: Partial<PlayOptions> = {},
): Promise<Track[] | undefined> {
if (!trackIds) {