Skip to content

🎧 Your Personal Streaming Service

fix: manually set timestamps, as we don't rely on the ORM anymore

Deluan5d1df192913d
diff --git a/persistence/album_repository.go b/persistence/album_repository.go
index 136fdb566..2d8074708 100644
--- a/persistence/album_repository.go
+++ b/persistence/album_repository.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"strings"
+ "time"
. "github.com/Masterminds/squirrel"
"github.com/astaxie/beego/orm"
@@ -96,9 +97,8 @@ func (r *albumRepository) Refresh(ids ...string) error {
o := r.ormer
sql := fmt.Sprintf(`
select album_id as id, album as name, f.artist, f.album_artist, f.artist_id, f.compilation, f.genre,
- max(f.year) as year, sum(f.duration) as duration, max(f.updated_at) as updated_at,
- min(f.created_at) as created_at, count(*) as song_count, a.id as current_id, f.id as cover_art_id,
- f.path as cover_art_path, f.has_cover_art
+ max(f.year) as year, sum(f.duration) as duration, count(*) as song_count, a.id as current_id,
+ f.id as cover_art_id, f.path as cover_art_path, f.has_cover_art
from media_file f left outer join album a on f.album_id = a.id
where f.album_id in ('%s')
group by album_id order by f.id`, strings.Join(ids, "','"))
@@ -119,10 +119,12 @@ func (r *albumRepository) Refresh(ids ...string) error {
if al.AlbumArtist == "" {
al.AlbumArtist = al.Artist
}
+ al.UpdatedAt = time.Now()
if al.CurrentId != "" {
toUpdate++
} else {
toInsert++
+ al.CreatedAt = time.Now()
}
err := r.Put(&al.Album)
if err != nil {
diff --git a/persistence/user_repository.go b/persistence/user_repository.go
index c03d768a6..8f68d763c 100644
--- a/persistence/user_repository.go
+++ b/persistence/user_repository.go
@@ -48,6 +48,7 @@ func (r *userRepository) Put(u *model.User) error {
u.ID = id.String()
}
u.UserName = strings.ToLower(u.UserName)
+ u.UpdatedAt = time.Now()
values, _ := toSqlArgs(*u)
update := Update(r.tableName).Where(Eq{"id": u.ID}).SetMap(values)
count, err := r.executeSQL(update)
@@ -57,6 +58,7 @@ func (r *userRepository) Put(u *model.User) error {
if count > 0 {
return nil
}
+ values["created_at"] = time.Now()
insert := Insert(r.tableName).SetMap(values)
_, err = r.executeSQL(insert)
return err
diff --git a/ui/public/.gitkeep b/ui/public/.gitkeep
new file mode 100644
index 000000000..e69de29bb