aboutsummaryrefslogtreecommitdiff
path: root/internal/api/photos.go
diff options
context:
space:
mode:
authorSaiyed Shizain <saiyedshizain@gmail.com>2026-07-22 17:32:55 +0530
committerGitHub <noreply@github.com>2026-07-22 17:32:55 +0530
commit9b541ca2d0a639eebd9610fcd6385e841da68e0a (patch)
treed331e8d858f62cf82d0cb6c3ca96400d4e28edca /internal/api/photos.go
parent46d2bf8bb5a0d18bdbe613a9346a5757b39e0a35 (diff)
parentddd8a37a0eb5623960e4528802263c7cec23af87 (diff)
downloadgalleryd-9b541ca2d0a639eebd9610fcd6385e841da68e0a.tar.xz
galleryd-9b541ca2d0a639eebd9610fcd6385e841da68e0a.zip
Merge pull request #13 from RanXom/feat/api
Feat/api: add sorting support to gallery queries
Diffstat (limited to 'internal/api/photos.go')
-rw-r--r--internal/api/photos.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/internal/api/photos.go b/internal/api/photos.go
index ca6b038..e777914 100644
--- a/internal/api/photos.go
+++ b/internal/api/photos.go
@@ -10,7 +10,21 @@ func (s *Server) handlePhotos(
w http.ResponseWriter,
r *http.Request,
) {
- photos, err := s.gallery.Gallery(r.Context())
+ query, err := parseQuery(r)
+ if err != nil {
+ writeError(
+ w,
+ http.StatusBadRequest,
+ "invalid query parameters",
+ )
+
+ return
+ }
+
+ photos, err := s.gallery.Gallery(
+ r.Context(),
+ query,
+ )
if err != nil {
log.Printf("build gallery: %v", err)