2 Module : Gargantext.API.Context
3 Description : Server API
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
12 {-# OPTIONS_GHC -fno-warn-orphans #-}
14 {-# LANGUAGE ScopedTypeVariables #-}
15 {-# LANGUAGE TemplateHaskell #-}
16 {-# LANGUAGE TypeOperators #-}
18 module Gargantext.API.Context
21 import Data.Aeson (FromJSON, ToJSON)
24 import Gargantext.API.Admin.Auth (withAccess)
25 import Gargantext.API.Admin.Auth.Types (PathId(..))
26 import Gargantext.API.Prelude
27 import Gargantext.Database.Admin.Types.Node
28 import Gargantext.Database.Prelude -- (Cmd, CmdM)
29 import Gargantext.Database.Query.Table.Context
31 -------------------------------------------------------------------
32 -- TODO use Context instead of Node
33 type ContextAPI a = Get '[JSON] (Node a)
35 ------------------------------------------------------------------------
36 -- TODO NodeAPI -> ContextAPI
37 contextAPI :: forall proxy a.
44 -> GargServer (ContextAPI a)
45 contextAPI p uId id' = withAccess (Proxy :: Proxy (ContextAPI a)) Proxy uId (PathNode id') contextAPI'
47 contextAPI' :: GargServer (ContextAPI a)
48 contextAPI' = getContextWith id' p