Skip to content
Snippets Groups Projects

Main

Merged Tim Repke requested to merge main into production
1 file
+ 13
0
Compare changes
  • Side-by-side
  • Inline
+ 13
0
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}'
Loading