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
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
Julien Moutinho
haskell-gargantext
Commits
325970ef
Commit
325970ef
authored
Nov 29, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DEMO] adapting Contact Type.
parent
3a2ce776
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
9 deletions
+24
-9
API.hs
src/Gargantext/API.hs
+2
-1
Node.hs
src/Gargantext/Database/Node.hs
+1
-2
Contact.hs
src/Gargantext/Database/Node/Contact.hs
+20
-5
IMTUser.hs
src/Gargantext/Ext/IMTUser.hs
+1
-1
No files found.
src/Gargantext/API.hs
View file @
325970ef
...
@@ -80,6 +80,7 @@ import Gargantext.API.Node ( Roots , roots
...
@@ -80,6 +80,7 @@ import Gargantext.API.Node ( Roots , roots
,
HyperdataCorpus
,
HyperdataCorpus
,
HyperdataAnnuaire
,
HyperdataAnnuaire
)
)
import
Gargantext.Database.Node.Contact
(
HyperdataContact
)
import
Gargantext.Database.Types.Node
()
import
Gargantext.Database.Types.Node
()
import
Gargantext.API.Count
(
CountAPI
,
count
,
Query
)
import
Gargantext.API.Count
(
CountAPI
,
count
,
Query
)
import
Gargantext.API.Search
(
SearchAPI
,
search
,
SearchQuery
)
import
Gargantext.API.Search
(
SearchAPI
,
search
,
SearchQuery
)
...
@@ -283,7 +284,7 @@ serverGargAPI env = do
...
@@ -283,7 +284,7 @@ serverGargAPI env = do
:<|>
roots
conn
:<|>
roots
conn
:<|>
nodeAPI
conn
(
Proxy
::
Proxy
HyperdataAny
)
:<|>
nodeAPI
conn
(
Proxy
::
Proxy
HyperdataAny
)
:<|>
nodeAPI
conn
(
Proxy
::
Proxy
HyperdataCorpus
)
:<|>
nodeAPI
conn
(
Proxy
::
Proxy
HyperdataCorpus
)
:<|>
nodeAPI
conn
(
Proxy
::
Proxy
Hyperdata
Annuaire
)
:<|>
nodeAPI
conn
(
Proxy
::
Proxy
Hyperdata
Contact
)
:<|>
nodesAPI
conn
:<|>
nodesAPI
conn
:<|>
count
-- TODO: undefined
:<|>
count
-- TODO: undefined
:<|>
search
conn
:<|>
search
conn
...
...
src/Gargantext/Database/Node.hs
View file @
325970ef
...
@@ -272,8 +272,7 @@ deleteNodes ns = mkCmd $ \conn ->
...
@@ -272,8 +272,7 @@ deleteNodes ns = mkCmd $ \conn ->
getNodesWith
::
JSONB
a
=>
Connection
->
Int
->
proxy
a
->
Maybe
NodeType
getNodesWith
::
JSONB
a
=>
Connection
->
Int
->
proxy
a
->
Maybe
NodeType
->
Maybe
Offset
->
Maybe
Limit
->
IO
[
Node
a
]
->
Maybe
Offset
->
Maybe
Limit
->
IO
[
Node
a
]
getNodesWith
conn
parentId
_
nodeType
maybeOffset
maybeLimit
=
getNodesWith
conn
parentId
_
nodeType
maybeOffset
maybeLimit
=
runQuery
conn
$
selectNodesWith
runQuery
conn
$
selectNodesWith
parentId
nodeType
maybeOffset
maybeLimit
parentId
nodeType
maybeOffset
maybeLimit
-- NP check type
-- NP check type
...
...
src/Gargantext/Database/Node/Contact.hs
View file @
325970ef
...
@@ -22,6 +22,7 @@ module Gargantext.Database.Node.Contact
...
@@ -22,6 +22,7 @@ module Gargantext.Database.Node.Contact
import
Control.Lens
(
makeLenses
)
import
Control.Lens
(
makeLenses
)
import
Data.Aeson.TH
(
deriveJSON
)
import
Data.Aeson.TH
(
deriveJSON
)
import
Data.Swagger
(
ToSchema
)
import
Data.Text
(
Text
)
import
Data.Text
(
Text
)
import
Data.Time
(
UTCTime
)
import
Data.Time
(
UTCTime
)
import
Database.PostgreSQL.Simple.FromField
(
FromField
,
fromField
)
import
Database.PostgreSQL.Simple.FromField
(
FromField
,
fromField
)
...
@@ -32,17 +33,22 @@ import Gargantext.Database.Types.Node (Node,Hyperdata,NodeType(..))
...
@@ -32,17 +33,22 @@ import Gargantext.Database.Types.Node (Node,Hyperdata,NodeType(..))
import
Gargantext.Database.Utils
(
fromField'
)
import
Gargantext.Database.Utils
(
fromField'
)
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Opaleye
(
QueryRunnerColumnDefault
,
queryRunnerColumnDefault
,
PGJsonb
,
fieldQueryRunnerColumn
)
import
Opaleye
(
QueryRunnerColumnDefault
,
queryRunnerColumnDefault
,
PGJsonb
,
fieldQueryRunnerColumn
)
import
Test.QuickCheck
(
elements
)
import
Test.QuickCheck.Arbitrary
(
Arbitrary
,
arbitrary
)
------------------------------------------------------------------------
------------------------------------------------------------------------
type
NodeContact
=
Node
HyperdataContact
type
NodeContact
=
Node
HyperdataContact
data
HyperdataContact
=
data
HyperdataContact
=
HyperdataContact
{
_hc_who
::
Maybe
ContactWho
HyperdataContact
{
_hc_bdd
::
Maybe
Text
-- ID of Database source
,
_hc_who
::
Maybe
ContactWho
,
_hc_where
::
Maybe
[
ContactWhere
]
,
_hc_where
::
Maybe
[
ContactWhere
]
,
_hc_metaData
::
Maybe
ContactMetaData
,
_hc_title
::
Maybe
Text
-- TODO remove (only demo)
,
_hc_uniqId
::
Maybe
Text
,
_hc_source
::
Maybe
Text
-- TODO remove (only demo)
,
_hc_lastValidation
::
Maybe
Text
,
_hc_uniqIdBdd
::
Maybe
Text
,
_hc_uniqIdBdd
::
Maybe
Text
,
_hc_uniqId
::
Maybe
Text
}
deriving
(
Eq
,
Show
,
Generic
)
}
deriving
(
Eq
,
Show
,
Generic
)
...
@@ -54,6 +60,7 @@ data ContactMetaData =
...
@@ -54,6 +60,7 @@ data ContactMetaData =
arbitraryHyperdataContact
::
HyperdataContact
arbitraryHyperdataContact
::
HyperdataContact
arbitraryHyperdataContact
=
HyperdataContact
Nothing
Nothing
Nothing
arbitraryHyperdataContact
=
HyperdataContact
Nothing
Nothing
Nothing
Nothing
Nothing
Nothing
Nothing
Nothing
Nothing
Nothing
data
ContactWho
=
data
ContactWho
=
...
@@ -97,6 +104,14 @@ nodeContactW maybeName maybeContact aId =
...
@@ -97,6 +104,14 @@ nodeContactW maybeName maybeContact aId =
-- | Main instances of Contact
-- | Main instances of Contact
instance
ToSchema
HyperdataContact
instance
ToSchema
ContactWho
instance
ToSchema
ContactWhere
instance
ToSchema
ContactTouch
instance
Arbitrary
HyperdataContact
where
arbitrary
=
elements
[
HyperdataContact
Nothing
Nothing
Nothing
Nothing
Nothing
Nothing
Nothing
Nothing
]
-- | Specific Gargantext instance
-- | Specific Gargantext instance
instance
Hyperdata
HyperdataContact
instance
Hyperdata
HyperdataContact
...
...
src/Gargantext/Ext/IMTUser.hs
View file @
325970ef
...
@@ -77,7 +77,7 @@ imtUser2gargContact (IMTUser id' entite' mail' nom' prenom' fonction' tel' _fax'
...
@@ -77,7 +77,7 @@ imtUser2gargContact (IMTUser id' entite' mail' nom' prenom' fonction' tel' _fax'
service'
_groupe'
bureau'
url'
_pservice'
_pfonction'
_afonction'
service'
_groupe'
bureau'
url'
_pservice'
_pfonction'
_afonction'
_grprech'
lieu'
_aprecision'
_atel'
_sexe'
_statut'
_idutilentite'
_grprech'
lieu'
_aprecision'
_atel'
_sexe'
_statut'
_idutilentite'
_entite2'
_service2'
_group2'
_actif'
_idutilsiecoles'
date_modification'
)
_entite2'
_service2'
_group2'
_actif'
_idutilsiecoles'
date_modification'
)
=
HyperdataContact
(
Just
qui
)
(
Just
[
ou
])
(
Just
meta
)
Nothing
Nothing
=
HyperdataContact
(
Just
qui
)
(
Just
[
ou
])
(
Just
meta
)
((
<>
)
<$>
prenom'
<*>
nom'
)
entite'
Nothing
Nothing
where
where
qui
=
ContactWho
(
Just
id'
)
prenom'
nom'
(
Just
$
catMaybes
[
service'
])
Nothing
qui
=
ContactWho
(
Just
id'
)
prenom'
nom'
(
Just
$
catMaybes
[
service'
])
Nothing
ou
=
ContactWhere
(
toList
entite'
)
(
toList
service'
)
fonction'
bureau'
(
Just
"France"
)
lieu'
contact
Nothing
Nothing
ou
=
ContactWhere
(
toList
entite'
)
(
toList
service'
)
fonction'
bureau'
(
Just
"France"
)
lieu'
contact
Nothing
Nothing
...
...
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