add thumbnail field to album model, update album retrieval to use POST method, and enhance album list component with dynamic fetching

This commit is contained in:
wisplite
2025-11-22 22:10:41 -06:00
parent 432a9e5229
commit 8035be9a60
5 changed files with 42 additions and 4 deletions
+1
View File
@@ -15,6 +15,7 @@ type Album struct {
// Public albums have a default access level of 0 for all visitors, including guests.
// Private albums require a user with access to be logged in to view, or a magic link to be used.
ParentID string `gorm:"not null"` // The ID of the parent album, if any. This is an empty string for root albums.
Thumbnail string `gorm:"not null"` // The media ID of the thumbnail for the album.
CreatedAt time.Time
UpdatedAt time.Time
}
+1 -1
View File
@@ -9,7 +9,7 @@ import (
func RegisterAlbumRoutes(rg *gin.RouterGroup) {
album := rg.Group("/albums")
album.GET("/getAlbumsInParent", func(c *gin.Context) {
album.POST("/getAlbumsInParent", func(c *gin.Context) {
accessToken := c.GetHeader("Authorization")
if accessToken == "" {
c.JSON(http.StatusUnauthorized, gin.H{"error": "Unauthorized"})
+1
View File
@@ -73,6 +73,7 @@ func CreateAlbum(accessToken string, title string, description string, parentID
Title: title,
Description: description,
ParentID: parentID,
Thumbnail: "",
}
result := db.GetDB().Create(&album)
if result.Error != nil {