Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
NACSOS Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MCC APSIS
NACSOS
NACSOS Core
Commits
05d1c00d
Commit
05d1c00d
authored
6 months ago
by
Tim Repke
Browse files
Options
Downloads
Patches
Plain Diff
add test db endpoint, fix startup error
parent
7751e1a7
No related branches found
No related tags found
1 merge request
!104
Main
Pipeline
#3776
passed
6 months ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/api/routes/ping.py
+13
-0
13 additions, 0 deletions
server/api/routes/ping.py
with
13 additions
and
0 deletions
server/api/routes/ping.py
+
13
−
0
View file @
05d1c00d
from
fastapi
import
APIRouter
from
fastapi.responses
import
PlainTextResponse
from
sqlalchemy
import
select
,
func
as
F
from
nacsos_data.db.schemas.projects
import
Project
from
server.pipelines
import
tasks
from
server.util.logging
import
get_logger
from
server.util.security
import
InsufficientPermissions
from
server.data
import
db_engine
logger
=
get_logger
(
'
nacsos.api.route.ping
'
)
router
=
APIRouter
()
...
...
@@ -57,6 +61,15 @@ async def perm():
raise
InsufficientPermissions
(
'
You do not have permission to edit this data import.
'
)
@router.get
(
'
/database
'
)
async
def
db_test
():
async
with
db_engine
.
engine
.
connect
()
as
session
:
rslt
=
(
await
session
.
execute
(
select
(
F
.
count
(
Project
.
project_id
)))).
scalar
()
logger
.
debug
(
f
'
There are
{
rslt
:
,
}
projects on the platform
'
)
await
session
.
close
()
return
rslt
@router.post
(
'
/{name}
'
,
response_class
=
PlainTextResponse
)
async
def
_ping
(
name
:
str
)
->
str
:
return
f
'
Hello
{
name
}
'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment