]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Types/Node.hs
[TEXT] String to Text in Servant file.
[gargantext.git] / src / Gargantext / Types / Node.hs
1 {-# LANGUAGE TemplateHaskell #-}
2 {-# LANGUAGE DeriveGeneric #-}
3 -- {-# LANGUAGE DuplicateRecordFields #-}
4
5 module Gargantext.Types.Node where
6
7 import Gargantext.Prelude
8
9 import Text.Show (Show())
10 import Data.Text (Text)
11 import GHC.Generics (Generic)
12 import Data.Time (UTCTime)
13 import Gargantext.Utils.Prefix (unPrefix)
14 import Data.Aeson.TH (deriveJSON)
15
16 -- node_Id... ?
17 data NodePoly id typename userId parentId name date hyperdata = Node { node_id :: id
18 , node_typename :: typename
19 , node_userId :: userId
20 -- , nodeHashId :: hashId
21 , node_parentId :: parentId
22 , node_name :: name
23 , node_date :: date
24 , node_hyperdata :: hyperdata
25 -- , node_titleAbstract :: titleAbstract
26 } deriving (Show)
27 $(deriveJSON (unPrefix "node_") ''NodePoly)
28
29
30 data Status = Status { status_Date :: Maybe UTCTime
31 , status_Error :: Maybe Text
32 , status_Action :: Maybe Text
33 , status_Complete :: Maybe Bool
34 , status_Progress :: Maybe Int
35 } deriving (Show, Generic)
36 $(deriveJSON (unPrefix "status_") ''Status)
37
38
39 data HyperdataDocument = HyperdataDocument { hyperdataDocument_Bdd :: Maybe Text
40 , hyperdataDocument_Doi :: Maybe Text
41 , hyperdataDocument_Url :: Maybe Text
42 , hyperdataDocument_Page :: Maybe Int
43 , hyperdataDocument_Title :: Maybe Text
44 , hyperdataDocument_Authors :: Maybe Text
45 , hyperdataDocument_Abstract :: Maybe Text
46 , hyperdataDocument_Statuses :: Maybe [Status]
47 , hyperdataDocument_Publication_date :: Maybe Text
48 , hyperdataDocument_Publication_year :: Maybe Text
49 , hyperdataDocument_Publication_month :: Maybe Text
50 , hyperdataDocument_Publication_hour :: Maybe Text
51 , hyperdataDocument_Publication_minute :: Maybe Text
52 , hyperdataDocument_Publication_second :: Maybe Text
53 , hyperdataDocument_LanguageIso2 :: Maybe Text
54 } deriving (Show, Generic)
55 $(deriveJSON (unPrefix "hyperdataDocument_") ''HyperdataDocument)
56
57 data LanguageNodes = LanguageNodes { languageNodes___unknown__ :: [Int]}
58 deriving (Show, Generic)
59 $(deriveJSON (unPrefix "languageNodes_") ''LanguageNodes)
60
61
62 data Resource = Resource { resource_Url :: Maybe Text
63 , resource_Path :: Maybe Text
64 , resource_Type :: Maybe Int
65 , resource_Extracted :: Maybe Bool
66 } deriving (Show, Generic)
67 $(deriveJSON (unPrefix "resource_") ''Resource)
68
69
70 data HyperdataCorpus = HyperdataCorpus { hyperdataCorpus_Action :: Maybe Text
71 , hyperdataCorpus_Statuses :: Maybe [Status]
72 , hyperdataCorpus_Languages :: Maybe LanguageNodes
73 , hyperdataCorpus_Resources :: Maybe [Resource]
74 , hyperdataCorpus_Language_id :: Maybe Text
75 , hyperdataCorpus_Skipped_docs :: Maybe [Int]
76 } deriving (Show, Generic)
77 $(deriveJSON (unPrefix "hyperdataCorpus_") ''HyperdataCorpus)
78
79
80
81 data HyperdataUser = HyperdataUser { hyperdataUser_language :: Maybe Text
82 } deriving (Show, Generic)
83 $(deriveJSON (unPrefix "hyperdataUser_") ''HyperdataUser)
84
85 -- Preferences ?
86
87 data HyperdataFolder = HyperdataFolder { hyperdataFolder_Preferences :: Maybe Text
88 } deriving (Show, Generic)
89 $(deriveJSON (unPrefix "hyperdataFolder_") ''HyperdataFolder)
90
91
92 data HyperdataProject = HyperdataProject { hyperdataProject_Preferences :: Maybe Text
93 } deriving (Show, Generic)
94 $(deriveJSON (unPrefix "hyperdataProject_") ''HyperdataProject)
95
96
97
98 data HyperdataList = HyperdataList { hyperdataList_Preferences :: Maybe Text
99 } deriving (Show, Generic)
100 $(deriveJSON (unPrefix "hyperdataList_") ''HyperdataList)
101
102 data HyperdataScore = HyperdataScore { hyperdataScore_Preferences :: Maybe Text
103 } deriving (Show, Generic)
104 $(deriveJSON (unPrefix "hyperdataScore_") ''HyperdataScore)
105
106
107
108 data HyperdataFavorites = HyperdataFavorites { hyperdataFavorites_Preferences :: Maybe Text
109 } deriving (Show, Generic)
110 $(deriveJSON (unPrefix "hyperdataFavorites_") ''HyperdataFavorites)
111
112 data HyperdataResource = HyperdataResource { hyperdataResource_Preferences :: Maybe Text
113 } deriving (Show, Generic)
114 $(deriveJSON (unPrefix "hyperdataResource_") ''HyperdataResource)
115
116
117
118 -- TODO add the Graph Structure here
119 data HyperdataGraph = HyperdataGraph { hyperdataGraph_Preferences :: Maybe Text
120 } deriving (Show, Generic)
121 $(deriveJSON (unPrefix "hyperdataGraph_") ''HyperdataGraph)
122
123
124 -- TODO add the Graph Structure here
125 data HyperdataPhylo = HyperdataPhylo { hyperdataPhylo_Preferences :: Maybe Text
126 } deriving (Show, Generic)
127 $(deriveJSON (unPrefix "hyperdataPhylo_") ''HyperdataPhylo)
128
129 -- | TODO FEATURE: Notebook saved in the node (to work with Python or Haskell)
130 data HyperdataNotebook = HyperdataNotebook { hyperdataNotebook_Preferences :: Maybe Text
131 } deriving (Show, Generic)
132 $(deriveJSON (unPrefix "hyperdataNotebook_") ''HyperdataNotebook)