2024-01-21 20:28:37 -05:00
|
|
|
// See https://kit.svelte.dev/docs/types#app
|
|
|
|
|
// for information about these interfaces
|
|
|
|
|
declare global {
|
2024-01-21 23:51:15 -05:00
|
|
|
namespace App {
|
|
|
|
|
// interface Error {}
|
2024-01-25 19:50:26 -05:00
|
|
|
interface Locals {
|
2024-02-23 00:53:54 -05:00
|
|
|
user: Omit<User, 'passwordHash'>
|
2024-01-25 19:50:26 -05:00
|
|
|
}
|
2024-01-21 23:51:15 -05:00
|
|
|
// interface PageData {}
|
|
|
|
|
// interface PageState {}
|
|
|
|
|
// interface Platform {}
|
|
|
|
|
}
|
2024-01-25 19:50:26 -05:00
|
|
|
|
2024-02-04 01:01:37 -05:00
|
|
|
// General Interface Desing tips:
|
|
|
|
|
// Use possibly undefined `?:` for when a property is optional, meaning it could be there, or it could be not applicable
|
2024-02-12 00:39:15 -05:00
|
|
|
// Use possibly null `| null` for when the property is expected to be there but could possbily be explicitly empty
|
2024-02-04 01:01:37 -05:00
|
|
|
|
2024-02-12 16:00:55 -05:00
|
|
|
// Do not store data from other services in the database, only the data necessary to fetch whatever you need.
|
|
|
|
|
// This avoid syncronization issues. E.g. Store userId, and urlOrigin to fetch the user's name and profile picture.
|
|
|
|
|
|
2024-03-24 16:03:31 -04:00
|
|
|
type User = {
|
2024-01-25 19:50:26 -05:00
|
|
|
id: string
|
|
|
|
|
username: string
|
2024-02-23 00:53:54 -05:00
|
|
|
passwordHash: string
|
2024-01-25 19:50:26 -05:00
|
|
|
}
|
2024-01-29 12:29:32 -05:00
|
|
|
|
2024-04-05 02:00:17 -04:00
|
|
|
type ConnectionInfo = {
|
|
|
|
|
id: string
|
|
|
|
|
userId: string
|
|
|
|
|
} & ({
|
|
|
|
|
type: 'jellyfin'
|
|
|
|
|
serverUrl: string
|
2024-04-09 00:10:23 -04:00
|
|
|
serverName?: string
|
2024-04-05 02:00:17 -04:00
|
|
|
jellyfinUserId: string
|
2024-04-09 00:10:23 -04:00
|
|
|
username?: string
|
2024-04-05 02:00:17 -04:00
|
|
|
} | {
|
|
|
|
|
type: 'youtube-music'
|
|
|
|
|
youtubeUserId: string
|
|
|
|
|
username: string
|
|
|
|
|
profilePicture: string
|
|
|
|
|
})
|
|
|
|
|
|
2024-03-24 16:03:31 -04:00
|
|
|
interface Connection {
|
2024-03-30 01:15:12 -04:00
|
|
|
public id: string
|
2024-04-03 01:19:46 -04:00
|
|
|
getRecommendations: () => Promise<(Song | Album | Artist | Playlist)[]>
|
2024-03-24 16:03:31 -04:00
|
|
|
getConnectionInfo: () => Promise<ConnectionInfo>
|
2024-03-31 01:44:48 -04:00
|
|
|
search: (searchTerm: string, filter?: 'song' | 'album' | 'artist' | 'playlist') => Promise<(Song | Album | Artist | Playlist)[]>
|
2024-04-09 00:10:23 -04:00
|
|
|
getAudioStream: (id: string) => Promise<Response>
|
2024-03-24 16:03:31 -04:00
|
|
|
}
|
2024-02-04 01:01:37 -05:00
|
|
|
// 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.
|
2024-02-03 02:47:23 -05:00
|
|
|
|
2024-03-27 23:53:59 -04:00
|
|
|
type Song = {
|
2024-04-03 23:28:38 -04:00
|
|
|
connection: string
|
2024-03-27 23:53:59 -04:00
|
|
|
id: string
|
|
|
|
|
name: string
|
2024-02-04 01:01:37 -05:00
|
|
|
type: 'song'
|
2024-03-06 21:13:12 -05:00
|
|
|
duration?: number
|
2024-03-27 23:53:59 -04:00
|
|
|
thumbnail?: string
|
2024-02-28 03:03:40 -05:00
|
|
|
artists?: {
|
2024-02-04 01:01:37 -05:00
|
|
|
id: string
|
|
|
|
|
name: string
|
|
|
|
|
}[]
|
2024-02-28 03:03:40 -05:00
|
|
|
album?: {
|
|
|
|
|
id: string
|
|
|
|
|
name: string
|
|
|
|
|
}
|
2024-04-09 00:10:23 -04:00
|
|
|
createdBy?: {
|
|
|
|
|
id: string
|
|
|
|
|
name: string
|
|
|
|
|
}
|
2024-02-28 03:03:40 -05:00
|
|
|
releaseDate?: string
|
2024-02-03 02:47:23 -05:00
|
|
|
}
|
|
|
|
|
|
2024-03-27 23:53:59 -04:00
|
|
|
type Album = {
|
2024-04-03 23:28:38 -04:00
|
|
|
connection: string
|
2024-03-27 23:53:59 -04:00
|
|
|
id: string
|
|
|
|
|
name: string
|
2024-02-04 01:01:37 -05:00
|
|
|
type: 'album'
|
2024-03-06 21:13:12 -05:00
|
|
|
duration?: number
|
2024-03-27 23:53:59 -04:00
|
|
|
thumbnail?: string
|
2024-02-28 03:03:40 -05:00
|
|
|
artists?: {
|
2024-03-08 01:23:24 -05:00
|
|
|
// Album Artists
|
2024-02-04 01:01:37 -05:00
|
|
|
id: string
|
|
|
|
|
name: string
|
|
|
|
|
}[]
|
2024-02-28 03:03:40 -05:00
|
|
|
releaseDate?: string
|
2024-02-03 02:47:23 -05:00
|
|
|
}
|
|
|
|
|
|
2024-03-31 01:44:48 -04:00
|
|
|
// Need to figure out how to do Artists, maybe just query MusicBrainz?
|
|
|
|
|
type Artist = {
|
2024-04-03 23:28:38 -04:00
|
|
|
connection: string
|
2024-03-27 23:53:59 -04:00
|
|
|
id: string
|
|
|
|
|
name: string
|
2024-03-31 01:44:48 -04:00
|
|
|
type: 'artist'
|
2024-03-27 23:53:59 -04:00
|
|
|
thumbnail?: string
|
2024-02-03 02:47:23 -05:00
|
|
|
}
|
|
|
|
|
|
2024-03-31 01:44:48 -04:00
|
|
|
type Playlist = {
|
2024-04-03 23:28:38 -04:00
|
|
|
connection: string
|
2024-03-27 23:53:59 -04:00
|
|
|
id: string
|
|
|
|
|
name: string
|
2024-03-31 01:44:48 -04:00
|
|
|
type: 'playlist'
|
2024-04-09 00:10:23 -04:00
|
|
|
createdBy?: {
|
|
|
|
|
id: string
|
|
|
|
|
name: string
|
|
|
|
|
}
|
2024-03-27 23:53:59 -04:00
|
|
|
thumbnail?: string
|
2024-02-03 02:47:23 -05:00
|
|
|
}
|
2024-01-21 20:28:37 -05:00
|
|
|
}
|
|
|
|
|
|
2024-01-21 23:51:15 -05:00
|
|
|
export {}
|