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

[GRAPH] Version number of List in Graph Type

parent 6e9a3233
Pipeline #4655 failed with stage
in 9 minutes and 23 seconds
...@@ -83,12 +83,24 @@ instance ToSchema LegendField where ...@@ -83,12 +83,24 @@ instance ToSchema LegendField where
declareNamedSchema = genericDeclareNamedSchema (unPrefixSwagger "_lf_") declareNamedSchema = genericDeclareNamedSchema (unPrefixSwagger "_lf_")
makeLenses ''LegendField makeLenses ''LegendField
---------------------------------------------------------------
type Version = Int
data ListForGraph = ListForGraph { _lfg_listId :: ListId
, _lfg_version :: Version
} deriving (Show, Generic)
$(deriveJSON (unPrefix "_lfg_") ''ListForGraph)
instance ToSchema ListForGraph where
declareNamedSchema = genericDeclareNamedSchema (unPrefixSwagger "_lfg_")
makeLenses ''ListForGraph
-- --
data GraphMetadata = GraphMetadata { _gm_title :: Text -- title of the graph data GraphMetadata = GraphMetadata { _gm_title :: Text -- title of the graph
, _gm_corpusId :: [NodeId] -- we can map with different corpus , _gm_corpusId :: [NodeId] -- we can map with different corpus
, _gm_legend :: [LegendField] -- legend of the Graph , _gm_legend :: [LegendField] -- legend of the Graph
, _gm_listId :: ListId , _gm_list :: ListForGraph
, _gm_version :: Int , _gm_version :: Int
} }
deriving (Show, Generic) deriving (Show, Generic)
$(deriveJSON (unPrefix "_gm_") ''GraphMetadata) $(deriveJSON (unPrefix "_gm_") ''GraphMetadata)
......
...@@ -98,12 +98,13 @@ getGraph uId nId = do ...@@ -98,12 +98,13 @@ getGraph uId nId = do
computeGraph :: CorpusId -> NgramsType -> Int -> GargServer (Get '[JSON] Graph) computeGraph :: CorpusId -> NgramsType -> Int -> GargServer (Get '[JSON] Graph)
computeGraph cId nt v = do computeGraph cId nt v = do
lId <- defaultList cId lId <- defaultList cId
v' <- currentVersion
let metadata = GraphMetadata "Title" [cId] let metadata = GraphMetadata "Title" [cId]
[ LegendField 1 "#FFF" "Cluster" [ LegendField 1 "#FFF" "Cluster"
, LegendField 2 "#FFF" "Cluster" , LegendField 2 "#FFF" "Cluster"
] ]
lId (ListForGraph lId v')
v v
-- (map (\n -> LegendField n "#FFFFFF" (pack $ show n)) [1..10]) -- (map (\n -> LegendField n "#FFFFFF" (pack $ show n)) [1..10])
......
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