diff options
| author | RanXom <saiyedshizain@gmail.com> | 2026-07-17 16:51:34 +0530 |
|---|---|---|
| committer | RanXom <saiyedshizain@gmail.com> | 2026-07-17 16:51:34 +0530 |
| commit | 26509c338271ff2adc2ffc4d53270fa0b3f1f937 (patch) | |
| tree | 223c0ecf4a891fc5316f9a9a78424b9491db2804 /internal/api/photos.go | |
| parent | 9237991fa79f9b90a3f14f8b3c42dab25d029f05 (diff) | |
| download | galleryd-26509c338271ff2adc2ffc4d53270fa0b3f1f937.tar.xz galleryd-26509c338271ff2adc2ffc4d53270fa0b3f1f937.zip | |
feat(api): parse pagination query parameters
Diffstat (limited to 'internal/api/photos.go')
| -rw-r--r-- | internal/api/photos.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/internal/api/photos.go b/internal/api/photos.go index 1e9db99..e777914 100644 --- a/internal/api/photos.go +++ b/internal/api/photos.go @@ -4,17 +4,26 @@ import ( "encoding/json" "log" "net/http" - - "github.com/RanXom/galleryd/internal/gallery" ) func (s *Server) handlePhotos( w http.ResponseWriter, r *http.Request, ) { + query, err := parseQuery(r) + if err != nil { + writeError( + w, + http.StatusBadRequest, + "invalid query parameters", + ) + + return + } + photos, err := s.gallery.Gallery( r.Context(), - gallery.Query{}, + query, ) if err != nil { log.Printf("build gallery: %v", err) |