This commit is contained in:
Jonas Rabenstein 2026-08-12 14:24:50 +02:00
commit eda8e76a20
4 changed files with 481 additions and 218 deletions

View file

@ -8,7 +8,9 @@ use crate::model::DetectedCrossing;
pub fn hash_token(token: &str) -> Vec<u8> {
let mut hasher = Sha256::new();
hasher.update(token.as_bytes());
hasher.finalize().to_vec()
}
@ -54,6 +56,7 @@ pub async fn athlete_for_session(db: &PgPool, token: &str) -> Result<Option<(i64
if let Some(row) = row {
let id: i64 = row.try_get("id")?;
let name: String = row.try_get("display_name")?;
sqlx::query(
@ -102,7 +105,13 @@ pub async fn ensure_activity(
activity_json,
processed_at
)
VALUES ($1, $2, $3, $4, NULL)
VALUES (
$1,
$2,
$3,
$4,
NULL
)
ON CONFLICT (
athlete_id,
intervals_activity_id