Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
191
Issues
191
List
Board
Labels
Milestones
Merge Requests
8
Merge Requests
8
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
gargantext
haskell-gargantext
Commits
900fe0b9
Commit
900fe0b9
authored
Jun 23, 2025
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename errorWith to nodeErrorWith
errorWith has a `HasNodeError` constraint but the name was misleading.
parent
0c34eb47
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
17 deletions
+17
-17
Delete.hs
src/Gargantext/Database/Action/Delete.hs
+2
-2
Share.hs
src/Gargantext/Database/Action/Share.hs
+7
-7
User.hs
src/Gargantext/Database/Action/User.hs
+1
-1
Error.hs
src/Gargantext/Database/Query/Table/Node/Error.hs
+3
-3
Root.hs
src/Gargantext/Database/Query/Tree/Root.hs
+2
-2
DocumentSearch.hs
test/Test/Database/Operations/DocumentSearch.hs
+2
-2
No files found.
src/Gargantext/Database/Action/Delete.hs
View file @
900fe0b9
...
...
@@ -32,7 +32,7 @@ import Gargantext.Database.GargDB qualified as GargDB
import
Gargantext.Database.Prelude
import
Gargantext.Database.Query.Table.Node
(
getNodeWith
)
import
Gargantext.Database.Query.Table.Node
qualified
as
N
(
getNode
,
deleteNode
)
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
,
e
rrorWith
)
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
,
nodeE
rrorWith
)
import
Gargantext.Database.Schema.Node
import
Gargantext.Prelude
...
...
@@ -51,7 +51,7 @@ deleteNode u nodeId = do
(
num
,
upd_node
,
cleanup
)
<-
runDBTx
$
do
node'
<-
N
.
getNode
nodeId
(
rows
,
clean_it
)
<-
case
view
node_typename
node'
of
nt
|
nt
==
toDBid
NodeUser
->
e
rrorWith
"[G.D.A.D.deleteNode] Not allowed to delete NodeUser (yet)"
nt
|
nt
==
toDBid
NodeUser
->
nodeE
rrorWith
"[G.D.A.D.deleteNode] Not allowed to delete NodeUser (yet)"
nt
|
nt
==
toDBid
NodeTeam
->
do
uId
<-
getUserId
u
if
_node_user_id
node'
==
uId
...
...
src/Gargantext/Database/Action/Share.hs
View file @
900fe0b9
...
...
@@ -26,7 +26,7 @@ import Gargantext.Database.Admin.Config (hasNodeType, isInNodeTypes)
import
Gargantext.Database.Admin.Types.Hyperdata.Any
(
HyperdataAny
(
..
))
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Query.Table.Node
(
getNode
,
getNodesWith
)
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
,
e
rrorWith
)
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
,
nodeE
rrorWith
)
import
Gargantext.Database.Query.Table.User
import
Gargantext.Database.Query.Tree.Root
(
getRootId
)
import
Gargantext.Database.Schema.Node
...
...
@@ -98,10 +98,10 @@ shareNodeWith (ShareNodeWith_User NodeFolderShared u) n = do
nodeToCheck
<-
getNode
n
userIdCheck
<-
getUserId
u
if
not
(
hasNodeType
nodeToCheck
NodeTeam
)
then
e
rrorWith
"[G.D.A.S.shareNodeWith] Can share node Team only"
then
nodeE
rrorWith
"[G.D.A.S.shareNodeWith] Can share node Team only"
else
if
(
view
node_user_id
nodeToCheck
==
userIdCheck
)
then
e
rrorWith
"[G.D.A.S.shareNodeWith] Can share to others only"
then
nodeE
rrorWith
"[G.D.A.S.shareNodeWith] Can share to others only"
else
do
folderSharedId
<-
getFolderId
u
NodeFolderShared
ret
<-
shareNode
(
SourceId
folderSharedId
)
(
TargetId
n
)
...
...
@@ -111,7 +111,7 @@ shareNodeWith (ShareNodeWith_User NodeFolderShared u) n = do
shareNodeWith
(
ShareNodeWith_Node
NodeFolderPublic
nId
)
n
=
do
nodeToCheck
<-
getNode
n
if
not
(
isInNodeTypes
nodeToCheck
publicNodeTypes
)
then
e
rrorWith
$
"[G.D.A.S.shareNodeWith] Can share this nodesTypes only: "
then
nodeE
rrorWith
$
"[G.D.A.S.shareNodeWith] Can share this nodesTypes only: "
<>
(
show
publicNodeTypes
)
else
do
folderToCheck
<-
getNode
nId
...
...
@@ -120,9 +120,9 @@ shareNodeWith (ShareNodeWith_Node NodeFolderPublic nId) n = do
ret
<-
shareNode
(
SourceId
nId
)
(
TargetId
n
)
let
msgs
=
[
CE
.
UpdateTreeFirstLevel
nId
,
CE
.
UpdateTreeFirstLevel
n
]
pure
(
ret
,
msgs
)
else
e
rrorWith
"[G.D.A.S.shareNodeWith] Can share NodeWith NodeFolderPublic only"
else
nodeE
rrorWith
"[G.D.A.S.shareNodeWith] Can share NodeWith NodeFolderPublic only"
shareNodeWith
_
_
=
e
rrorWith
"[G.D.A.S.shareNodeWith] Not implemented for this NodeType"
shareNodeWith
_
_
=
nodeE
rrorWith
"[G.D.A.S.shareNodeWith] Not implemented for this NodeType"
------------------------------------------------------------------------
getFolderId
::
HasNodeError
err
=>
User
->
NodeType
->
DBQuery
err
x
NodeId
...
...
@@ -130,7 +130,7 @@ getFolderId u nt = do
rootId
<-
getRootId
u
s
<-
getNodesWith
rootId
HyperdataAny
(
Just
nt
)
Nothing
Nothing
case
head
s
of
Nothing
->
e
rrorWith
"[G.D.A.S.getFolderId] No folder shared found"
Nothing
->
nodeE
rrorWith
"[G.D.A.S.getFolderId] No folder shared found"
Just
f
->
pure
(
_node_id
f
)
------------------------------------------------------------------------
...
...
src/Gargantext/Database/Action/User.hs
View file @
900fe0b9
...
...
@@ -72,7 +72,7 @@ getUsername user@(UserDBId _) = do
users
<-
getUsersWithId
user
case
head
users
of
Just
u
->
pure
$
userLight_username
u
Nothing
->
e
rrorWith
"G.D.A.U.getUserName: User not found with that id"
Nothing
->
nodeE
rrorWith
"G.D.A.U.getUserName: User not found with that id"
getUsername
(
RootId
rid
)
=
do
n
<-
getNode
rid
getUsername
(
UserDBId
$
_node_user_id
n
)
...
...
src/Gargantext/Database/Query/Table/Node/Error.hs
View file @
900fe0b9
...
...
@@ -19,7 +19,7 @@ module Gargantext.Database.Query.Table.Node.Error (
,
HasNodeError
(
..
)
-- * Functions
,
e
rrorWith
,
nodeE
rrorWith
,
nodeError
,
nodeCreationError
,
nodeLookupError
...
...
@@ -141,8 +141,8 @@ instance ToJSON NodeError where
class
HasNodeError
e
where
_NodeError
::
Prism'
e
NodeError
e
rrorWith
::
HasNodeError
e
=>
Text
->
DBTx
e
r
a
e
rrorWith
x
=
nodeError
(
NodeError
$
toException
$
userError
$
T
.
unpack
x
)
nodeE
rrorWith
::
HasNodeError
e
=>
Text
->
DBTx
e
r
a
nodeE
rrorWith
x
=
nodeError
(
NodeError
$
toException
$
userError
$
T
.
unpack
x
)
nodeError
::
HasNodeError
e
=>
NodeError
->
DBTx
e
r
a
nodeError
ne
=
dbFail
$
_NodeError
#
ne
...
...
src/Gargantext/Database/Query/Tree/Root.hs
View file @
900fe0b9
...
...
@@ -37,7 +37,7 @@ getRootId :: (HasNodeError err) => User -> DBQuery err x NodeId
getRootId
u
=
do
maybeRoot
<-
head
<$>
getRoot
u
case
maybeRoot
of
Nothing
->
e
rrorWith
"[G.D.Q.T.R.getRootId] No root id"
Nothing
->
nodeE
rrorWith
"[G.D.Q.T.R.getRootId] No root id"
Just
r
->
pure
(
_node_id
r
)
getRoot
::
User
->
DBQuery
err
x
[
Node
HyperdataUser
]
...
...
@@ -115,7 +115,7 @@ mkCorpus :: (HasNodeError err, MkCorpus a)
mkCorpus
cName
c
rootId
userId
=
do
c'
<-
mk
(
Just
cName
)
c
rootId
userId
_tId
<-
case
head
c'
of
Nothing
->
e
rrorWith
"[G.D.Q.T.Root.getOrMk...] mk Corpus failed"
Nothing
->
nodeE
rrorWith
"[G.D.Q.T.Root.getOrMk...] mk Corpus failed"
Just
c''
->
insertDefaultNode
NodeTexts
c''
userId
corpusId
<-
maybe
(
nodeError
NoCorpusFound
)
pure
(
head
c'
)
...
...
test/Test/Database/Operations/DocumentSearch.hs
View file @
900fe0b9
...
...
@@ -31,7 +31,7 @@ import Gargantext.Database.Prelude
import
Gargantext.Database.Query.Facet
import
Gargantext.Database.Query.Table.Node
import
Gargantext.Database.Query.Table.Node.Error
(
HasNodeError
)
import
Gargantext.Database.Query.Table.Node.Error
(
e
rrorWith
)
import
Gargantext.Database.Query.Table.Node.Error
(
nodeE
rrorWith
)
import
Gargantext.Database.Query.Tree.Root
import
Gargantext.Database.Query.Table.NodeContext
(
selectCountDocs
)
import
Gargantext.Database.Schema.Node
(
NodePoly
(
..
))
...
...
@@ -119,7 +119,7 @@ getCorporaWithParentIdOrFail parentId = do
xs
<-
getCorporaWithParentId
parentId
case
xs
of
[
corpus
]
->
pure
corpus
_
->
e
rrorWith
$
"getCorporaWithParentIdOrFail, impossible: "
<>
T
.
pack
(
show
xs
)
_
->
nodeE
rrorWith
$
"getCorporaWithParentIdOrFail, impossible: "
<>
T
.
pack
(
show
xs
)
addCorpusDocuments
::
TestEnv
->
IO
TestEnv
addCorpusDocuments
env
=
runTestMonad
env
$
do
...
...
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