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