update
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package album
|
||||
|
||||
import (
|
||||
"git.trj.tw/golang/go-gallery/models"
|
||||
"git.trj.tw/golang/go-gallery/modules/context"
|
||||
)
|
||||
|
||||
// GetAllAlbumPhotos -
|
||||
func GetAllAlbumPhotos(c *context.Context) {
|
||||
|
||||
}
|
||||
|
||||
// GetPhoto -
|
||||
func GetPhoto(c *context.Context) {
|
||||
album, ok := c.Get("album")
|
||||
if !ok {
|
||||
c.NotFound("album not found")
|
||||
return
|
||||
}
|
||||
_, err := models.GetPhoto(album.(map[string]interface{})["id"].(string))
|
||||
if err != nil {
|
||||
c.ServerError(nil)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -55,4 +55,8 @@ func SetDefaultRoutes(r *gin.Engine) {
|
||||
albumAPI.PUT("/:id", context.PatchContext(album.UpdateAlbum))
|
||||
albumAPI.DELETE("/:id", context.PatchContext(album.DeleteAlbum))
|
||||
}
|
||||
photoAPI := albumAPI.Group("/:album/photo", context.PatchContext(middleware.VerifyToken), context.PatchContext(middleware.GetAlbumToNext))
|
||||
{
|
||||
photoAPI.GET("/", context.PatchContext(album.GetPhoto))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user