fix navbar and guest user checks

previously guest users would cause a response 500 if a private album existed, meaning they couldn't see any albums
they also couldn't load media in any album due to requiring an access token
This commit is contained in:
wisplite
2025-11-23 02:58:03 -06:00
parent 8759783ebb
commit c7d478271d
6 changed files with 60 additions and 7 deletions
+9
View File
@@ -83,6 +83,15 @@ func GetAllMediaInAlbum(albumID string, accessToken string) ([]models.Media, err
return media, nil
}
func GetAllMediaInPublicAlbum(albumID string) ([]models.Media, error) {
media := []models.Media{}
result := db.GetDB().Where("album_id = ?", albumID).Find(&media)
if result.Error != nil {
return []models.Media{}, result.Error
}
return media, nil
}
func GetMedia(albumID string, mediaID string) (models.Media, error) {
media := models.Media{}
result := db.GetDB().First(&media, "album_id = ? AND id = ?", albumID, mediaID)