a few more tests fixed
This commit is contained in:
@@ -205,7 +205,7 @@ app dbstructure conf authenticator reqBody dbrole req =
|
||||
locationH = fromMaybe "" locationRaw
|
||||
return $ responseLBS status201
|
||||
[
|
||||
jsonH,
|
||||
contentTypeH,
|
||||
(hLocation, "/" <> cs table <> "?" <> cs locationH)
|
||||
]
|
||||
$ if echoRequested then body else ""
|
||||
@@ -493,13 +493,14 @@ parsePostRequest httpRequest reqBody =
|
||||
rows <- (map V.toList . V.toList) <$> CSV.decode CSV.NoHeader reqBody
|
||||
if null rows then Left "CSV requires header"
|
||||
else Right (head rows, (map $ map $ parseCsvCell . cs) (tail rows))
|
||||
else jsn >>= \val -> convertJson val
|
||||
jsn = eitherDecode reqBody
|
||||
returnSingle = first cs $ jsn >>= (\v->
|
||||
case v of
|
||||
Object _ -> Right True
|
||||
_ -> Right False
|
||||
)
|
||||
else eitherDecode reqBody >>= \val -> convertJson val
|
||||
-- jsn = eitherDecode reqBody
|
||||
-- returnSingle = first cs $ jsn >>= (\v->
|
||||
-- case v of
|
||||
-- Object _ -> Right True
|
||||
-- _ -> Right False
|
||||
-- )
|
||||
returnSingle = (==1) . length . snd <$> parsed
|
||||
hdrs = requestHeaders httpRequest
|
||||
lookupHeader = flip lookup hdrs
|
||||
rootTableName = cs $ head $ pathInfo httpRequest -- TODO unsafe head
|
||||
|
||||
@@ -378,7 +378,8 @@ locationF :: [T.Text] -> T.Text
|
||||
locationF pKeys =
|
||||
"(" <>
|
||||
" WITH s AS (SELECT row_to_json(source) as r from source limit 1)" <>
|
||||
" SELECT string_agg(json_data.key || '=eq.' || json_data.value, '&')" <>
|
||||
-- " SELECT string_agg(json_data.key || '=eq.' || json_data.value, '&')" <>
|
||||
" SELECT string_agg(json_data.key || '=' || coalesce( 'eq.' || json_data.value, 'is.null'), '&')" <>
|
||||
" FROM s, json_each_text(s.r) AS json_data" <>
|
||||
(
|
||||
if null pKeys
|
||||
|
||||
Reference in New Issue
Block a user