mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-27 12:29:50 +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
|
|
@ -21,7 +21,8 @@ func NewScrobbleRepository(ctx context.Context, db dbx.Builder) model.ScrobbleRe
|
|||
return r
|
||||
}
|
||||
|
||||
func (r *scrobbleRepository) RecordScrobble(mediaFileID, userID string, submissionTime time.Time) error {
|
||||
func (r *scrobbleRepository) RecordScrobble(mediaFileID string, submissionTime time.Time) error {
|
||||
userID := loggedUser(r.ctx).ID
|
||||
values := map[string]interface{}{
|
||||
"media_file_id": mediaFileID,
|
||||
"user_id": userID,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ var _ = Describe("ScrobbleRepository", func() {
|
|||
BeforeEach(func() {
|
||||
fileID = id.NewRandom()
|
||||
userID = id.NewRandom()
|
||||
ctx = request.WithUser(log.NewContext(context.TODO()), model.User{ID: "userid", UserName: "johndoe", IsAdmin: true})
|
||||
ctx = request.WithUser(log.NewContext(GinkgoT().Context()), model.User{ID: userID, UserName: "johndoe", IsAdmin: true})
|
||||
db := GetDBXBuilder()
|
||||
repo = NewScrobbleRepository(ctx, db)
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ var _ = Describe("ScrobbleRepository", func() {
|
|||
}).Execute()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
err = repo.RecordScrobble(fileID, userID, submissionTime)
|
||||
err = repo.RecordScrobble(fileID, submissionTime)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
// Verify insertion
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue