Commit 2a3bd023 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX MERGE]

parents 4a5fdbd6 e088850c
......@@ -34,6 +34,7 @@ library:
- -Wunused-binds
- -Wunused-imports
- -Werror
- -freduction-depth=300
exposed-modules:
- Gargantext
- Gargantext.API
......
This diff is collapsed.
......@@ -82,7 +82,7 @@ type NodesAPI = Delete '[JSON] Int
-- Be careful: really delete nodes
-- Access by admin only
nodesAPI :: [NodeId] -> GargServer NodesAPI
nodesAPI ids = deleteNodes ids
nodesAPI = deleteNodes
------------------------------------------------------------------------
-- | TODO-ACCESS: access by admin only.
......@@ -222,22 +222,6 @@ nodeAPI p uId id' = withAccess (Proxy :: Proxy (NodeAPI a)) Proxy uId (PathNode
-- :<|> nodeAddAPI id'
-- :<|> postUpload id'
scatterApi :: NodeId -> GargServer ScatterAPI
scatterApi id' = getScatter id'
:<|> updateScatter id'
chartApi :: NodeId -> GargServer ChartApi
chartApi id' = getChart id'
:<|> updateChart id'
pieApi :: NodeId -> GargServer PieApi
pieApi id' = getPie id'
:<|> updatePie id'
treeApi :: NodeId -> GargServer TreeApi
treeApi id' = getTree id'
:<|> updateTree id'
------------------------------------------------------------------------
data RenameNode = RenameNode { r_name :: Text }
deriving (Generic)
......
......@@ -86,15 +86,13 @@ getGraph _uId nId = do
$ nodeGraph ^. node_parentId
-- TODO Distance in Graph params
g <- case graph of
case graph of
Nothing -> do
graph' <- computeGraph cId Conditional NgramsTerms repo
_ <- updateHyperdata nId (HyperdataGraph $ Just graph')
pure $ trace "[G.V.G.API] Graph empty, computing" $ graph'
pure $ trace "[G.V.G.API] Graph empty, computing" graph'
Just graph' -> pure $ trace "[G.V.G.API] Graph exists, returning" $ graph'
pure g
Just graph' -> pure $ trace "[G.V.G.API] Graph exists, returning" graph'
recomputeGraph :: UserId -> NodeId -> Distance -> GargNoServer Graph
......@@ -113,19 +111,18 @@ recomputeGraph _uId nId d = do
identity
$ nodeGraph ^. node_parentId
g <- case graph of
case graph of
Nothing -> do
graph' <- computeGraph cId d NgramsTerms repo
_ <- updateHyperdata nId (HyperdataGraph $ Just graph')
pure $ trace "[G.V.G.API.recomputeGraph] Graph empty, computed" $ graph'
pure $ trace "[G.V.G.API.recomputeGraph] Graph empty, computed" graph'
Just graph' -> if listVersion == Just v
then pure graph'
else do
graph'' <- computeGraph cId d NgramsTerms repo
_ <- updateHyperdata nId (HyperdataGraph $ Just graph'')
pure $ trace "[G.V.G.API] Graph exists, recomputing" $ graph''
pure g
pure $ trace "[G.V.G.API] Graph exists, recomputing" graph''
-- TODO use Database Monad only here ?
......@@ -224,7 +221,7 @@ getGraphGexf :: UserId
-> GargNoServer (Headers '[Servant.Header "Content-Disposition" Text] Graph)
getGraphGexf uId nId = do
graph <- getGraph uId nId
pure $ addHeader (concat [ "attachment; filename=graph.gexf" ]) graph
pure $ addHeader "attachment; filename=graph.gexf" graph
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