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

[REST] Tree.

parent a18c8462
...@@ -191,11 +191,11 @@ type SwaggerAPI = SwaggerSchemaUI "swagger-ui" "swagger.json" ...@@ -191,11 +191,11 @@ type SwaggerAPI = SwaggerSchemaUI "swagger-ui" "swagger.json"
-- | API for serving main operational routes of @gargantext.org@ -- | API for serving main operational routes of @gargantext.org@
type GargAPI = "api" :> Summary "Version API" :> GargAPIVersion type GargAPI = "api" :> Summary "API " :> GargAPIVersion
-- | TODO :<|> Summary "Latest API" :> GargAPI' -- | TODO :<|> Summary "Latest API" :> GargAPI'
type GargAPIVersion = "v1.0" :> Summary "API v1.0: " :> GargAPI' type GargAPIVersion = "v1.0" :> Summary "v1.0: " :> GargAPI'
type GargAPI' = type GargAPI' =
......
...@@ -62,6 +62,8 @@ type Roots = Get '[JSON] [Node Value] ...@@ -62,6 +62,8 @@ type Roots = Get '[JSON] [Node Value]
type NodesAPI = Delete '[JSON] Int type NodesAPI = Delete '[JSON] Int
type NodeAPI = Get '[JSON] (Node Value) type NodeAPI = Get '[JSON] (Node Value)
:<|> Post '[JSON] Int
:<|> Put '[JSON] Int
:<|> Delete '[JSON] Int :<|> Delete '[JSON] Int
:<|> "children" :> Summary " Summary children" :<|> "children" :> Summary " Summary children"
:> QueryParam "type" NodeType :> QueryParam "type" NodeType
...@@ -119,6 +121,8 @@ treeAPI _ _ = undefined ...@@ -119,6 +121,8 @@ treeAPI _ _ = undefined
nodeAPI :: Connection -> NodeId -> Server NodeAPI nodeAPI :: Connection -> NodeId -> Server NodeAPI
nodeAPI conn id = liftIO (putStrLn ("/node" :: Text) >> getNode conn id ) nodeAPI conn id = liftIO (putStrLn ("/node" :: Text) >> getNode conn id )
:<|> postNode conn id
:<|> putNode conn id
:<|> deleteNode' conn id :<|> deleteNode' conn id
:<|> getNodesWith' conn id :<|> getNodesWith' conn id
:<|> getFacet conn id :<|> getFacet conn id
...@@ -126,11 +130,15 @@ nodeAPI conn id = liftIO (putStrLn ("/node" :: Text) >> getNode co ...@@ -126,11 +130,15 @@ nodeAPI conn id = liftIO (putStrLn ("/node" :: Text) >> getNode co
-- :<|> upload -- :<|> upload
-- :<|> query -- :<|> query
nodesAPI :: Connection -> [NodeId] -> Server NodesAPI nodesAPI :: Connection -> [NodeId] -> Server NodesAPI
nodesAPI conn ids = deleteNodes' conn ids nodesAPI conn ids = deleteNodes' conn ids
postNode :: Connection -> NodeId -> Handler Int
postNode = undefined
putNode :: Connection -> NodeId -> Handler Int
putNode = undefined
deleteNodes' :: Connection -> [NodeId] -> Handler Int deleteNodes' :: Connection -> [NodeId] -> Handler Int
deleteNodes' conn ids = liftIO (deleteNodes conn ids) deleteNodes' conn ids = liftIO (deleteNodes conn ids)
......
...@@ -56,9 +56,7 @@ gargNode = [userTree] ...@@ -56,9 +56,7 @@ gargNode = [userTree]
-- | User Tree simplified -- | User Tree simplified
userTree :: Tree NodeTree userTree :: Tree NodeTree
userTree = TreeN (NodeTree "user name" NodeUser 1) $ userTree = TreeN (NodeTree "user name" NodeUser 1) [annuaireTree, projectTree]
[leafT $ NodeTree "MyPage" UserPage 0] <>
[annuaireTree, projectTree]
-- | Project Tree -- | Project Tree
projectTree :: Tree NodeTree projectTree :: Tree NodeTree
...@@ -73,7 +71,9 @@ annuaireTree = TreeN (NodeTree "Annuaire" Annuaire 41) ( [leafT $ NodeTree "IM ...@@ -73,7 +71,9 @@ annuaireTree = TreeN (NodeTree "Annuaire" Annuaire 41) ( [leafT $ NodeTree "IM
) )
corpusTree :: NodeId -> Text -> Tree NodeTree corpusTree :: NodeId -> Text -> Tree NodeTree
corpusTree nId t = TreeN (NodeTree ("Corpus " <> t) NodeCorpus nId) ( [ leafT $ NodeTree "Documents" Document (nId +1)] corpusTree nId t = TreeN (NodeTree ("Corpus " <> t) NodeCorpus nId) ( [ leafT $ NodeTree "Dashboard" Dashboard (nId +1)
, leafT $ NodeTree "Graph" Graph (nId +2)
]
-- <> [ leafT $ NodeTree "My lists" Lists 5] -- <> [ leafT $ NodeTree "My lists" Lists 5]
-- <> [ leafT (NodeTree "Metrics A" Metrics 6) ] -- <> [ leafT (NodeTree "Metrics A" Metrics 6) ]
-- <> [ leafT (NodeTree "Class A" Classification 7)] -- <> [ leafT (NodeTree "Class A" Classification 7)]
......
...@@ -274,7 +274,11 @@ type NodeCorpus = Node HyperdataCorpus ...@@ -274,7 +274,11 @@ type NodeCorpus = Node HyperdataCorpus
type Document = Node HyperdataDocument type Document = Node HyperdataDocument
------------------------------------------------------------------------ ------------------------------------------------------------------------
data NodeType = NodeUser | Project | Folder | NodeCorpus | Annuaire | Document | Individu | UserPage | DocumentCopy | Favorites data NodeType = NodeUser | Project | Folder
| NodeCorpus | Annuaire
| Document | Individu
| UserPage | DocumentCopy | Favorites
| Dashboard | Graph
| Classification | Classification
| Lists | Lists
| Metrics | Occurrences | Metrics | Occurrences
......
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