This commit is contained in:
Jay
2018-04-30 10:13:01 +08:00
parent 1b8416dba3
commit e33c51727a
4 changed files with 106 additions and 1 deletions
+25
View File
@@ -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
}
}
+4
View File
@@ -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))
}
}