mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-26 20:09:47 +01:00
More work on Shares
This commit is contained in:
parent
ab04e33da6
commit
84aa094e56
19 changed files with 150 additions and 167 deletions
|
|
@ -35,8 +35,7 @@ func (s *shareService) Load(ctx context.Context, id string) (*model.Share, error
|
|||
return nil, err
|
||||
}
|
||||
share := entity.(*model.Share)
|
||||
now := time.Now()
|
||||
share.LastVisitedAt = &now
|
||||
share.LastVisitedAt = time.Now()
|
||||
share.VisitCount++
|
||||
|
||||
err = repo.(rest.Persistable).Update(id, share, "last_visited_at", "visit_count")
|
||||
|
|
@ -112,8 +111,7 @@ func (r *shareRepositoryWrapper) Save(entity interface{}) (string, error) {
|
|||
}
|
||||
s.ID = id
|
||||
if s.ExpiresAt.IsZero() {
|
||||
exp := time.Now().Add(365 * 24 * time.Hour)
|
||||
s.ExpiresAt = &exp
|
||||
s.ExpiresAt = time.Now().Add(365 * 24 * time.Hour)
|
||||
}
|
||||
id, err = r.Persistable.Save(s)
|
||||
return id, err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue