remove remaining dead code left over from /dev endpoints

db::ensure_dev_athlete was never called (main.rs had its own,
inferior copy, removed in the previous commit). Config::dev_sync_days
and Config::require_api_key were only used by the now-removed
/dev/sync handlers.
This commit is contained in:
Claude 2026-08-13 02:09:58 +00:00 committed by Jonas Rabenstein
commit 85369069c3
2 changed files with 0 additions and 53 deletions

View file

@ -16,8 +16,6 @@ pub struct Config {
pub intervals_webhook_secret: Option<String>,
pub cookie_secure: bool,
pub dev_sync_days: i64,
}
impl Config {
@ -50,15 +48,6 @@ impl Config {
.parse::<bool>()
.context("COOKIE_SECURE must be true or false")?;
let dev_sync_days = env::var("DEV_SYNC_DAYS")
.unwrap_or_else(|_| "30".to_string())
.parse::<i64>()
.context("DEV_SYNC_DAYS must be an integer")?;
if dev_sync_days <= 0 {
anyhow::bail!("DEV_SYNC_DAYS must be greater than zero");
}
Ok(Self {
database_url,
bind_address,
@ -73,16 +62,8 @@ impl Config {
intervals_webhook_secret,
cookie_secure,
dev_sync_days,
})
}
pub fn require_api_key(&self) -> Result<&str> {
self.intervals_api_key
.as_deref()
.context("INTERVALS_API_KEY is not configured")
}
}
fn required(name: &str) -> Result<String> {

View file

@ -158,40 +158,6 @@ pub async fn delete_old_oauth_states(db: &PgPool) -> Result<()> {
Ok(())
}
pub async fn ensure_dev_athlete(
db: &PgPool,
intervals_athlete_id: &str,
display_name: &str,
api_key: &str,
) -> Result<i64> {
let row = sqlx::query(
r#"
INSERT INTO athletes (
intervals_athlete_id,
display_name,
access_token,
scopes
)
VALUES ($1, $2, $3, 'dev')
ON CONFLICT (intervals_athlete_id)
DO UPDATE SET
display_name = EXCLUDED.display_name,
access_token = EXCLUDED.access_token,
updated_at = now()
RETURNING id
"#,
)
.bind(intervals_athlete_id)
.bind(display_name)
.bind(api_key)
.fetch_one(db)
.await?;
use sqlx::Row;
Ok(row.try_get("id")?)
}
/// Create or update an athlete authenticated with a personal API key.
pub async fn upsert_api_key_athlete(
db: &PgPool,