Verified Commit 23e94a21 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch 'dev' into 238-dev-async-job-worker

parents 8f6f9f94 4327e2a6
Pipeline #6973 failed with stages
in 54 minutes and 30 seconds
...@@ -4,5 +4,5 @@ echo "GarganText, build, install, test and documentation" ...@@ -4,5 +4,5 @@ echo "GarganText, build, install, test and documentation"
nix-shell --run "cabal update \\ nix-shell --run "cabal update \\
&& cabal v2-build --ghc-options=-O2 \\ && cabal v2-build --ghc-options=-O2 \\
&& cabal --overwrite-policy=always install \\ && cabal --overwrite-policy=always install \\
&& cabal v2-test \\ && cabal v2-test --test-show-details=streaming \\
&& cabal haddock" && cabal haddock"
...@@ -81,6 +81,7 @@ import Gargantext.Database.Schema.Node ...@@ -81,6 +81,7 @@ import Gargantext.Database.Schema.Node
import Gargantext.Prelude hiding (sum, head) import Gargantext.Prelude hiding (sum, head)
import Opaleye hiding (FromField) import Opaleye hiding (FromField)
import Prelude hiding (null, id, map, sum) import Prelude hiding (null, id, map, sum)
import qualified Data.List.NonEmpty as NE
queryNodeSearchTable :: Select NodeSearchRead queryNodeSearchTable :: Select NodeSearchRead
...@@ -448,10 +449,14 @@ get_user_root_node_folder nty userId = do ...@@ -448,10 +449,14 @@ get_user_root_node_folder nty userId = do
where_ $ (n ^. node_typename .== sqlInt4 (toDBid nty)) .&& where_ $ (n ^. node_typename .== sqlInt4 (toDBid nty)) .&&
(n ^. node_user_id .== sqlInt4 (_UserId userId)) (n ^. node_user_id .== sqlInt4 (_UserId userId))
pure n pure n
case result of case NE.nonEmpty result of
[] -> nodeError $ NodeLookupFailed $ UserFolderDoesNotExist userId Nothing
[n] -> pure n -> nodeError $ NodeLookupFailed $ UserFolderDoesNotExist userId
folders -> nodeError $ NodeLookupFailed $ UserHasTooManyRoots userId (map _node_id folders) -- See https://gitlab.iscpif.fr/gargantext/haskell-gargantext/merge_requests/350#note_12732
-- User might have more than one public folder, in which case we need to take the one with the
-- smallest id.
Just folders
-> pure $ NE.head (NE.sortWith _node_id folders)
-- | An input 'NodeId' identifies a user node if its typename is 'NodeUser' and it has no parent_id. -- | An input 'NodeId' identifies a user node if its typename is 'NodeUser' and it has no parent_id.
isUserNode :: HasDBid NodeType => NodeId -> DBCmd err Bool isUserNode :: HasDBid NodeType => NodeId -> DBCmd err Bool
......
...@@ -38,6 +38,11 @@ nodeTests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith dbEnvSetup ...@@ -38,6 +38,11 @@ nodeTests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith dbEnvSetup
manager <- runIO $ newManager defaultManagerSettings manager <- runIO $ newManager defaultManagerSettings
let unauthenticatedClientEnv port = mkClientEnv manager (baseUrl { baseUrlPort = port }) let unauthenticatedClientEnv port = mkClientEnv manager (baseUrl { baseUrlPort = port })
it "setup DB triggers" $ \SpecContext{..} -> do
setupEnvironment _sctx_env
-- Let's create the Alice user.
void $ createAliceAndBob _sctx_env
describe "GET /api/v1.0/user" $ do describe "GET /api/v1.0/user" $ do
-- FIXME(adn): unclear if this is useful at all. Doesn't do permission checking. -- FIXME(adn): unclear if this is useful at all. Doesn't do permission checking.
......
...@@ -4,8 +4,19 @@ module Main where ...@@ -4,8 +4,19 @@ module Main where
import Control.Monad import Control.Monad
import Data.Text (isInfixOf) import Data.Text (isInfixOf)
<<<<<<< HEAD
import Data.Text qualified as T import Data.Text qualified as T
import Gargantext.Prelude hiding (isInfixOf) import Gargantext.Prelude hiding (isInfixOf)
||||||| 0bbbba60
import Gargantext.Core.Notifications.CentralExchange qualified as CE
import Gargantext.Core.Notifications.Dispatcher qualified as D
import Gargantext.Core.Notifications.Dispatcher.Types qualified as DT
import Gargantext.Core.Config.Types (NotificationsConfig(..))
=======
import Gargantext.Core.Notifications.CentralExchange qualified as CE
import Gargantext.Core.Notifications.Dispatcher qualified as D
import Gargantext.Core.Config.Types (NotificationsConfig(..))
>>>>>>> dev
import Shelly hiding (FilePath) import Shelly hiding (FilePath)
import System.IO import System.IO
import System.Process import System.Process
......
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