mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
Backend: Move SQL queries to repo package
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
@@ -4,10 +4,10 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/photoprism/photoprism/internal/config"
|
||||
"github.com/photoprism/photoprism/internal/repo"
|
||||
"github.com/photoprism/photoprism/internal/util"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/photoprism/photoprism/internal/photoprism"
|
||||
)
|
||||
|
||||
// TODO: GET /api/v1/dl/file/:hash
|
||||
@@ -22,8 +22,8 @@ func GetDownload(router *gin.RouterGroup, conf *config.Config) {
|
||||
router.GET("/download/:hash", func(c *gin.Context) {
|
||||
fileHash := c.Param("hash")
|
||||
|
||||
search := photoprism.NewSearch(conf.OriginalsPath(), conf.Db())
|
||||
file, err := search.FindFileByHash(fileHash)
|
||||
r := repo.New(conf.OriginalsPath(), conf.Db())
|
||||
file, err := r.FindFileByHash(fileHash)
|
||||
|
||||
if err != nil {
|
||||
c.AbortWithStatusJSON(404, gin.H{"error": err.Error()})
|
||||
|
||||
Reference in New Issue
Block a user