Commit 73b0ba2c authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] Add Category not null.

parent bb3587d3
......@@ -215,7 +215,7 @@ instance Arbitrary PostNode where
arbitrary = elements [PostNode "Node test" NodeCorpus]
------------------------------------------------------------------------
type CatApi = Summary " To Categorize NodeNodes"
type CatApi = Summary " To Categorize NodeNodes: 0 for delete, 1/null neutral, 2 favorite"
:> ReqBody '[JSON] NodesToCategory
:> Put '[JSON] [Int]
......
......@@ -38,10 +38,8 @@ data FavOrTrash = IsFav | IsTrash
deriving (Eq)
--moreLike :: FlowCmdM env error m => FavOrTrash -> CorpusId -> m (Events Bool, [FacetDoc])
moreLike :: FlowCmdM DevEnv GargError m => FavOrTrash -> CorpusId -> m [FacetDoc]
moreLike ft cId = do
priors <- getPriors ft cId
......
......@@ -55,14 +55,14 @@ add_debug pId ns = formatPGSQuery queryAdd (Only $ Values fields inputData)
-- | Input Tables: types of the tables
inputSqlTypes :: [Text]
inputSqlTypes = ["int4","int4"]
inputSqlTypes = ["int4","int4","int4"]
-- | SQL query to add documents
-- TODO return id of added documents only
queryAdd :: Query
queryAdd = [sql|
WITH input_rows(node1_id,node2_id) AS (?)
INSERT INTO nodes_nodes (node1_id, node2_id)
WITH input_rows(node1_id,node2_id,category) AS (?)
INSERT INTO nodes_nodes (node1_id, node2_id,category)
SELECT * FROM input_rows
ON CONFLICT (node1_id, node2_id) DO NOTHING -- on unique index
RETURNING 1
......@@ -83,5 +83,6 @@ data InputData = InputData { inNode1_id :: NodeId
instance ToRow InputData where
toRow inputData = [ toField (inNode1_id inputData)
, toField (inNode2_id inputData)
, toField (1 :: Int)
]
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