Commit e5b415b8 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] flow Annuaire

parent c4f159c2
...@@ -100,8 +100,6 @@ addContact u nId (AddContactParams fn ln) logStatus = do ...@@ -100,8 +100,6 @@ addContact u nId (AddContactParams fn ln) logStatus = do
, _scst_remaining = Just 0 , _scst_remaining = Just 0
, _scst_events = Just [] , _scst_events = Just []
} }
addContact _uId _nId _p logStatus = do addContact _uId _nId _p logStatus = do
simuLogs logStatus 10 simuLogs logStatus 10
......
...@@ -32,6 +32,7 @@ module Gargantext.Database.Action.Flow -- (flowDatabase, ngrams2list) ...@@ -32,6 +32,7 @@ module Gargantext.Database.Action.Flow -- (flowDatabase, ngrams2list)
, flowCorpusFile , flowCorpusFile
, flowCorpus , flowCorpus
, flowAnnuaire , flowAnnuaire
, insertMasterDocs
, getOrMkRoot , getOrMkRoot
, getOrMk_RootWithCorpus , getOrMk_RootWithCorpus
...@@ -226,25 +227,6 @@ flowCorpusUser l user corpusName ctype ids = do ...@@ -226,25 +227,6 @@ flowCorpusUser l user corpusName ctype ids = do
-- _ <- mkAnnuaire rootUserId userId -- _ <- mkAnnuaire rootUserId userId
pure userCorpusId pure userCorpusId
-- TODO Type NodeDocumentUnicised
insertDocs :: ( FlowCmdM env err m
-- , FlowCorpus a
, FlowInsertDB a
)
=> UserId
-> CorpusId
-> [a]
-> m ([DocId], [DocumentWithId a])
insertDocs uId cId hs = do
let docs = map addUniqId hs
newIds <- insertDb uId cId docs
-- printDebug "newIds" newIds
let
newIds' = map reId newIds
documentsWithId = mergeData (toInserted newIds) (Map.fromList $ map viewUniqId' docs)
_ <- Doc.add cId newIds'
pure (newIds', documentsWithId)
insertMasterDocs :: ( FlowCmdM env err m insertMasterDocs :: ( FlowCmdM env err m
, FlowCorpus a , FlowCorpus a
...@@ -292,6 +274,27 @@ insertMasterDocs c lang hs = do ...@@ -292,6 +274,27 @@ insertMasterDocs c lang hs = do
pure ids' pure ids'
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- TODO Type NodeDocumentUnicised
insertDocs :: ( FlowCmdM env err m
-- , FlowCorpus a
, FlowInsertDB a
)
=> UserId
-> CorpusId
-> [a]
-> m ([DocId], [DocumentWithId a])
insertDocs uId cId hs = do
let docs = map addUniqId hs
newIds <- insertDb uId cId docs
-- printDebug "newIds" newIds
let
newIds' = map reId newIds
documentsWithId = mergeData (toInserted newIds) (Map.fromList $ map viewUniqId' docs)
_ <- Doc.add cId newIds'
pure (newIds', documentsWithId)
------------------------------------------------------------------------ ------------------------------------------------------------------------
viewUniqId' :: UniqId a viewUniqId' :: UniqId a
=> a => a
......
...@@ -283,9 +283,11 @@ instance ToNode HyperdataDocument where ...@@ -283,9 +283,11 @@ instance ToNode HyperdataDocument where
m = fromMaybe 1 $ _hd_publication_month h m = fromMaybe 1 $ _hd_publication_month h
d = fromMaybe 1 $ _hd_publication_day h d = fromMaybe 1 $ _hd_publication_day h
-- TODO -- TODO better Node
instance ToNode HyperdataContact where instance ToNode HyperdataContact where
toNode = undefined toNode u p h = Node 0 Nothing (nodeTypeId NodeContact) u (Just p) "Contact" date h
where
date = jour 2020 01 01
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment