48 lines
1.6 KiB
Markdown
48 lines
1.6 KiB
Markdown
## weather_api
|
|
|
|
### Overview
|
|
This API serves as a backend system for managing the location of the Open Meteo Weather dashboard. It includes functionalities for creating, updating, deleting and searching available locations.
|
|
|
|
|
|
### Endpoints
|
|
1. **GET /locations**:
|
|
* Retrieve a list of all the locations stored in the database.
|
|
* The locations configured by the user
|
|
2. **GET /locations/{id}**:
|
|
* Retriev weather data for the specified ID.
|
|
3. **POST /locations**: Add a new location to the database.
|
|
4. **DELETE /locations/{id}**:
|
|
* Delete a location with the specified ID.
|
|
5. **GET /location/search**:
|
|
* Get available locations from Open Meteo using the Geolocation API they provide
|
|
|
|
|
|
### Database Integration
|
|
|
|
- Implemented SQLAlchemy connection with a Postgres database.
|
|
- Implemented Models:
|
|
- *Location` model with id, name, latitude, and longitude.*
|
|
- *Users* model with
|
|
- Database Tables:
|
|
* locations
|
|
- For location storing
|
|
* users:
|
|
- Prototype table for user information
|
|
* config:
|
|
- Storing of user selected locations for the Dashboard
|
|
|
|
|
|
|
|

|
|
|
|
### Installation
|
|
To run the API locally, follow these steps:
|
|
1. Clone the repository.
|
|
2. Deploy and activate a venv
|
|
3. Install the necessary dependencies by running `pip install -r requirements.txt`.
|
|
4. Set up the database connection in the `config.py` file.
|
|
5. Run the application by executing `uvicorn main:app --reload`.
|
|
|
|
* Or you can use the Dockerfile for creating a docker image.
|
|
* *Also there is a public image at git.argideli.com/argideli/weather_api:latest*
|