Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-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
Przemyslaw Kaminski
haskell-gargantext
Commits
3e2fa028
Commit
3e2fa028
authored
Jan 08, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NewType] NodeId implemented.
parent
5a526bc3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
12 deletions
+18
-12
Node.hs
src/Gargantext/API/Node.hs
+2
-2
Pairing.hs
src/Gargantext/Database/Flow/Pairing.hs
+0
-1
Update.hs
src/Gargantext/Database/Node/Update.hs
+0
-1
Node.hs
src/Gargantext/Database/Types/Node.hs
+15
-7
Utils.hs
src/Gargantext/Database/Utils.hs
+1
-1
No files found.
src/Gargantext/API/Node.hs
View file @
3e2fa028
...
...
@@ -124,7 +124,7 @@ type RenameApi = Summary " Rename Node"
type
PostNodeApi
=
Summary
" PostNode Node with ParentId as {id}"
:>
ReqBody
'[
J
SON
]
PostNode
:>
Post
'[
J
SON
]
[
Int
]
:>
Post
'[
J
SON
]
[
NodeId
]
type
ChildrenApi
a
=
Summary
" Summary children"
:>
QueryParam
"type"
NodeType
...
...
@@ -177,7 +177,7 @@ instance Arbitrary PostNode where
------------------------------------------------------------------------
type
DocsApi
=
Summary
"Docs : Move to trash"
:>
ReqBody
'[
J
SON
]
Documents
:>
Delete
'[
J
SON
]
[
NodeId
]
:>
Delete
'[
J
SON
]
[
Int
]
data
Documents
=
Documents
{
documents
::
[
NodeId
]}
deriving
(
Generic
)
...
...
src/Gargantext/Database/Flow/Pairing.hs
View file @
3e2fa028
...
...
@@ -39,7 +39,6 @@ import Gargantext.Database.Flow.Utils
import
Gargantext.Database.Utils
(
Cmd
,
runPGSQuery
)
import
Gargantext.Database.Types.Node
(
AnnuaireId
,
CorpusId
,
ContactId
)
import
Gargantext.Database.Node.Children
import
Gargantext.Core.Types.Main
import
Gargantext.Core.Types
(
NodeType
(
..
))
-- TODO mv this type in Types Main
...
...
src/Gargantext/Database/Node/Update.hs
View file @
3e2fa028
...
...
@@ -17,7 +17,6 @@ Portability : POSIX
module
Gargantext.Database.Node.Update
(
Update
(
..
),
update
)
where
import
Data.Text
(
Text
)
import
qualified
Data.Text
as
DT
import
Database.PostgreSQL.Simple
...
...
src/Gargantext/Database/Types/Node.hs
View file @
3e2fa028
...
...
@@ -49,7 +49,7 @@ import Text.Read (read)
import
Text.Show
(
Show
())
import
Database.PostgreSQL.Simple.ToField
(
ToField
,
toField
,
toJSONField
)
import
Database.PostgreSQL.Simple.FromField
(
FromField
)
import
Database.PostgreSQL.Simple.FromField
(
FromField
,
fromField
)
import
Servant
import
Test.QuickCheck.Arbitrary
...
...
@@ -57,19 +57,27 @@ import Test.QuickCheck (elements)
import
Gargantext.Prelude
import
Gargantext.Core.Utils.Prefix
(
unPrefix
)
import
Gargantext.Database.Utils
------------------------------------------------------------------------
newtype
NodeId
=
NodeId
Int
deriving
(
Show
,
Read
,
Generic
,
Num
,
Eq
,
Ord
,
Enum
)
instance
ToField
NodeId
instance
FromField
NodeId
instance
ToField
NodeId
where
toField
(
NodeId
n
)
=
toField
n
instance
FromField
NodeId
where
fromField
=
fromField'
instance
ToJSON
NodeId
instance
FromJSON
NodeId
instance
ToSchema
NodeId
instance
FromHttpApiData
NodeId
instance
FromHttpApiData
NodeId
where
parseUrlPiece
n
=
pure
$
NodeId
$
(
read
.
cs
)
n
instance
ToParamSchema
NodeId
instance
Arbitrary
NodeId
instance
Arbitrary
NodeId
where
arbitrary
=
NodeId
<$>
arbitrary
type
ParentId
=
NodeId
type
GraphId
=
NodeId
...
...
@@ -404,8 +412,8 @@ allNodeTypes = [minBound ..]
instance
FromJSON
NodeType
instance
ToJSON
NodeType
instance
FromHttpApiData
NodeType
where
instance
FromHttpApiData
NodeType
where
parseUrlPiece
=
Right
.
read
.
unpack
instance
ToParamSchema
NodeType
...
...
src/Gargantext/Database/Utils.hs
View file @
3e2fa028
...
...
@@ -36,7 +36,7 @@ import Database.PostgreSQL.Simple (Connection, connect)
import
Database.PostgreSQL.Simple.FromField
(
Conversion
,
ResultError
(
ConversionFailed
),
fromField
,
returnError
)
import
Database.PostgreSQL.Simple.Internal
(
Field
)
import
Gargantext.Prelude
import
Opaleye
(
Query
,
Unpackspec
,
showSqlForPostgres
,
FromFields
,
Select
,
runQuery
,
Column
)
import
Opaleye
(
Query
,
Unpackspec
,
showSqlForPostgres
,
FromFields
,
Select
,
runQuery
)
import
Servant
(
ServantErr
)
import
System.IO
(
FilePath
)
import
Text.Read
(
read
)
...
...
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