]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/API/GraphQL/AsyncTask.hs
[graphql] first asynctask work
[gargantext.git] / src / Gargantext / API / GraphQL / AsyncTask.hs
1 {-# LANGUAGE DeriveAnyClass #-}
2 {-# LANGUAGE DuplicateRecordFields #-}
3
4 module Gargantext.API.GraphQL.AsyncTask where
5
6 import Control.Lens
7 import Data.Morpheus.Types
8 ( GQLType
9 , Resolver
10 , ResolverM
11 , QUERY
12 , lift
13 )
14 import Data.Text (Text)
15 import qualified Data.Text as T
16 import Gargantext.API.Admin.Orchestrator.Types (JobLog(..))
17 import Gargantext.API.Prelude (GargM, GargError)
18 import Gargantext.Core.Mail.Types (HasMail)
19 import Gargantext.Database.Admin.Types.Node (NodeId(..))
20 import Gargantext.Database.Prelude (HasConnectionPool, HasConfig)
21 import Gargantext.Prelude
22 import GHC.Generics (Generic)
23
24 data JobLogArgs
25 = JobLogArgs
26 { job_log_id :: Int
27 } deriving (Generic, GQLType)
28
29 type GqlM e env = Resolver QUERY e (GargM env GargError)
30
31 resolveJobLogs
32 :: (HasConnectionPool env, HasConfig env)
33 => JobLogArgs -> GqlM e env [JobLog]
34 resolveJobLogs JobLogArgs { job_log_id } = dbJobLogs job_log_id
35
36 dbJobLogs
37 :: (HasConnectionPool env, HasConfig env)
38 => Int -> GqlM e env [JobLog]
39 dbJobLogs job_log_id = do
40 getJobLogs job_log_id