aboutsummaryrefslogtreecommitdiff
path: root/internal/api/photos.go
diff options
context:
space:
mode:
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)