e3bb8b19dd
Also improves migrations and updates the db schema docs. Signed-off-by: Michael Mayer <michael@photoprism.app>
36 lines
799 B
Go
36 lines
799 B
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/photoprism/photoprism/internal/acl"
|
|
"github.com/photoprism/photoprism/internal/get"
|
|
"github.com/photoprism/photoprism/internal/query"
|
|
"github.com/photoprism/photoprism/pkg/txt"
|
|
)
|
|
|
|
// GetMomentsTime returns monthly albums as JSON.
|
|
//
|
|
// GET /api/v1/moments/time
|
|
func GetMomentsTime(router *gin.RouterGroup) {
|
|
router.GET("/moments/time", func(c *gin.Context) {
|
|
s := Auth(c, acl.ResourceCalendar, acl.ActionSearch)
|
|
|
|
if s.Abort(c) {
|
|
return
|
|
}
|
|
|
|
conf := get.Config()
|
|
|
|
result, err := query.MomentsTime(1, conf.Settings().Features.Private)
|
|
|
|
if err != nil {
|
|
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"error": txt.UpperFirst(err.Error())})
|
|
return
|
|
}
|
|
|
|
c.JSON(http.StatusOK, result)
|
|
})
|
|
}
|