Removed MediaItem type

This commit is contained in:
Eclypsed
2024-03-27 23:53:59 -04:00
parent 2314bc638d
commit a4bad9d73b
7 changed files with 34 additions and 34 deletions

32
src/app.d.ts vendored
View File

@@ -24,8 +24,6 @@ declare global {
passwordHash: string
}
type serviceType = 'jellyfin' | 'youtube-music'
type ConnectionInfo = {
id: string
userId: string
@@ -43,27 +41,24 @@ declare global {
)
interface Connection {
getRecommendations: () => Promise<MediaItem[]>
getRecommendations: () => Promise<(Song | Album | Playlist)[]>
getConnectionInfo: () => Promise<ConnectionInfo>
search: (searchTerm: string) => Promise<MediaItem[]>
search: (searchTerm: string) => Promise<(Song | Album | Playlist)[]>
}
// These Schemas should only contain general info data that is necessary for data fetching purposes.
// They are NOT meant to be stores for large amounts of data, i.e. Don't include the data for every single song the Playlist type.
// Big data should be fetched as needed in the app, these exist to ensure that the info necessary to fetch that data is there.
interface MediaItem {
type: 'song' | 'album' | 'playlist' | 'artist'
id: string
name: string
thumbnail?: string
}
interface Song extends MediaItem {
type Song = {
connection: {
id: string
type: serviceType
}
id: string
name: string
type: 'song'
duration?: number
thumbnail?: string
artists?: {
id: string
name: string
@@ -77,13 +72,16 @@ declare global {
releaseDate?: string
}
interface Album extends MediaItem {
type Album = {
connection: {
id: string
type: serviceType
}
id: string
name: string
type: 'album'
duration?: number
thumbnail?: string
artists?: {
// Album Artists
id: string
@@ -93,8 +91,11 @@ declare global {
}
// IMPORTANT: This interface is for Lazuli created and stored playlists. Use service-specific interfaces when pulling playlists from services
interface Playlist extends MediaItem {
type Playlist = {
id: string
name: string
type: 'playlist'
thumbnail?: string
description?: string
items: {
connectionId: string
@@ -102,8 +103,11 @@ declare global {
}[]
}
interface Artist extends MediaItem {
type Artist = {
id: string
name: string
type: 'artist'
thumbnail?: string
}
namespace Jellyfin {