]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/API/Node/Document/Export.hs
[document export] add garg version
[gargantext.git] / src / Gargantext / API / Node / Document / Export.hs
1 {-|
2 Module : Gargantext.API.Node.Document.Export
3 Description : Document export
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9 -}
10
11 module Gargantext.API.Node.Document.Export
12 where
13
14 import qualified Data.Text as T
15 import Data.Version (showVersion)
16 import Gargantext.API.Node.Document.Export.Types
17 import Gargantext.API.Prelude (GargNoServer)
18 import Gargantext.Core.Types
19 -- import Gargantext.Database.Admin.Types.Hyperdata (HyperdataDocument(..))
20 import Gargantext.Database.Query.Table.Node (getDocumentsWithParentId)
21 import Gargantext.Prelude
22 import qualified Paths_gargantext as PG -- cabal magic build module
23 -- import Servant (Proxy(..))
24
25 --------------------------------------------------
26 -- | Hashes are ordered by Set
27 getDocuments :: DocId
28 -> GargNoServer DocumentExport
29 getDocuments pId = do
30 printDebug "[getDocuments] pId" pId
31 docs <- getDocumentsWithParentId pId -- NodeDocument (Proxy :: Proxy HyperdataDocument)
32 printDebug "[getDocuments] got docs" docs
33 pure $ DocumentExport { _de_documents = mapDoc <$> docs
34 , _de_garg_version = T.pack $ showVersion PG.version }
35 where
36 mapDoc d = Document { _d_document = d
37 , _d_ngrams = Ngrams { _ng_ngrams = []
38 , _ng_hash = "" }
39 , _d_hash = ""}