Add TODO comments near undefined/panic calls

parent d0a57d8c
......@@ -258,9 +258,9 @@ server env = do
:<|> nodeAPI conn
:<|> nodeAPI conn
:<|> nodesAPI conn
:<|> count
:<|> count -- TODO: undefined
:<|> search conn
:<|> graphAPI conn
:<|> graphAPI conn -- TODO: mock
:<|> treeAPI conn
-- :<|> orchestrator
where
......
......@@ -57,9 +57,9 @@ import Gargantext.Text.Terms (TermType(..))
-------------------------------------------------------------------
-- | Node API Types management
type Roots = Get '[JSON] [Node Value]
:<|> Post '[JSON] Int
:<|> Put '[JSON] Int
:<|> Delete '[JSON] Int
:<|> Post '[JSON] Int -- TODO
:<|> Put '[JSON] Int -- TODO
:<|> Delete '[JSON] Int -- TODO
type NodesAPI = Delete '[JSON] Int
......@@ -106,15 +106,16 @@ type FacetDocAPI = "table"
-- | Node API functions
roots :: Connection -> Server Roots
roots conn = liftIO (putStrLn ( "/user" :: Text) >> getNodesWithParentId conn 0 Nothing)
:<|> pure (panic "not implemented yet")
:<|> pure (panic "not implemented yet")
:<|> pure (panic "not implemented yet")
roots conn = liftIO (putStrLn ( "/user" :: Text) >> getNodesWithParentId 0 Nothing conn)
:<|> pure (panic "not implemented yet") -- TODO
:<|> pure (panic "not implemented yet") -- TODO
:<|> pure (panic "not implemented yet") -- TODO
type GraphAPI = Get '[JSON] Graph
graphAPI :: Connection -> NodeId -> Server GraphAPI
graphAPI _ _ = liftIO $ textFlow (Mono EN) (Contexts contextText)
-- TODO what do we get about the node? to replace contextText
-- TODO(orphan): There should be a proper APIError data type with a case TreeError.
instance HasTreeError ServantErr where
......@@ -143,10 +144,10 @@ nodesAPI :: Connection -> [NodeId] -> Server NodesAPI
nodesAPI conn ids = deleteNodes' conn ids
postNode :: Connection -> NodeId -> Handler Int
postNode = undefined
postNode = undefined -- TODO
putNode :: Connection -> NodeId -> Handler Int
putNode = undefined
putNode = undefined -- TODO
deleteNodes' :: Connection -> [NodeId] -> Handler Int
deleteNodes' conn ids = liftIO (deleteNodes conn ids)
......@@ -165,7 +166,7 @@ getFacet conn id offset limit = liftIO (putStrLn ( "/facet" :: Text)) >> liftIO
getChart :: Connection -> NodeId -> Maybe UTCTime -> Maybe UTCTime
-> Handler [FacetChart]
getChart _ _ _ _ = undefined
getChart _ _ _ _ = undefined -- TODO
query :: Text -> Handler Text
......
......@@ -64,7 +64,7 @@ pipeline :: FromJSON e => URL -> ClientEnv -> ScraperInput
-> (e -> IO ()) -> IO ScraperStatus
pipeline scrapyurl client_env input log_status = do
e <- runJobMLog client_env log_status $ callScraper scrapyurl input
either (panic . cs . show) pure e
either (panic . cs . show) pure e -- TODO throwError
scrapyOrchestrator :: Env -> IO (Server (WithCallbacks ScraperAPI))
scrapyOrchestrator env = do
......
......@@ -54,5 +54,5 @@ parseJSONFromString :: (Read a) => Value -> Parser a
parseJSONFromString v = do
numString <- parseJSON v
case readMaybe (numString :: String) of
Nothing -> fail $ "Invalid number for TransactionID: " ++ show v
Nothing -> fail $ "Invalid number for TransactionID: " ++ show v -- TODO error message too specific
Just n -> return n
......@@ -100,6 +100,7 @@ useLabelPolicy :: Map Grouped [Text] -> Grouped -> [Text]
useLabelPolicy m g = case DMS.lookup g m of
Just label -> label
Nothing -> panic $ "Label of Grouped not found: " <> (pack $ show g)
-- TODO: use a non-fatal error if this can happen in practice
{-
labelPolicy :: Map Grouped (Map Terms Occs) -> Grouped -> Label
labelPolicy m g = case _terms_label <$> fst <$> maximumWith snd <$> DMS.toList <$> lookup g m of
......
......@@ -76,6 +76,7 @@ parserLang _ = panic "not implemented"
-- currentContext lang = localContext lang <$> utcToDucklingTime <$> getCurrentTime
-- parseDate1 :: Context -> Text -> SomeErrorHandling Text
-- TODO error handling
parseDate1 :: Lang -> Text -> IO Text
parseDate1 lang text = do
maybeJson <- map jsonValue <$> parseDateWithDuckling lang text
......
......@@ -86,7 +86,7 @@ textFlow termType workType = do
CSV path -> readCsvOn [csv_title, csv_abstract] path
Contexts ctxt -> pure ctxt
DB con corpusId -> catMaybes <$> map (\n -> hyperdataDocumentV3_title (node_hyperdata n) <> hyperdataDocumentV3_abstract (node_hyperdata n))<$> getDocumentsV3WithParentId con corpusId
_ -> undefined
_ -> undefined -- TODO Query not supported
textFlow' termType contexts
......
......@@ -38,7 +38,7 @@ import qualified Data.Set as S
import Data.Map (Map)
import qualified Data.Map.Strict as M
import Data.Vector (Vector)
-- import Data.Vector (Vector)
import Gargantext.Prelude
......@@ -86,13 +86,12 @@ indexConversion index ms = M.fromList $ map (\((k1,k2),c) -> ( ((M.!) index k1,
---------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- TODO
--fromIndex' :: Ord t => Vector t -> Map (Index, Index) a -> Map (t,t) a
--fromIndex' vi ns = undefined
-- TODO
createIndices' :: Ord t => Map (t, t) b -> (Map t Index, Vector t)
createIndices' = undefined
-- TODO: returing a Vector should be faster than a Map
-- createIndices' :: Ord t => Map (t, t) b -> (Map t Index, Vector t)
-- createIndices' = undefined
createIndices :: Ord t => Map (t, t) b -> (Map t Index, Map Index t)
createIndices = set2indices . map2set
......
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