mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-27 04:19:58 +01:00
feat(scrobble): add configuration option to enable scrobble history
Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
9d4af721ca
commit
866ff8468c
8 changed files with 24 additions and 18 deletions
|
|
@ -220,7 +220,7 @@ func (db *MockDataStore) Scrobble(ctx context.Context) model.ScrobbleRepository
|
|||
if db.RealDS != nil {
|
||||
db.MockedScrobble = db.RealDS.Scrobble(ctx)
|
||||
} else {
|
||||
db.MockedScrobble = &MockScrobbleRepo{}
|
||||
db.MockedScrobble = &MockScrobbleRepo{ctx: ctx}
|
||||
}
|
||||
}
|
||||
return db.MockedScrobble
|
||||
|
|
|
|||
|
|
@ -1,19 +1,23 @@
|
|||
package tests
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/navidrome/navidrome/model"
|
||||
"github.com/navidrome/navidrome/model/request"
|
||||
)
|
||||
|
||||
type MockScrobbleRepo struct {
|
||||
RecordedScrobbles []model.Scrobble
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func (m *MockScrobbleRepo) RecordScrobble(fileID, userID string, submissionTime time.Time) error {
|
||||
func (m *MockScrobbleRepo) RecordScrobble(fileID string, submissionTime time.Time) error {
|
||||
user, _ := request.UserFrom(m.ctx)
|
||||
m.RecordedScrobbles = append(m.RecordedScrobbles, model.Scrobble{
|
||||
MediaFileID: fileID,
|
||||
UserID: userID,
|
||||
UserID: user.ID,
|
||||
SubmissionTime: submissionTime,
|
||||
})
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue