]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Schema/NodeNode.hs
[auth] forgot password async endpoint
[gargantext.git] / src / Gargantext / Database / Schema / NodeNode.hs
1 {-|
2 Module : Gargantext.Database.Schema.NodeNode
3 Description :
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 Here is a longer description of this module, containing some
11 commentary with @some markup@.
12 -}
13
14 {-# LANGUAGE Arrows #-}
15 {-# LANGUAGE FunctionalDependencies #-}
16 {-# LANGUAGE QuasiQuotes #-}
17 {-# LANGUAGE TemplateHaskell #-}
18
19 module Gargantext.Database.Schema.NodeNode where
20
21 import Gargantext.Core.Types
22 import Gargantext.Database.Schema.Prelude
23 import Gargantext.Prelude
24
25
26 data NodeNodePoly node1_id node2_id score cat
27 = NodeNode { _nn_node1_id :: !node1_id
28 , _nn_node2_id :: !node2_id
29 , _nn_score :: !score
30 , _nn_category :: !cat
31 } deriving (Show)
32
33 type NodeNodeWrite = NodeNodePoly (Column (SqlInt4))
34 (Column (SqlInt4))
35 (Maybe (Column (SqlFloat8)))
36 (Maybe (Column (SqlInt4)))
37
38 type NodeNodeRead = NodeNodePoly (Column (SqlInt4))
39 (Column (SqlInt4))
40 (Column (SqlFloat8))
41 (Column (SqlInt4))
42
43 type NodeNodeReadNull = NodeNodePoly (Column (Nullable SqlInt4))
44 (Column (Nullable SqlInt4))
45 (Column (Nullable SqlFloat8))
46 (Column (Nullable SqlInt4))
47
48 type NodeNode = NodeNodePoly NodeId NodeId (Maybe Double) (Maybe Int)
49
50 $(makeAdaptorAndInstance "pNodeNode" ''NodeNodePoly)
51 makeLenses ''NodeNodePoly
52
53 nodeNodeTable :: Table NodeNodeWrite NodeNodeRead
54 nodeNodeTable =
55 Table "nodes_nodes"
56 ( pNodeNode
57 NodeNode { _nn_node1_id = requiredTableField "node1_id"
58 , _nn_node2_id = requiredTableField "node2_id"
59 , _nn_score = optionalTableField "score"
60 , _nn_category = optionalTableField "category"
61 }
62 )
63