Skip to content
24 changes: 12 additions & 12 deletions api/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def database_error_handler(
summary="Create a new contact",
status_code=status.HTTP_201_CREATED,
)
def create_contact(
async def create_contact(
contact_data: CreateContact, session: session_dependency, user: amp_admin_dependency
) -> ContactResponse:
try:
Expand All @@ -133,7 +133,7 @@ def create_contact(
summary="Add an address to a contact",
status_code=status.HTTP_201_CREATED,
)
def create_address(
async def create_address(
address_data: CreateAddress,
session: session_dependency,
user: amp_admin_dependency,
Expand All @@ -156,7 +156,7 @@ def create_address(
summary="Add an email to a contact",
status_code=status.HTTP_201_CREATED,
)
def create_email(
async def create_email(
email_data: CreateEmail,
session: session_dependency,
user: amp_admin_dependency,
Expand All @@ -172,7 +172,7 @@ def create_email(
summary="Add a phone number to a contact",
status_code=status.HTTP_201_CREATED,
)
def create_phone(
async def create_phone(
phone_data: CreatePhone,
session: session_dependency,
user: amp_admin_dependency,
Expand Down Expand Up @@ -211,7 +211,7 @@ def create_phone(
@router.patch(
"/email/{email_id}",
)
def update_contact_email(
async def update_contact_email(
email_id: int,
email_data: UpdateEmail,
session: session_dependency,
Expand All @@ -226,7 +226,7 @@ def update_contact_email(
@router.patch(
"/phone/{phone_id}",
)
def update_contact_phone(
async def update_contact_phone(
phone_id: int,
phone_data: UpdatePhone,
session: session_dependency,
Expand All @@ -246,7 +246,7 @@ def update_contact_phone(
@router.patch(
"/address/{address_id}",
)
def update_contact_address(
async def update_contact_address(
address_id: int,
address_data: UpdateAddress,
session: session_dependency,
Expand Down Expand Up @@ -294,7 +294,7 @@ def update_contact_address(


@router.patch("/{contact_id}", summary="Update contact")
def update_contact(
async def update_contact(
contact_id: int,
contact_data: UpdateContact,
session: session_dependency,
Expand Down Expand Up @@ -497,7 +497,7 @@ async def get_contact_addresses(


@router.delete("/email/{email_id}", summary="Delete contact email")
def delete_contact_email(
async def delete_contact_email(
email_id: int, session: session_dependency, user: amp_admin_dependency
):
"""
Expand All @@ -507,7 +507,7 @@ def delete_contact_email(


@router.delete("/phone/{phone_id}", summary="Delete contact phone")
def delete_contact_phone(
async def delete_contact_phone(
phone_id: int, session: session_dependency, user: amp_admin_dependency
):
"""
Expand All @@ -517,7 +517,7 @@ def delete_contact_phone(


@router.delete("/address/{address_id}", summary="Delete contact address")
def delete_contact_address(
async def delete_contact_address(
address_id: int, session: session_dependency, user: amp_admin_dependency
):
"""
Expand All @@ -542,7 +542,7 @@ def delete_contact_address(


@router.delete("/{contact_id}", summary="Delete contact")
def delete_contact(
async def delete_contact(
contact_id: int, session: session_dependency, user: amp_admin_dependency
):
"""
Expand Down
2 changes: 1 addition & 1 deletion api/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@


@router.post("", summary="Create a new group", status_code=HTTP_201_CREATED)
def create_group(
async def create_group(
group_data: CreateGroup, session: session_dependency, user: admin_dependency
) -> GroupResponse:
"""
Expand Down
22 changes: 12 additions & 10 deletions api/lexicon.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def database_error_handler(
"/category",
status_code=HTTP_201_CREATED,
)
def add_category(
async def add_category(
category_data: CreateLexiconCategory,
session: session_dependency,
user: admin_dependency,
Expand All @@ -118,7 +118,7 @@ def add_category(
summary="Add term",
status_code=HTTP_201_CREATED,
)
def add_term(
async def add_term(
term_data: CreateLexiconTerm, session: session_dependency, user: admin_dependency
) -> LexiconTermResponse:
"""
Expand All @@ -135,7 +135,7 @@ def add_term(
summary="Add triple",
status_code=HTTP_201_CREATED,
)
def add_triple(
async def add_triple(
triple_data: CreateLexiconTriple,
session: session_dependency,
user: admin_dependency,
Expand All @@ -151,7 +151,7 @@ def add_triple(


@router.patch("/term/{term_id}", status_code=HTTP_200_OK)
def update_lexicon_term(
async def update_lexicon_term(
term_id: int,
term_data: UpdateLexiconTerm,
session: session_dependency,
Expand All @@ -162,7 +162,7 @@ def update_lexicon_term(


@router.patch("/category/{category_id}", status_code=HTTP_200_OK)
def update_lexicon_category(
async def update_lexicon_category(
category_id: int,
category_data: UpdateLexiconCategory,
session: session_dependency,
Expand All @@ -174,7 +174,7 @@ def update_lexicon_category(


@router.patch("/triple/{triple_id}", status_code=HTTP_200_OK)
def update_lexicon_triple(
async def update_lexicon_triple(
triple_id: int,
triple_data: UpdateLexiconTriple,
session: session_dependency,
Expand All @@ -190,7 +190,7 @@ def update_lexicon_triple(


@router.get("/term", summary="Get lexicon terms", status_code=HTTP_200_OK)
def get_lexicon_terms(
async def get_lexicon_terms(
session: session_dependency,
category: str | None = None,
term: str | None = None,
Expand Down Expand Up @@ -226,12 +226,14 @@ def get_lexicon_terms(


@router.get("/term/{term_id}", status_code=HTTP_200_OK)
def get_lexicon_term(term_id: int, session: session_dependency) -> LexiconTermResponse:
async def get_lexicon_term(
term_id: int, session: session_dependency
) -> LexiconTermResponse:
return simple_get_by_id(session, LexiconTerm, term_id)


@router.get("/category")
def get_lexicon_categories(
async def get_lexicon_categories(
session: session_dependency,
sort: str = "name",
order: str = "asc",
Expand All @@ -244,7 +246,7 @@ def get_lexicon_categories(


@router.get("/category/{category_id}")
def get_lexicon_category(
async def get_lexicon_category(
category_id: int, session: session_dependency
) -> LexiconCategoryResponse:
return simple_get_by_id(session, LexiconCategory, category_id)
Expand Down
4 changes: 2 additions & 2 deletions api/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
summary="Create a new sample location",
status_code=status.HTTP_201_CREATED,
)
def create_location(
async def create_location(
location_data: CreateLocation, session: session_dependency, user: admin_dependency
) -> LocationResponse:
"""
Expand All @@ -55,7 +55,7 @@ def create_location(
"/{location_id}",
summary="Update a location",
)
def update_location(
async def update_location(
location_id: int,
location_data: UpdateLocation,
session: session_dependency,
Expand Down
30 changes: 15 additions & 15 deletions api/observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

# ============= Post =============================================
@router.post("/groundwater-level", status_code=HTTP_201_CREATED)
def add_groundwater_level_observation(
async def add_groundwater_level_observation(
obs_data: CreateGroundwaterLevelObservation,
session: session_dependency,
user: amp_admin_dependency,
Expand All @@ -63,7 +63,7 @@ def add_groundwater_level_observation(


@router.post("/water-chemistry", status_code=HTTP_201_CREATED)
def add_water_chemistry_observation(
async def add_water_chemistry_observation(
obs_data: CreateWaterChemistryObservation,
session: session_dependency,
user: amp_admin_dependency,
Expand All @@ -76,7 +76,7 @@ def add_water_chemistry_observation(


@router.post("/geothermal", status_code=HTTP_201_CREATED)
def add_geothermal_observation(
async def add_geothermal_observation(
obs_data: CreateGeothermalObservation,
session: session_dependency,
user: admin_dependency,
Expand All @@ -92,7 +92,7 @@ def add_geothermal_observation(


@router.patch("/groundwater-level/{observation_id}", status_code=HTTP_200_OK)
def update_groundwater_level_observation(
async def update_groundwater_level_observation(
observation_id: int,
obs_data: UpdateGroundwaterLevelObservation,
session: session_dependency,
Expand All @@ -106,7 +106,7 @@ def update_groundwater_level_observation(


@router.patch("/water-chemistry/{observation_id}", status_code=HTTP_200_OK)
def update_water_chemistry_observation(
async def update_water_chemistry_observation(
observation_id: int,
obs_data: UpdateWaterChemistryObservation,
session: session_dependency,
Expand All @@ -120,7 +120,7 @@ def update_water_chemistry_observation(


@router.patch("/geothermal/{observation_id}", status_code=HTTP_200_OK)
def update_geothermal_observation(
async def update_geothermal_observation(
observation_id: int,
obs_data: UpdateGeothermalObservation,
session: session_dependency,
Expand All @@ -137,7 +137,7 @@ def update_geothermal_observation(


@router.get("/groundwater-level", summary="Get groundwater level observations")
def get_groundwater_level_observations(
async def get_groundwater_level_observations(
request: Request,
session: session_dependency,
user: amp_viewer_dependency,
Expand Down Expand Up @@ -171,7 +171,7 @@ def get_groundwater_level_observations(
"/groundwater-level/{observation_id}",
summary="Get groundwater level observation by ID",
)
def get_groundwater_level_observation_by_id(
async def get_groundwater_level_observation_by_id(
session: session_dependency,
request: Request,
user: amp_viewer_dependency,
Expand All @@ -185,7 +185,7 @@ def get_groundwater_level_observation_by_id(


@router.get("/water-chemistry", summary="Get water chemistry observations")
def get_water_chemistry_observations(
async def get_water_chemistry_observations(
request: Request,
session: session_dependency,
user: amp_viewer_dependency,
Expand Down Expand Up @@ -218,7 +218,7 @@ def get_water_chemistry_observations(
@router.get(
"/water-chemistry/{observation_id}", summary="Get water chemistry observation by ID"
)
def get_water_chemistry_observation_by_id(
async def get_water_chemistry_observation_by_id(
session: session_dependency,
request: Request,
user: amp_viewer_dependency,
Expand All @@ -232,7 +232,7 @@ def get_water_chemistry_observation_by_id(


@router.get("/geothermal", summary="Get geothermal observations")
def get_geothermal_observations(
async def get_geothermal_observations(
request: Request,
session: session_dependency,
user: viewer_dependency,
Expand Down Expand Up @@ -263,7 +263,7 @@ def get_geothermal_observations(


@router.get("/geothermal/{observation_id}", summary="Get geothermal observation by ID")
def get_geothermal_observation_by_id(
async def get_geothermal_observation_by_id(
session: session_dependency,
request: Request,
user: amp_viewer_dependency,
Expand All @@ -275,7 +275,7 @@ def get_geothermal_observation_by_id(


@router.get("", summary="Get all observations")
def get_all_observations(
async def get_all_observations(
request: Request,
session: session_dependency,
user: amp_viewer_dependency,
Expand Down Expand Up @@ -303,7 +303,7 @@ def get_all_observations(


@router.get("/{observation_id}", summary="Get an observation by its ID")
def get_observation_by_id(
async def get_observation_by_id(
session: session_dependency, user: amp_viewer_dependency, observation_id: int
) -> ObservationResponse:
return simple_get_by_id(session, Observation, observation_id)
Expand All @@ -317,7 +317,7 @@ def get_observation_by_id(
summary="Delete an observation",
status_code=HTTP_204_NO_CONTENT,
)
def delete_observation(
async def delete_observation(
session: session_dependency, user: amp_admin_dependency, observation_id: int
) -> None:
return model_deleter(session, Observation, observation_id)
Expand Down
Loading
Loading