Commit 277e24b4 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] getNodesWithType 1 : unexpectedNull correction.

parent 45283b1f
......@@ -33,7 +33,7 @@ import Opaleye
data PGTSVector
type NodeWrite = NodePoly (Maybe (Column PGInt4)) (Column PGInt4)
(Column PGInt4) (Maybe (Column (Nullable PGInt4)))
(Column PGInt4) (Column (Nullable PGInt4))
(Column (PGText)) (Maybe (Column PGTimestamptz))
(Column PGJsonb) -- (Maybe (Column PGTSVector))
......@@ -96,7 +96,7 @@ nodeTable :: Table NodeWrite NodeRead
nodeTable = Table "nodes" (pNode Node { node_id = optional "id"
, node_typename = required "typename"
, node_userId = required "user_id"
, node_parentId = optional "parent_id"
, node_parentId = required "parent_id"
, node_name = required "name"
, node_date = optional "date"
, node_hyperdata = required "hyperdata"
......@@ -127,8 +127,8 @@ selectNodeWithParentID node_id = proc () -> do
selectNodesWithType :: Column PGInt4 -> Query NodeRead
selectNodesWithType type_id = proc () -> do
row@(Node _id _tn _uid p_id n _d _h) <- queryNodeTable -< ()
restrict -< _tn .== type_id
row@(Node _ tn _ _ _ _ _) <- queryNodeTable -< ()
restrict -< tn .== type_id
--let noParent = ifThenElse (isNull nullableBoss) (pgString "no") (pgString "a")
--returnA -< Node _id _tn _uid (pgInt4 0) (pgString "") _d _h
returnA -< row
......
......@@ -30,9 +30,6 @@ data Language = EN | FR -- | DE | IT | SP
-- > SP == spanish (not implemented yet)
-- > ... add your language and help us to implement it (:
type Ngrams = (Text, Text, Text)
type ErrorMessage = String
-- All the Database is structred like a hierarchical Tree
......@@ -80,7 +77,7 @@ data Metrics = Occurrences | Cooccurrences | Specclusion | Genclusion | Cvalue
-- | NodePoly indicates that Node has a Polymorphism Type
type Node json = NodePoly NodeId NodeTypeId NodeUserId NodeParentId NodeName UTCTime json -- NodeVector
type Node json = NodePoly NodeId NodeTypeId NodeUserId (Maybe NodeParentId) NodeName UTCTime json -- NodeVector
-- type Node json = NodePoly NodeId NodeTypeId UserId ParentId NodeName UTCTime json
type NodeTypeId = Int
type NodeId = Int
......@@ -167,3 +164,13 @@ nodeTypes = [ (NodeUser , 1)
--
nodeTypeId :: NodeType -> NodeTypeId
nodeTypeId tn = fromMaybe (error ("Typename " ++ show tn ++ " does not exist")) (lookup tn nodeTypes)
-- Temporary types to be removed
type Ngrams = (Text, Text, Text)
type ErrorMessage = String
......@@ -22,13 +22,13 @@ data NodePoly id typename userId parentId name date hyperdata = Node { node_id
} deriving (Show)
data Statut = Statut { statut_Date :: Maybe UTCTime
, statut_Error :: Maybe Text
, statut_Action :: Maybe Text
, statut_Complete :: Maybe Bool
, statut_Progress :: Maybe Int
data Status = Status { status_Date :: Maybe UTCTime
, status_Error :: Maybe Text
, status_Action :: Maybe Text
, status_Complete :: Maybe Bool
, status_Progress :: Maybe Int
} deriving (Show, Generic)
$(deriveJSON (unPrefix "statut_") ''Statut)
$(deriveJSON (unPrefix "status_") ''Status)
data HyperdataDocument = HyperdataDocument { hyperdataDocument_Bdd :: Maybe Text
......@@ -38,7 +38,7 @@ data HyperdataDocument = HyperdataDocument { hyperdataDocument_Bdd
, hyperdataDocument_Title :: Maybe Text
, hyperdataDocument_Authors :: Maybe Text
, hyperdataDocument_Abstract :: Maybe Text
, hyperdataDocument_Statuses :: Maybe [Statut]
, hyperdataDocument_Statuses :: Maybe [Status]
, hyperdataDocument_Publication_date :: Maybe Text
, hyperdataDocument_Publication_year :: Maybe Text
, hyperdataDocument_Publication_month :: Maybe Text
......@@ -63,7 +63,7 @@ $(deriveJSON (unPrefix "resource_") ''Resource)
data HyperdataCorpus = HyperdataCorpus { hyperdataCorpus_Action :: Maybe Text
, hyperdataCorpus_Statuses :: Maybe [Statut]
, hyperdataCorpus_Statuses :: Maybe [Status]
, hyperdataCorpus_Languages :: Maybe LanguageNodes
, hyperdataCorpus_Resources :: Maybe [Resource]
, hyperdataCorpus_Language_id :: Maybe Text
......
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