initial state: muzick music player + recommendation engine

This commit is contained in:
kami
2026-07-14 01:35:52 +04:00
commit 737bf19fd1
196 changed files with 32431 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
import api from './api';
import type { Genre, Track } from '../types';
export interface GetGenreTracksParams {
limit?: number;
offset?: number;
}
export const genreService = {
// GET /api/genres — all genres with a track_count, ordered by popularity.
async listGenres(): Promise<Genre[]> {
const res = await api.get<Genre[]>('/genres');
return res.data;
},
// GET /api/genres/:id — a single genre (with track_count), or null if missing.
async getGenre(id: string): Promise<Genre | null> {
try {
const res = await api.get<Genre>(`/genres/${id}`);
return res.data;
} catch {
return null;
}
},
// GET /api/genres/:id/tracks — LIBRARY tracks in this genre, by weight DESC.
async getGenreTracks(id: string, params?: GetGenreTracksParams): Promise<Track[]> {
const res = await api.get<Track[]>(`/genres/${id}/tracks`, { params });
return res.data;
},
};