fixups
This commit is contained in:
parent
89091a03d3
commit
eda8e76a20
4 changed files with 481 additions and 218 deletions
11
src/db.rs
11
src/db.rs
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue