Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
caef0e8b
Commit
caef0e8b
authored
Jun 15, 2022
by
Karen Konou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NodePoly] Maybe ParentID in NodePoly
parent
70f28cf3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
Types.purs
src/Gargantext/Components/Document/Types.purs
+2
-2
Node.purs
src/Gargantext/Components/Node.purs
+6
-6
Corpus.purs
src/Gargantext/Components/Nodes/Corpus.purs
+6
-6
No files found.
src/Gargantext/Components/Document/Types.purs
View file @
caef0e8b
...
@@ -86,7 +86,7 @@ defaultNodeDocumentV3 =
...
@@ -86,7 +86,7 @@ defaultNodeDocumentV3 =
NodePoly { id : 0
NodePoly { id : 0
, typename : 0
, typename : 0
, userId : 0
, userId : 0
, parentId : 0
, parentId :
Just
0
, name : "Default name"
, name : "Default name"
, date : "Default date"
, date : "Default date"
, hyperdata : defaultDocumentV3
, hyperdata : defaultDocumentV3
...
@@ -148,7 +148,7 @@ defaultNodeDocument =
...
@@ -148,7 +148,7 @@ defaultNodeDocument =
NodePoly { id : 0
NodePoly { id : 0
, typename : 0
, typename : 0
, userId : 0
, userId : 0
, parentId : 0
, parentId :
Just
0
, name : "Default name"
, name : "Default name"
, date : "Default date"
, date : "Default date"
, hyperdata : defaultDocument
, hyperdata : defaultDocument
...
...
src/Gargantext/Components/Node.purs
View file @
caef0e8b
module Gargantext.Components.Node
module Gargantext.Components.Node
where
where
import Data.Generic.Rep (class Generic)
import Gargantext.Prelude
import Data.Eq.Generic (genericEq)
import Data.Eq.Generic (genericEq)
import Data.Maybe (Maybe)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
import Data.Newtype (class Newtype)
import Simple.JSON as JSON
import Simple.JSON as JSON
import Gargantext.Prelude
type NodePolyCommon a =
type NodePolyCommon a =
( id :: Int
( id :: Int
, typename :: Int
, typename :: Int
...
@@ -18,7 +18,7 @@ type NodePolyCommon a =
...
@@ -18,7 +18,7 @@ type NodePolyCommon a =
newtype NodePoly a =
newtype NodePoly a =
NodePoly { userId :: Int
NodePoly { userId :: Int
, parentId :: Int
, parentId ::
Maybe
Int
| NodePolyCommon a
| NodePolyCommon a
}
}
derive instance Generic (NodePoly a) _
derive instance Generic (NodePoly a) _
...
@@ -26,7 +26,7 @@ derive instance Newtype (NodePoly a) _
...
@@ -26,7 +26,7 @@ derive instance Newtype (NodePoly a) _
instance Eq a => Eq (NodePoly a) where eq = genericEq
instance Eq a => Eq (NodePoly a) where eq = genericEq
instance JSON.ReadForeign a => JSON.ReadForeign (NodePoly a) where
instance JSON.ReadForeign a => JSON.ReadForeign (NodePoly a) where
readImpl f = do
readImpl f = do
inst :: { user_id :: Int, parent_id :: Int | NodePolyCommon a } <- JSON.readImpl f
inst :: { user_id :: Int, parent_id ::
Maybe
Int | NodePolyCommon a } <- JSON.readImpl f
pure $ NodePoly { id: inst.id
pure $ NodePoly { id: inst.id
, typename: inst.typename
, typename: inst.typename
, userId: inst.user_id
, userId: inst.user_id
...
...
src/Gargantext/Components/Nodes/Corpus.purs
View file @
caef0e8b
...
@@ -387,8 +387,8 @@ loadCorpus {nodeId, session} = do
...
@@ -387,8 +387,8 @@ loadCorpus {nodeId, session} = do
case res of
case res of
Left err -> pure $ Left err
Left err -> pure $ Left err
Right (NodePoly {parentId: corpusId} :: NodePoly {}) -> do
Right (NodePoly {parentId: corpusId} :: NodePoly {}) -> do
eCorpusNode <- get session $ corpusNodeRoute
corpusId
""
eCorpusNode <- get session $ corpusNodeRoute
(fromMaybe 0 corpusId)
""
eDefaultListIds <- (get session $ defaultListIdsRoute
corpusId
)
eDefaultListIds <- (get session $ defaultListIdsRoute
(fromMaybe 0 corpusId)
)
:: forall a. JSON.ReadForeign a => AffETableResult (NodePoly a)
:: forall a. JSON.ReadForeign a => AffETableResult (NodePoly a)
case eCorpusNode of
case eCorpusNode of
Left err -> pure $ Left err
Left err -> pure $ Left err
...
@@ -398,7 +398,7 @@ loadCorpus {nodeId, session} = do
...
@@ -398,7 +398,7 @@ loadCorpus {nodeId, session} = do
Right defaultListIds -> do
Right defaultListIds -> do
case (A.head defaultListIds.docs :: Maybe (NodePoly HyperdataList)) of
case (A.head defaultListIds.docs :: Maybe (NodePoly HyperdataList)) of
Just (NodePoly { id: defaultListId }) ->
Just (NodePoly { id: defaultListId }) ->
pure $ Right { corpusId, corpusNode, defaultListId }
pure $ Right { corpusId
: (fromMaybe 0 corpusId)
, corpusNode, defaultListId }
Nothing ->
Nothing ->
pure $ Left $ CustomError "Missing default list"
pure $ Left $ CustomError "Missing default list"
...
@@ -425,18 +425,18 @@ loadCorpusWithChild { nodeId: childId, session } = do
...
@@ -425,18 +425,18 @@ loadCorpusWithChild { nodeId: childId, session } = do
Left err -> pure $ Left err
Left err -> pure $ Left err
Right listNode -> do
Right listNode -> do
let (NodePoly {parentId: corpusId} :: NodePoly {}) = listNode
let (NodePoly {parentId: corpusId} :: NodePoly {}) = listNode
eCorpusNode <- get session $ corpusNodeRoute
corpusId
""
eCorpusNode <- get session $ corpusNodeRoute
(fromMaybe 0 corpusId)
""
case eCorpusNode of
case eCorpusNode of
Left err -> pure $ Left err
Left err -> pure $ Left err
Right corpusNode -> do
Right corpusNode -> do
eDefaultListIds <- (get session $ defaultListIdsRoute
corpusId
)
eDefaultListIds <- (get session $ defaultListIdsRoute
(fromMaybe 0 corpusId)
)
:: forall a. JSON.ReadForeign a => AffETableResult (NodePoly a)
:: forall a. JSON.ReadForeign a => AffETableResult (NodePoly a)
case eDefaultListIds of
case eDefaultListIds of
Left err -> pure $ Left err
Left err -> pure $ Left err
Right defaultListIds -> do
Right defaultListIds -> do
case (A.head defaultListIds.docs :: Maybe (NodePoly HyperdataList)) of
case (A.head defaultListIds.docs :: Maybe (NodePoly HyperdataList)) of
Just (NodePoly { id: defaultListId }) ->
Just (NodePoly { id: defaultListId }) ->
pure $ Right { corpusId, corpusNode, defaultListId }
pure $ Right { corpusId
: fromMaybe 0 corpusId
, corpusNode, defaultListId }
Nothing ->
Nothing ->
throwError $ error "Missing default list"
throwError $ error "Missing default list"
where
where
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment