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
+36
View File
@@ -0,0 +1,36 @@
import api from './api';
import type { FeedbackAction, HistoryEntry } from '../types';
export const historyService = {
// POST /api/history { trackId, completed?, batchId? } -> { historyId }
async recordPlay(
trackId: string,
completed?: boolean,
batchId?: string
): Promise<{ historyId: string }> {
const res = await api.post<{ historyId: string }>('/history', {
trackId,
completed,
batchId,
});
return res.data;
},
// POST /api/history/skip { trackId } -> { status }
async skip(trackId: string): Promise<{ status: string }> {
const res = await api.post<{ status: string }>('/history/skip', { trackId });
return res.data;
},
// GET /api/history -> recent play history (Track + playback metadata)
async list(): Promise<HistoryEntry[]> {
const res = await api.get<HistoryEntry[]>('/history');
return res.data;
},
// POST /api/feedback { trackId, action } -> { status }
async feedback(trackId: string, action: FeedbackAction): Promise<{ status: string }> {
const res = await api.post<{ status: string }>('/feedback', { trackId, action });
return res.data;
},
};