Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
199
Issues
199
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
ada0b34b
Verified
Commit
ada0b34b
authored
Jun 24, 2025
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[API] version with git hash
parent
d362b468
Pipeline
#7696
passed with stages
in 47 minutes and 15 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
9 deletions
+38
-9
gargantext.cabal
gargantext.cabal
+1
-0
Named.hs
src/Gargantext/API/Routes/Named.hs
+2
-2
Types.hs
src/Gargantext/API/Routes/Types.hs
+24
-5
Named.hs
src/Gargantext/API/Server/Named.hs
+7
-1
Authentication.hs
test/Test/API/Authentication.hs
+4
-1
No files found.
gargantext.cabal
View file @
ada0b34b
...
...
@@ -546,6 +546,7 @@ library
, fullstop ^>= 0.1.4
, gargantext-graph-core >= 0.2.0.0
, gargantext-prelude
, githash >= 0.1.7.0 && < 0.2
, graphviz ^>= 2999.20.1.0
, haskell-bee
, haskell-bee-pgmq
...
...
src/Gargantext/API/Routes/Named.hs
View file @
ada0b34b
...
...
@@ -25,7 +25,7 @@ import Gargantext.API.Admin.FrontEnd (FrontEndAPI)
import
Gargantext.API.GraphQL
(
GraphQLAPI
)
import
Gargantext.API.Routes.Named.Private
(
GargPrivateAPI
)
import
Gargantext.API.Routes.Named.Public
(
GargPublicAPI
)
import
Gargantext.API.Routes.Types
(
WithCustomErrorScheme
)
import
Gargantext.API.Routes.Types
(
GargVersionResponse
,
WithCustomErrorScheme
)
import
Gargantext.API.Worker
(
WorkerAPI
)
import
Gargantext.Core.Notifications.Dispatcher.WebSocket
qualified
as
Dispatcher
import
Servant.API
((
:>
),
(
:-
),
JSON
,
ReqBody
,
Post
,
Get
,
QueryParam
)
...
...
@@ -102,5 +102,5 @@ data ForgotPasswordAsyncAPI mode = ForgotPasswordAsyncAPI
data
GargVersion
mode
=
GargVersion
{
gargVersionEp
::
mode
:-
"version"
:>
Summary
"Backend version"
:>
Get
'[
J
SON
]
Text
{
gargVersionEp
::
mode
:-
"version"
:>
Summary
"Backend version"
:>
Get
'[
J
SON
]
GargVersionResponse
}
deriving
Generic
src/Gargantext/API/Routes/Types.hs
View file @
ada0b34b
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
module
Gargantext.API.Routes.Types
where
import
Control.Lens
((
&
),
(
%~
),
traversed
)
import
Data.
ByteString
(
ByteString
)
import
Control.Lens
((
%~
),
traversed
)
import
Data.
Aeson
((
.:
),
(
.=
),
object
,
withObject
)
import
Data.CaseInsensitive
qualified
as
CI
import
Data.List
qualified
as
L
import
Data.
Proxy
(
Proxy
(
..
)
)
import
Data.
Swagger
(
ToSchema
)
import
Data.Set
qualified
as
Set
import
Data.Text
qualified
as
T
import
Gargantext.API.Errors
(
GargErrorScheme
(
..
),
renderGargErrorScheme
)
import
Gargantext.Prelude
import
Network.HTTP.Types
(
HeaderName
)
import
Network.Wai
(
requestHeaders
)
import
Prelude
import
Servant.API.Routes
(
HasRoutes
,
getRoutes
,
mkHeaderRep
,
responseHeaders
)
import
Servant.API.Routes.Internal.Response
(
unResponses
)
import
Servant.API.Routes.Route
(
routeResponse
)
...
...
@@ -60,3 +61,21 @@ instance (HasRoutes subApi) => HasRoutes (WithCustomErrorScheme subApi) where
errHeader
=
mkHeaderRep
@
"X-Garg-Error-Scheme"
@
ByteString
addHeader'
rt
=
rt
&
routeResponse
.
unResponses
.
traversed
.
responseHeaders
%~
Set
.
insert
errHeader
in
addHeader'
<$>
apiRoutes
data
GargVersionResponse
=
GargVersionResponse
{
_gvr_version
::
T
.
Text
,
_gvr_commitHash
::
T
.
Text
}
deriving
(
Show
,
Eq
,
Generic
)
instance
NFData
GargVersionResponse
instance
ToJSON
GargVersionResponse
where
toJSON
GargVersionResponse
{
..
}
=
object
[
"version"
.=
toJSON
_gvr_version
,
"commitHash"
.=
toJSON
_gvr_commitHash
]
instance
FromJSON
GargVersionResponse
where
parseJSON
=
withObject
"GargVersionResponse"
$
\
o
->
do
_gvr_version
<-
o
.:
"version"
_gvr_commitHash
<-
o
.:
"commitHash"
pure
GargVersionResponse
{
..
}
instance
ToSchema
GargVersionResponse
src/Gargantext/API/Server/Named.hs
View file @
ada0b34b
...
...
@@ -19,6 +19,7 @@ import Gargantext.API.Errors
import
Gargantext.API.GraphQL
as
GraphQL
import
Gargantext.API.Prelude
(
GargM
)
import
Gargantext.API.Routes.Named
import
Gargantext.API.Routes.Types
(
GargVersionResponse
(
..
))
import
Gargantext.API.Server.Named.Public
(
serverPublicGargAPI
)
import
Gargantext.API.Swagger
(
openApiDoc
)
import
Gargantext.API.ThrowAll
(
serverPrivateGargAPI
)
...
...
@@ -27,6 +28,7 @@ import Gargantext.Core.Config (gc_frontend_config, hasConfig)
import
Gargantext.Core.Config.Types
(
fc_url_backend_api
)
import
Gargantext.Prelude
hiding
(
Handler
,
catch
)
import
Gargantext.System.Logging
(
logLocM
,
LogLevel
(
..
))
import
GitHash
import
Paths_gargantext
qualified
as
PG
-- cabal magic build module
import
Servant
import
Servant.Server.Generic
(
AsServer
,
AsServerT
)
...
...
@@ -43,8 +45,12 @@ serverGargAPI env
,
gargPublicAPI
=
serverPublicGargAPI
(
env
^.
hasConfig
.
gc_frontend_config
.
fc_url_backend_api
)
}
where
gi
=
$$
tGitInfoCwd
gargVersion
::
GargVersion
(
AsServerT
(
GargM
Env
BackendInternalError
))
gargVersion
=
GargVersion
$
pure
(
cs
$
showVersion
PG
.
version
)
gargVersion
=
GargVersion
{
gargVersionEp
=
pure
$
GargVersionResponse
{
_gvr_version
=
cs
$
showVersion
PG
.
version
,
_gvr_commitHash
=
T
.
pack
$
giHash
gi
}
}
-- | Server declarations
server
::
Env
->
API
AsServer
...
...
test/Test/API/Authentication.hs
View file @
ada0b34b
...
...
@@ -17,6 +17,7 @@ import Data.Aeson.QQ
import
Data.Text
as
T
import
Gargantext.API.Admin.Auth.Types
import
Gargantext.API.Routes.Named
import
Gargantext.API.Routes.Types
(
GargVersionResponse
(
..
))
import
Gargantext.Core.Types
import
Gargantext.Core.Types.Individu
import
Gargantext.Database.Action.User.New
...
...
@@ -50,7 +51,9 @@ tests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith (\ctx -> setupE
result
<-
runClientM
version_api
(
clientEnv
_sctx_port
)
case
result
of
Left
err
->
Prelude
.
fail
(
show
err
)
Right
r
->
r
`
shouldSatisfy
`
((
>=
1
)
.
T
.
length
)
-- we got something back
Right
(
GargVersionResponse
{
..
})
->
do
_gvr_version
`
shouldSatisfy
`
((
>=
1
)
.
T
.
length
)
-- we got something back
_gvr_commitHash
`
shouldSatisfy
`
((
>=
1
)
.
T
.
length
)
-- we got something back
describe
"POST /api/v1.0/auth"
$
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment