Sites#

async backend.app.api.sites.create_site(site: Site, db: Annotated[Session, Depends(get_db)])[source]#

Create a new site.

This endpoint allows the creation of a new research site in the database.

Parameters:
  • site (Site) – The site information to be added.

  • db (Session) – The database session.

Returns:

The created site.

Return type:

Site

async backend.app.api.sites.get_site_by_id(site_id: int, db: Annotated[Session, Depends(get_db)])[source]#

Retrieve a site by its ID.

This endpoint retrieves a research site by its ID.

Parameters:
  • site_id (int) – The ID of the site.

  • db (Session) – The database session.

Returns:

The site with the specified ID.

Return type:

Site

async backend.app.api.sites.get_sites(db: Annotated[Session, Depends(get_db)])[source]#

Retrieve all sites.

This endpoint retrieves all research sites stored in the database.

Parameters:

db (Session) – The database session.

Returns:

A list of all sites.

Return type:

list[Site]

async backend.app.api.sites.get_sites_by_area(min_lon: float, min_lat: float, max_lon: float, max_lat: float, db: Annotated[Session, Depends(get_db)])[source]#

Retrieve sites within a specified area.

This endpoint retrieves research sites that are located within a specified bounding box.

Parameters:
  • min_lon (float) – Minimum longitude of the bounding box.

  • min_lat (float) – Minimum latitude of the bounding box.

  • max_lon (float) – Maximum longitude of the bounding box.

  • max_lat (float) – Maximum latitude of the bounding box.

  • db (Session) – The database session.

Returns:

A list of sites within the specified bounding box.

Return type:

list[Site]

Raises:

HTTPException – no Site found in that area