diff options
author | 2025-02-20 12:29:35 +0100 | |
---|---|---|
committer | 2025-02-20 18:36:23 +0100 | |
commit | caf72faccc04e647c27e1b5eef85c515949d8210 (patch) | |
tree | ec32dda7b87c12712307d2d101368fed5888d4b9 /backend/lib/ACMS/API/REST/Collection | |
parent | 3c64b52017e7c16da0d017c033c77eee5d7a4340 (diff) |
consolidate `backend, cli, common` -> `acms`
Diffstat (limited to 'backend/lib/ACMS/API/REST/Collection')
-rw-r--r-- | backend/lib/ACMS/API/REST/Collection/Paginated.hs | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/backend/lib/ACMS/API/REST/Collection/Paginated.hs b/backend/lib/ACMS/API/REST/Collection/Paginated.hs deleted file mode 100644 index 159754a..0000000 --- a/backend/lib/ACMS/API/REST/Collection/Paginated.hs +++ /dev/null @@ -1,33 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE RecordWildCards #-} - -module ACMS.API.REST.Collection.Paginated where - -import ACMS.API.Fetch -import ACMS.API.REST (restRequest) -import Collection -import Data.Aeson qualified as A -import Data.Function ((&)) -import GHC.Generics (Generic) -import Text.Printf (printf) - -data Pagination = Pagination - { limit :: Int, - offset :: Int - } - -data Paginated a = Paginated - { count :: Int, - data_ :: [a] - } - deriving (Eq, Show, Generic) - -instance (A.FromJSON a) => A.FromJSON (Paginated a) - -instance (A.ToJSON a) => A.ToJSON (Paginated a) - -list :: (APIMonad m) => Pagination -> Collection -> m (Paginated A.Object) -list p c = - restRequest (printf "/collection/%s/paginated/%d/%d" c.name p.limit p.offset) - & fetch - >>= A.throwDecode |