module Controller.User
  ( list
  ) where

import           Control.Monad.IO.Class (liftIO)
import           Web.Scotty             (ActionM)
import qualified Web.Scotty             as S

import qualified Model.Query            as Query
import qualified Persistence.User       as UserPersistence
import qualified Secure

list :: ActionM ()
list =
  Secure.loggedAction (\_ ->
    (liftIO . Query.run $ UserPersistence.list) >>= S.json
  )