feat: Implement Garmin sync, login improvements, and utility scripts

This commit is contained in:
2025-10-11 11:56:25 -07:00
parent 56a93cd8df
commit 3819e4f5e2
921 changed files with 2058 additions and 371 deletions

61
README.md Normal file
View File

@@ -0,0 +1,61 @@
# FitTrack Garmin Sync Backend
This project provides a backend service for synchronizing fitness data from Garmin Connect.
## Getting Started
...
## Garmin Authentication
To enable Garmin synchronization, you need to link your Garmin Connect account with this service. This is done via a dedicated login endpoint.
### 1. Link your Garmin Account
Send a `POST` request to the `/api/garmin/login` endpoint with your Garmin Connect username (email) and password.
**Endpoint**: `POST /api/garmin/login`
**Request Body (JSON)**:
```json
{
"username": "your_garmin_email@example.com",
"password": "your_garmin_password"
}
```
**Example using `curl`**:
```bash
curl -X POST \
http://localhost:8000/api/garmin/login \
-H 'Content-Type: application/json' \
-d
{
"username": "your_garmin_email@example.com",
"password": "your_garmin_password"
}
```
**Success Response (200 OK)**:
```json
{
"message": "Garmin account linked successfully."
}
```
**Error Response (401 Unauthorized)**:
```json
{
"detail": "Invalid Garmin credentials provided."
}
```
Upon successful login, your Garmin credentials and authentication tokens will be stored in the system. The system will handle token refreshes automatically to maintain continuous synchronization.
### 2. Subsequent Synchronization
Once linked, other Garmin synchronization endpoints (e.g., for activities, health metrics) will automatically use the stored and refreshed credentials to access your Garmin data. **These subsequent synchronization calls do not require any additional authentication headers from the client.**