@@ -16,6 +16,7 @@ module Data.Query (
1616 getPosts,
1717 getUser,
1818 getUsers,
19+ getAllUsers,
1920 getLastPosts,
2021 getPostsForUser,
2122 Limit,
@@ -124,6 +125,9 @@ getUsersQ uIds = case idsToColumn uIds of
124125 (#ids ! #id .== #users ! #userId))
125126 Nothing -> Nothing
126127
128+getAllUsersQ :: Query Schema '[] (RowPG User)
129+getAllUsersQ = selectStar $ from $ table #users
130+
127131getPostsByIdQ :: [PostId] -> Maybe (Query Schema '[] (RowPG PostRowResponse))
128132getPostsByIdQ pIds = case idsToColumn pIds of
129133 Just idQ -> Just $ selectDotStar #posts $ from (subquery (idQ `As` #ids) &
@@ -285,6 +289,9 @@ getUser uId = runQueryParams getUserQ (Only uId) >>= getRow 0
285289
286290getUsers :: [UserId] -> StaticPQ (Maybe [User])
287291getUsers ids = getUsersQ ids `liftMaybe` (fmap Just . (runQuery >=> getRows))
292+
293+getAllUsers :: StaticPQ [User]
294+getAllUsers = runQuery getAllUsersQ >>= getRows
288295
289296publishPost :: UserId -> PostCreation -> StaticPQ PostId
290297publishPost uId pc = transactionally_ $ do