Commit 8d82e5dc authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[list] implement updates for remaining list charts

parent d1f8ee96
Pipeline #894 failed with stage
This diff is collapsed.
......@@ -34,7 +34,6 @@ import Data.Aeson (FromJSON, ToJSON)
import Data.Maybe
import Data.Swagger
import Data.Text (Text())
import Data.Time (UTCTime)
import GHC.Generics (Generic)
import Servant
import Test.QuickCheck (elements)
......@@ -43,8 +42,7 @@ import Test.QuickCheck.Arbitrary (Arbitrary, arbitrary)
import Gargantext.API.Admin.Auth (withAccess, PathId(..))
import Gargantext.API.Prelude
import Gargantext.API.Metrics
import Gargantext.API.Ngrams (TabType(..), TableNgramsApi, apiNgramsTableCorpus, QueryParamR)
import Gargantext.API.Ngrams.NTree (MyTree)
import Gargantext.API.Ngrams (TabType(..), TableNgramsApi, apiNgramsTableCorpus)
import Gargantext.API.Node.New
import qualified Gargantext.API.Node.Share as Share
import qualified Gargantext.API.Node.Update as Update
......@@ -52,9 +50,8 @@ import qualified Gargantext.API.Node.Update as Update
import Gargantext.API.Search (SearchDocsAPI, searchDocs, SearchPairsAPI, searchPairs)
import Gargantext.API.Table
import Gargantext.Core.Types (NodeTableResult)
import Gargantext.Core.Types.Main (Tree, NodeTree, ListType)
import Gargantext.Core.Types.Main (Tree, NodeTree)
import Gargantext.Database.Action.Flow.Pairing (pairing)
import Gargantext.Database.Admin.Types.Metrics (ChartMetrics)
import Gargantext.Database.Query.Facet (FacetDoc, OrderBy(..))
import Gargantext.Core.Types.Individu (User(..))
import Gargantext.Database.Query.Table.Node
......@@ -68,7 +65,6 @@ import Gargantext.Database.Prelude -- (Cmd, CmdM)
import Gargantext.Database.Query.Table.NodeNode
import Gargantext.Prelude
import Gargantext.Viz.Phylo.API (PhyloAPI, phyloAPI)
import Gargantext.Viz.Types
import qualified Gargantext.Database.Query.Table.Node.Update as U (update, Update(..))
import qualified Gargantext.Database.Action.Delete as Action (deleteNode)
......@@ -216,20 +212,28 @@ nodeAPI p uId id' = withAccess (Proxy :: Proxy (NodeAPI a)) Proxy uId (PathNode
:<|> scatterApi id'
:<|> chartApi id'
:<|> getPie id'
:<|> getTree id'
:<|> pieApi id'
:<|> treeApi id'
:<|> phyloAPI id' uId
-- :<|> nodeAddAPI id'
-- :<|> postUpload id'
:<|> Update.api uId id'
scatterApi :: NodeId -> GargServer ScatterAPI
scatterApi id' = getScatter id'
scatterApi id' = getScatter id'
:<|> updateScatter id'
chartApi :: NodeId -> GargServer ChartApi
chartApi id' = getChart id'
:<|> updateChart id'
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 }
......@@ -294,33 +298,6 @@ pairWith cId aId lId = do
pure r
------------------------------------------------------------------------
type ChartApi = Summary " Chart API"
:> QueryParam "from" UTCTime
:> QueryParam "to" UTCTime
:> Get '[JSON] (ChartMetrics Histo)
:<|> Summary "SepGen IncExc chart update"
:> QueryParam "list" ListId
:> QueryParamR "ngramsType" TabType
:> QueryParam "limit" Int
:> Post '[JSON] ()
type PieApi = Summary " Chart API"
:> QueryParam "from" UTCTime
:> QueryParam "to" UTCTime
:> QueryParamR "ngramsType" TabType
:> Get '[JSON] (ChartMetrics Histo)
type TreeApi = Summary " Tree API"
:> QueryParam "from" UTCTime
:> QueryParam "to" UTCTime
:> QueryParamR "ngramsType" TabType
:> QueryParamR "listType" ListType
:> Get '[JSON] (ChartMetrics [MyTree])
-- Depending on the Type of the Node, we could post
-- New documents for a corpus
-- New map list terms
-- :<|> "process" :> MultipartForm MultipartData :> Post '[JSON] Text
------------------------------------------------------------------------
type TreeAPI = QueryParams "type" NodeType :> Get '[JSON] (Tree NodeTree)
......
......@@ -26,7 +26,8 @@ import Protolude hiding (ByteString)
import Test.QuickCheck (elements)
import Test.QuickCheck.Arbitrary
import Gargantext.Database.Admin.Types.Metrics (ChartMetrics(..))
import Gargantext.API.Ngrams.NTree (MyTree)
import Gargantext.Database.Admin.Types.Metrics (ChartMetrics(..), Metrics)
import Gargantext.Database.Prelude (fromField')
import Gargantext.Core.Utils.Prefix (unPrefix, unPrefixSwagger)
import Gargantext.Viz.Phylo (Phylo(..))
......@@ -217,8 +218,11 @@ instance Arbitrary HyperdataCorpus where
------------------------------------------------------------------------
data HyperdataList =
HyperdataList { hd_list :: !(Maybe Text)
, hd_chart :: !(Maybe (ChartMetrics Histo))
HyperdataList { hd_chart :: !(Maybe (ChartMetrics Histo))
, hd_list :: !(Maybe Text)
, hd_pie :: !(Maybe (ChartMetrics Histo))
, hd_scatter :: !(Maybe Metrics)
, hd_tree :: !(Maybe (ChartMetrics [MyTree]))
} deriving (Show, Generic)
$(deriveJSON (unPrefix "hd_") ''HyperdataList)
......
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