Commit dc98f9f5 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[API] question about Servant route refactoring.

parent 38449989
...@@ -103,7 +103,7 @@ instance Arbitrary PostNode where ...@@ -103,7 +103,7 @@ instance Arbitrary PostNode where
arbitrary = elements [PostNode "Node test" NodeCorpus] arbitrary = elements [PostNode "Node test" NodeCorpus]
------------------------------------------------------------------------ ------------------------------------------------------------------------
type DocsApi = "documents" :> Summary "Docs api" type DocsApi = Summary "Move to trash"
:> ReqBody '[JSON] Documents :> ReqBody '[JSON] Documents
:> Delete '[JSON] [Int] :> Delete '[JSON] [Int]
...@@ -119,10 +119,10 @@ delDocs c cId ds = liftIO $ nodesToTrash c ...@@ -119,10 +119,10 @@ delDocs c cId ds = liftIO $ nodesToTrash c
$ map (\n -> (cId, n, True)) $ documents ds $ map (\n -> (cId, n, True)) $ documents ds
------------------------------------------------------------------------ ------------------------------------------------------------------------
type FavApi = "favorites" :> Summary "Modify statut" type FavApi = Summary "Label as Favorites"
:> ReqBody '[JSON] Favorites :> ReqBody '[JSON] Favorites
:> Put '[JSON] [Int] :> Put '[JSON] [Int]
:<|> Summary "Delete" :<|> Summary "Unlabel as Favorites"
:> ReqBody '[JSON] Favorites :> ReqBody '[JSON] Favorites
:> Delete '[JSON] [Int] :> Delete '[JSON] [Int]
...@@ -161,6 +161,10 @@ type NodeAPI a = Get '[JSON] (Node a) ...@@ -161,6 +161,10 @@ type NodeAPI a = Get '[JSON] (Node a)
:> QueryParam "limit" Int :> QueryParam "limit" Int
:> Get '[JSON] [Node a] :> Get '[JSON] [Node a]
:<|> Summary " Tabs" :> FacetDocAPI :<|> Summary " Tabs" :> FacetDocAPI
-- How TODO ?
-- :<|> "favorites" :> Summary " Favorites" :> FavApi
-- :<|> "documents" :> Summary " Documents" :> DocsApi
-- TODO: make the NodeId type indexed by `a`, then we no longer need the proxy. -- TODO: make the NodeId type indexed by `a`, then we no longer need the proxy.
...@@ -215,8 +219,8 @@ type FacetDocAPI = "table" ...@@ -215,8 +219,8 @@ type FacetDocAPI = "table"
:> QueryParam "from" UTCTime :> QueryParam "from" UTCTime
:> QueryParam "to" UTCTime :> QueryParam "to" UTCTime
:> Get '[JSON] [FacetChart] :> Get '[JSON] [FacetChart]
:<|> Summary " Favorites" :> FavApi :<|> "favorites" :> Summary " Favorites" :> FavApi
:<|> Summary " Documents" :> DocsApi :<|> "documents" :> Summary " Documents" :> DocsApi
-- Depending on the Type of the Node, we could post -- Depending on the Type of the Node, we could post
-- New documents for a corpus -- New documents for a corpus
...@@ -234,7 +238,6 @@ roots conn = liftIO (putStrLn ( "/user" :: Text) >> getNodesWithParentId 0 Nothi ...@@ -234,7 +238,6 @@ roots conn = liftIO (putStrLn ( "/user" :: Text) >> getNodesWithParentId 0 Nothi
:<|> pure (panic "not implemented yet") -- TODO :<|> pure (panic "not implemented yet") -- TODO
:<|> pure (panic "not implemented yet") -- TODO :<|> pure (panic "not implemented yet") -- TODO
------------------------------------------------------------------------ ------------------------------------------------------------------------
type GraphAPI = Get '[JSON] Graph type GraphAPI = Get '[JSON] Graph
graphAPI :: Connection -> NodeId -> Server GraphAPI graphAPI :: Connection -> NodeId -> Server GraphAPI
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment