Adding initial scaffolding to rename the repository
Signed-off-by: Kris Nóva <kris@nivenly.com>
This commit is contained in:
parent
c7472582a7
commit
0f880ac1fa
46 changed files with 5707 additions and 674 deletions
32
internal/api/moments_time.go
Normal file
32
internal/api/moments_time.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/photoprism/photoprism/internal/acl"
|
||||
"github.com/photoprism/photoprism/internal/query"
|
||||
"github.com/photoprism/photoprism/pkg/txt"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// GET /api/v1/moments/time
|
||||
func GetMomentsTime(router *gin.RouterGroup) {
|
||||
router.GET("/moments/time", func(c *gin.Context) {
|
||||
s := Auth(SessionID(c), acl.ResourceAlbums, acl.ActionExport)
|
||||
|
||||
if s.Invalid() {
|
||||
AbortUnauthorized(c)
|
||||
return
|
||||
}
|
||||
|
||||
result, err := query.MomentsTime(1)
|
||||
|
||||
if err != nil {
|
||||
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{"error": txt.UcFirst(err.Error())})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, result)
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue