mirror of
https://github.com/wisplite/raster.git
synced 2026-05-01 06:32:44 -05:00
add album editing and start working on file picker component for picking thumbnail
This commit is contained in:
@@ -25,6 +25,22 @@ func RegisterAlbumRoutes(rg *gin.RouterGroup) {
|
||||
}
|
||||
c.JSON(http.StatusOK, albums)
|
||||
})
|
||||
album.POST("/getAlbum", func(c *gin.Context) {
|
||||
accessToken := c.GetHeader("Authorization")
|
||||
var request struct {
|
||||
ID string `json:"id"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&request); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
album, err := services.GetAlbum(request.ID, accessToken)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, album)
|
||||
})
|
||||
album.POST("/createAlbum", func(c *gin.Context) {
|
||||
accessToken := c.GetHeader("Authorization")
|
||||
if accessToken == "" {
|
||||
@@ -47,6 +63,28 @@ func RegisterAlbumRoutes(rg *gin.RouterGroup) {
|
||||
}
|
||||
c.JSON(http.StatusOK, result)
|
||||
})
|
||||
album.POST("/editAlbum", func(c *gin.Context) {
|
||||
accessToken := c.GetHeader("Authorization")
|
||||
if accessToken == "" {
|
||||
c.JSON(http.StatusUnauthorized, gin.H{"error": "Unauthorized"})
|
||||
return
|
||||
}
|
||||
var request struct {
|
||||
ID string `json:"id"`
|
||||
Properties map[string]interface{} `json:"properties"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&request); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
result, err := services.EditAlbum(accessToken, request.ID, request.Properties)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, result)
|
||||
})
|
||||
|
||||
album.POST("/getIDFromPath", func(c *gin.Context) {
|
||||
var request struct {
|
||||
Path string `json:"path"`
|
||||
|
||||
Reference in New Issue
Block a user