Profile tracks is now a separate package

This commit is contained in:
2018-03-14 18:21:22 +01:00
parent 1a380f3139
commit 5b05d82b7d
7 changed files with 98 additions and 76 deletions

View File

@ -0,0 +1,18 @@
package profiletracks
import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
)
// Added shows all soundtracks added by a particular user.
func Added(ctx *aero.Context) string {
return render(ctx, addedTracks)
}
// addedTracks returns all soundtracks that the user with the given user ID published.
func addedTracks(userID string) []*arn.SoundTrack {
return arn.FilterSoundTracks(func(track *arn.SoundTrack) bool {
return !track.IsDraft && len(track.Media) > 0 && track.CreatedBy == userID
})
}