Skip to content
Snippets Groups Projects
Commit 70f8b43d authored by Nico Vermaas's avatar Nico Vermaas
Browse files

add '/adex-fastapi' prefix to router

parent 3c91cb40
No related branches found
No related tags found
No related merge requests found
Pipeline #35333 passed
...@@ -4,10 +4,11 @@ ...@@ -4,10 +4,11 @@
## Development ## Development
### localhost (laptop) ### localhost (laptop)
* http://localhost:8000/adex-fastapi/skyviews/ * http://localhost:8000/adex-fastapi/skyviews/
* http://localhost:8000/adex-fastapi/skyviews_rectangle/?ra_min=70&ra_max=90&dec_min=15&dec_max=17&limit=10000 * http://localhost:8000/adex-fastapi/skyviews_rectangle/?ra_min=40&ra_max=50&dec_min=25&dec_max=35&limit=1000
### sdc-dev (test environment) ### sdc-dev (test environment)
* https://sdc-dev.astron.nl/adex-fastapi/skyviews/ * https://sdc-dev.astron.nl/adex-fastapi/skyviews/
* https://sdc-dev.astron.nl/adex-fastapi/skyviews_rectangle/?ra_min=40&ra_max=50&dec_min=25&dec_max=35&limit=1000
## data procedures (rough) ## data procedures (rough)
* [dump/load a copy of the alta database](https://web-of-wyrd.nl/myworkwiki/doku.php?id=alta_runtime&s[]=dump#qhow_do_i_dump_and_load_a_copy_of_the_production_database_with_postgres_into_a_dev_or_vm_environment) * [dump/load a copy of the alta database](https://web-of-wyrd.nl/myworkwiki/doku.php?id=alta_runtime&s[]=dump#qhow_do_i_dump_and_load_a_copy_of_the_production_database_with_postgres_into_a_dev_or_vm_environment)
......
...@@ -5,7 +5,7 @@ from sqlalchemy.orm import Session ...@@ -5,7 +5,7 @@ from sqlalchemy.orm import Session
from database import crud, models, schemas from database import crud, models, schemas
from database.database import SessionLocal, engine from database.database import SessionLocal, engine
router = APIRouter(tags=["skyviews"],) router = APIRouter(prefix="/adex-fastapi", tags=["skyviews"],)
# Dependency # Dependency
def get_db(): def get_db():
...@@ -18,11 +18,12 @@ def get_db(): ...@@ -18,11 +18,12 @@ def get_db():
# http://127.0.0.1:8000/skyviews/ # http://127.0.0.1:8000/skyviews/
# http://127.0.0.1:8000/skyviews/?skip=100&limit=100 # http://127.0.0.1:8000/skyviews/?skip=100&limit=100
@router.get("/adex-fastapi/skyviews/", tags=["skyviews"], response_model=List[schemas.SkyView]) @router.get("/skyviews/", tags=["skyviews"], response_model=List[schemas.SkyView])
async def get_skyviews(skip: int = 0, limit: int = 1000, db: Session = Depends(get_db)): async def get_skyviews(skip: int = 0, limit: int = 1000, db: Session = Depends(get_db)):
items = crud.get_skyviews(db, skip=skip, limit=limit) items = crud.get_skyviews(db, skip=skip, limit=limit)
return items return items
# http://localhost:8000/adex-fastapi/skyviews_rectangle/?ra_min=40&ra_max=50&dec_min=25&dec_max=35&limit=1000
@router.get("/skyviews_rectangle/", tags=["skyviews"], response_model=List[schemas.SkyView]) @router.get("/skyviews_rectangle/", tags=["skyviews"], response_model=List[schemas.SkyView])
async def get_skyviews_rectangle(ra_min: float = 0.0, ra_max: float = 1.0, async def get_skyviews_rectangle(ra_min: float = 0.0, ra_max: float = 1.0,
dec_min: float = 0.0, dec_max: float = 1.0, dec_min: float = 0.0, dec_max: float = 1.0,
......
...@@ -58,6 +58,7 @@ def do_convert(source, target): ...@@ -58,6 +58,7 @@ def do_convert(source, target):
record_to_insert = (observation, observation, ra, dec, "alta",0, dt,dst, access_url) record_to_insert = (observation, observation, ra, dec, "alta",0, dt,dst, access_url)
target_cursor.execute(insert_into_skyview,record_to_insert) target_cursor.execute(insert_into_skyview,record_to_insert)
target_connection.commit() target_connection.commit()
except Error as e: except Error as e:
print(e) print(e)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment