Commit f860b55e authored by Karen Konou's avatar Karen Konou

[GQL] Do not erase types when comapring NodeIds

parent 4898b67a
...@@ -47,7 +47,6 @@ import Gargantext.Prelude ...@@ -47,7 +47,6 @@ import Gargantext.Prelude
import GHC.Generics (Generic) import GHC.Generics (Generic)
import Gargantext.API.GraphQL.Utils (AuthStatus(Invalid, Valid), authUser) import Gargantext.API.GraphQL.Utils (AuthStatus(Invalid, Valid), authUser)
import Gargantext.API.Admin.Types (HasSettings) import Gargantext.API.Admin.Types (HasSettings)
import Gargantext.Database.Admin.Types.Node (unNodeId)
data UserInfo = UserInfo data UserInfo = UserInfo
{ ui_id :: Int { ui_id :: Int
...@@ -152,7 +151,7 @@ updateUserInfo (UserInfoMArgs { ui_id, .. }) = do ...@@ -152,7 +151,7 @@ updateUserInfo (UserInfoMArgs { ui_id, .. }) = do
uh lens' (Just val) u_hyperdata = u_hyperdata & lens' .~ Just val uh lens' (Just val) u_hyperdata = u_hyperdata & lens' .~ Just val
uh' _ Nothing u_hyperdata = u_hyperdata uh' _ Nothing u_hyperdata = u_hyperdata
uh' lens' (Just val) u_hyperdata = u_hyperdata & lens' .~ val uh' lens' (Just val) u_hyperdata = u_hyperdata & lens' .~ val
nId Node {_node_id} = unNodeId _node_id nId Node {_node_id} = _node_id
-- | Inner function to fetch the user from DB. -- | Inner function to fetch the user from DB.
dbUsers dbUsers
......
...@@ -22,7 +22,7 @@ import Control.Lens.Getter (view) ...@@ -22,7 +22,7 @@ import Control.Lens.Getter (view)
import Gargantext.Database.Prelude (Cmd') import Gargantext.Database.Prelude (Cmd')
import Gargantext.API.Admin.Auth.Types (AuthenticatedUser (AuthenticatedUser, _authUser_id)) import Gargantext.API.Admin.Auth.Types (AuthenticatedUser (AuthenticatedUser, _authUser_id))
import Data.ByteString (ByteString) import Data.ByteString (ByteString)
import Gargantext.Database.Admin.Types.Node (unNodeId) import Gargantext.Database.Admin.Types.Node (NodeId)
unPrefix :: T.Text -> GQLTypeOptions -> GQLTypeOptions unPrefix :: T.Text -> GQLTypeOptions -> GQLTypeOptions
unPrefix prefix options = options { fieldLabelModifier = nflm } unPrefix prefix options = options { fieldLabelModifier = nflm }
...@@ -31,7 +31,7 @@ unPrefix prefix options = options { fieldLabelModifier = nflm } ...@@ -31,7 +31,7 @@ unPrefix prefix options = options { fieldLabelModifier = nflm }
data AuthStatus = Valid | Invalid data AuthStatus = Valid | Invalid
authUser :: (HasSettings env) => Int -> Text -> Cmd' env err AuthStatus authUser :: (HasSettings env) => NodeId -> Text -> Cmd' env err AuthStatus
authUser ui_id token = do authUser ui_id token = do
let token' = encodeUtf8 token let token' = encodeUtf8 token
jwtS <- view $ settings . jwtSettings jwtS <- view $ settings . jwtSettings
...@@ -43,7 +43,7 @@ authUser ui_id token = do ...@@ -43,7 +43,7 @@ authUser ui_id token = do
then pure Valid then pure Valid
else pure Invalid else pure Invalid
where where
nId AuthenticatedUser {_authUser_id} = unNodeId _authUser_id nId AuthenticatedUser {_authUser_id} = _authUser_id
getUserFromToken :: JWTSettings -> ByteString -> IO (Maybe AuthenticatedUser) getUserFromToken :: JWTSettings -> ByteString -> IO (Maybe AuthenticatedUser)
getUserFromToken = verifyJWT getUserFromToken = verifyJWT
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