← Tüm Özelliklere Dön

📜 Play History

Son 50 Dinlenen Şarkı

Kullanıcının dinleme geçmişini takip et. Tekrar dinleme ve keşif için ideal.

Database

CREATE TABLE play_history (
    id BIGINT PRIMARY KEY,
    user_id BIGINT,
    song_id BIGINT,
    played_at TIMESTAMP,
    duration_listened INT, -- saniye
    INDEX(user_id, played_at)
);

API

// POST /api/muzibu/play-history
{
    "song_id": 123,
    "duration_listened": 180 // 3 dakika dinledi
}

// GET /api/muzibu/play-history?limit=50
// Son 50 şarkı döner

Frontend

// Şarkı çalınca log'la
async logPlayHistory(songId, duration) {
    await fetch('/api/muzibu/play-history', {
        method: 'POST',
        body: JSON.stringify({ song_id: songId, duration_listened: duration })
    });
}

← Dön