Commit cca441fb authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[ngrams] separate async ngrams chart update endpoint

parent 922bb0b8
Pipeline #1176 failed with stage
......@@ -349,14 +349,13 @@ tableNgramsPut tabType listId (Versioned p_version p_table)
pure ret
tableNgramsPutAsync :: ( FlowCmdM env err m
tableNgramsPostChartsAsync :: ( FlowCmdM env err m
, HasSettings env
)
=> UpdateTableNgrams
=> UpdateTableNgramsCharts
-> (JobLog -> m ())
-> m JobLog
tableNgramsPutAsync utn logStatus = do
-- let (Versioned p_version p_table) = utn ^. utn_patch
tableNgramsPostChartsAsync utn logStatus = do
let tabType = utn ^. utn_tab_type
let listId = utn ^. utn_list_id
......@@ -658,8 +657,9 @@ type TableNgramsApi = TableNgramsApiGet
type TableNgramsAsyncApi = Summary "Table Ngrams Async API"
:> "async"
:> "charts"
:> "update"
:> AsyncJobs JobLog '[JSON] UpdateTableNgrams JobLog
:> AsyncJobs JobLog '[JSON] UpdateTableNgramsCharts JobLog
getTableNgramsCorpus :: (RepoCmdM env err m, HasNodeError err, HasConnectionPool env, HasConfig env)
=> NodeId
......@@ -732,9 +732,9 @@ apiNgramsAsync _dId =
JobFunction (\i l ->
let
log' x = do
printDebug "tableNgramsPutAsync" x
printDebug "tableNgramsPostChartsAsync" x
liftBase $ l x
in tableNgramsPutAsync i log')
in tableNgramsPostChartsAsync i log')
-- Did the given list of ngrams changed since the given version?
-- The returned value is versioned boolean value, meaning that one always retrieve the
......
......@@ -738,16 +738,15 @@ ngramsTypeFromTabType tabType =
-- TODO: This `panic` would disapear with custom NgramsType.
----
-- PUT Async task
-- Async task
data UpdateTableNgrams = UpdateTableNgrams
data UpdateTableNgramsCharts = UpdateTableNgramsCharts
{ _utn_tab_type :: !TabType
, _utn_list_id :: !ListId
, _utn_patch :: !(Versioned NgramsTablePatch)
} deriving (Eq, Show, Generic)
makeLenses ''UpdateTableNgrams
instance FromJSON UpdateTableNgrams where
makeLenses ''UpdateTableNgramsCharts
instance FromJSON UpdateTableNgramsCharts where
parseJSON = genericParseJSON $ jsonOptions "_utn_"
instance ToSchema UpdateTableNgrams where
instance ToSchema UpdateTableNgramsCharts where
declareNamedSchema = genericDeclareNamedSchema (unPrefixSwagger "_utn_")
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