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
3dec90f2
Commit
3dec90f2
authored
Nov 29, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Annuaire][Demo] Types adapted for Demo emergency.
parent
325970ef
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
15 deletions
+20
-15
API.hs
src/Gargantext/API.hs
+2
-2
Flow.hs
src/Gargantext/Database/Flow.hs
+14
-7
Contact.hs
src/Gargantext/Database/Node/Contact.hs
+1
-0
Insert.hs
src/Gargantext/Database/Node/Document/Insert.hs
+1
-1
IMTUser.hs
src/Gargantext/Ext/IMTUser.hs
+2
-5
No files found.
src/Gargantext/API.hs
View file @
3dec90f2
...
...
@@ -80,7 +80,7 @@ import Gargantext.API.Node ( Roots , roots
,
HyperdataCorpus
,
HyperdataAnnuaire
)
import
Gargantext.Database.Node.Contact
(
HyperdataContact
)
--
import Gargantext.Database.Node.Contact (HyperdataContact)
import
Gargantext.Database.Types.Node
()
import
Gargantext.API.Count
(
CountAPI
,
count
,
Query
)
import
Gargantext.API.Search
(
SearchAPI
,
search
,
SearchQuery
)
...
...
@@ -284,7 +284,7 @@ serverGargAPI env = do
:<|>
roots
conn
:<|>
nodeAPI
conn
(
Proxy
::
Proxy
HyperdataAny
)
:<|>
nodeAPI
conn
(
Proxy
::
Proxy
HyperdataCorpus
)
:<|>
nodeAPI
conn
(
Proxy
::
Proxy
Hyperdata
Contact
)
:<|>
nodeAPI
conn
(
Proxy
::
Proxy
Hyperdata
Annuaire
)
:<|>
nodesAPI
conn
:<|>
count
-- TODO: undefined
:<|>
search
conn
...
...
src/Gargantext/Database/Flow.hs
View file @
3dec90f2
...
...
@@ -35,7 +35,7 @@ import Gargantext.Database.Node.Document.Insert (insertDocuments, ReturnId(..),
import
Gargantext.Database.NodeNgram
(
NodeNgramPoly
(
..
),
insertNodeNgrams
)
import
Gargantext.Database.NodeNgramsNgrams
(
NodeNgramsNgramsPoly
(
..
),
insertNodeNgramsNgramsNew
)
import
Gargantext.Database.Types.Node
(
HyperdataDocument
(
..
))
import
Gargantext.Database.Node.Contact
(
HyperdataContact
(
..
))
--
import Gargantext.Database.Node.Contact (HyperdataContact(..))
import
Gargantext.Database.User
(
getUser
,
UserLight
(
..
),
Username
)
import
Gargantext.Ext.IMT
(
toSchoolName
)
import
Gargantext.Ext.IMTUser
(
deserialiseImtUsersFromFile
)
...
...
@@ -59,10 +59,8 @@ flowDatabase ff fp cName = do
flowInsert
::
NodeType
->
[
HyperdataDocument
]
->
CorpusName
->
IO
([
ReturnId
],
MasterUserId
,
MasterCorpusId
,
UserId
,
CorpusId
)
flowInsert
nt
hyperdataDocuments
cName
=
do
let
hyperdataDocuments'
=
case
nt
of
NodeCorpus
->
map
(
\
h
->
ToDbDocument
h
)
hyperdataDocuments
-- NodeAnnuaire -> map (\h -> ToDbContact h) hyperdataDocuments
flowInsert
_nt
hyperdataDocuments
cName
=
do
let
hyperdataDocuments'
=
map
(
\
h
->
ToDbDocument
h
)
hyperdataDocuments
(
masterUserId
,
_
,
masterCorpusId
)
<-
subFlowCorpus
userMaster
corpusMasterName
ids
<-
runCmd'
$
insertDocuments
masterUserId
masterCorpusId
hyperdataDocuments'
...
...
@@ -72,12 +70,18 @@ flowInsert nt hyperdataDocuments cName = do
pure
(
ids
,
masterUserId
,
masterCorpusId
,
userId
,
userCorpusId
)
flowAnnuaire
::
FilePath
->
IO
()
flowAnnuaire
filePath
=
do
contacts
<-
deserialiseImtUsersFromFile
filePath
ps
<-
flowInsertAnnuaire
"Annuaire"
$
take
10
$
map
(
\
h
->
ToDbContact
h
)
$
map
addUniqIdsContact
contacts
printDebug
"length annuaire"
(
ps
)
--{-
flowInsertAnnuaire
::
CorpusName
->
[
ToDbData
]
->
IO
([
ReturnId
],
UserId
,
CorpusId
,
UserId
,
CorpusId
)
flowInsertAnnuaire
name
children
=
do
(
masterUserId
,
_
,
masterCorpusId
)
<-
subFlowCorpus
userMaster
corpusMasterName
...
...
@@ -94,7 +98,10 @@ flowInsertAnnuaire name children = do
--}
--{-
-- flowCorpus :: NodeType -> [HyperdataDocument] -> ([ReturnId],MasterUserId,UserId,CorpusId) -> IO CorpusId
flowCorpus
::
NodeType
->
[
HyperdataDocument
]
->
([
ReturnId
],
UserId
,
CorpusId
,
UserId
,
CorpusId
)
->
IO
CorpusId
flowCorpus
NodeCorpus
hyperdataDocuments
(
ids
,
masterUserId
,
masterCorpusId
,
userId
,
userCorpusId
)
=
do
--}
--------------------------------------------------
...
...
@@ -160,7 +167,7 @@ subFlowCorpus username cName = do
subFlowAnnuaire
::
Username
->
CorpusName
->
IO
(
UserId
,
RootId
,
CorpusId
)
subFlowAnnuaire
username
cName
=
do
subFlowAnnuaire
username
_
cName
=
do
maybeUserId
<-
runCmd'
(
getUser
username
)
let
userId
=
case
maybeUserId
of
...
...
src/Gargantext/Database/Node/Contact.hs
View file @
3dec90f2
...
...
@@ -52,6 +52,7 @@ data HyperdataContact =
}
deriving
(
Eq
,
Show
,
Generic
)
-- TOD contact metadata (Type is too flat)
data
ContactMetaData
=
ContactMetaData
{
_cm_bdd
::
Maybe
Text
,
_cm_lastValidation
::
Maybe
Text
...
...
src/Gargantext/Database/Node/Document/Insert.hs
View file @
3dec90f2
...
...
@@ -235,7 +235,7 @@ addUniqIdsContact hc = set (hc_uniqIdBdd) (Just hashBdd)
$
set
(
hc_uniqId
)
(
Just
hash
)
hc
where
hash
=
uniqId
$
DT
.
concat
$
map
(
$
hc
)
hashParametersContact
hashBdd
=
uniqId
$
DT
.
concat
$
map
(
$
hc
)
([
\
d
->
maybe'
(
view
(
hc_metaData
.
_Just
.
cm_bdd
)
d
)]
<>
hashParametersContact
)
hashBdd
=
uniqId
$
DT
.
concat
$
map
(
$
hc
)
([
\
d
->
maybe'
(
view
hc_bdd
d
)]
<>
hashParametersContact
)
uniqId
::
Text
->
Text
uniqId
=
DT
.
pack
.
SHA
.
showDigest
.
SHA
.
sha256
.
DC
.
pack
.
DT
.
unpack
...
...
src/Gargantext/Ext/IMTUser.hs
View file @
3dec90f2
...
...
@@ -38,9 +38,6 @@ deserialiseImtUsersFromFile filepath = map imtUser2gargContact <$> deserialiseFr
deserialiseFromFile'
::
FilePath
->
IO
[
IMTUser
]
deserialiseFromFile'
filepath
=
deserialise
<$>
BSL
.
readFile
filepath
serialiseToFile
::
FilePath
->
[
IMTUser
]
->
IO
()
serialiseToFile
f
d
=
BSL
.
writeFile
f
(
serialise
d
)
data
IMTUser
=
IMTUser
{
id
::
Text
,
entite
::
Maybe
Text
...
...
@@ -77,12 +74,12 @@ imtUser2gargContact (IMTUser id' entite' mail' nom' prenom' fonction' tel' _fax'
service'
_groupe'
bureau'
url'
_pservice'
_pfonction'
_afonction'
_grprech'
lieu'
_aprecision'
_atel'
_sexe'
_statut'
_idutilentite'
_entite2'
_service2'
_group2'
_actif'
_idutilsiecoles'
date_modification'
)
=
HyperdataContact
(
Just
qui
)
(
Just
[
ou
])
(
Just
meta
)
((
<>
)
<$>
prenom'
<*>
nom'
)
entite
'
Nothing
Nothing
=
HyperdataContact
(
Just
"IMT Annuaire"
)
(
Just
qui
)
(
Just
[
ou
])
((
<>
)
<$>
(
fmap
(
\
p
->
p
<>
" "
)
prenom'
)
<*>
nom'
)
entite'
date_modification
'
Nothing
Nothing
where
qui
=
ContactWho
(
Just
id'
)
prenom'
nom'
(
Just
$
catMaybes
[
service'
])
Nothing
ou
=
ContactWhere
(
toList
entite'
)
(
toList
service'
)
fonction'
bureau'
(
Just
"France"
)
lieu'
contact
Nothing
Nothing
contact
=
Just
$
ContactTouch
mail'
tel'
url'
meta
=
ContactMetaData
(
Just
"IMT annuaire"
)
date_modification'
--
meta = ContactMetaData (Just "IMT annuaire") date_modification'
toList
Nothing
=
Nothing
toList
(
Just
x
)
=
Just
[
x
]
...
...
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