From 3abed0fccaadc4e96534fab3b69798da3f4d3dbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 11 Sep 2026 14:38:33 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20chore:=20re-point=20profile/badg?= =?UTF-8?q?e=20callers=20after=20identity=20merge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/db/pomodoro.rs | 4 ++-- src/web/users.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/db/pomodoro.rs b/src/db/pomodoro.rs index 97a5e5b..7ba6434 100644 --- a/src/db/pomodoro.rs +++ b/src/db/pomodoro.rs @@ -663,7 +663,7 @@ mod tests { // Every one of them is still the student's own history. assert_eq!(list_for_user(&db, &user).await.unwrap().len(), 200); assert!( - badge::BadgeAward::list_for(&user, &db) + crate::db::badge::list_for(&db, &user) .await .unwrap() .is_empty(), @@ -734,7 +734,7 @@ mod tests { assert_eq!(closed.get_finished_at().unwrap().as_millis(), started); // And the stat that sums these stays non-negative. - let stats = crate::domain::profile::ProfileStats::load(&user, 0, 0, &db) + let stats = crate::db::profile::load(&db, &user, 0, 0) .await .unwrap(); assert_eq!(stats.get_pomodoro_sessions(), 1); diff --git a/src/web/users.rs b/src/web/users.rs index 673b54b..b11b43a 100644 --- a/src/web/users.rs +++ b/src/web/users.rs @@ -939,7 +939,7 @@ async fn profile_of( let classes = ClassGroup::list_by_ids(&class_ids, &st.db).await?; // Both totals are the full counts, not the windowed ones — the blocks are a // preview, the stats are the truth. - let stats = ProfileStats::load(id, course_total, class_total, &st.db).await?; + let stats = crate::service::profile::load(&st.db, id, course_total, class_total).await?; let badges = badges_of(st, id, &stats).await?; Ok(ProfileResponse { id: id.key().to_string(), @@ -1017,20 +1017,20 @@ async fn badges_of( user: &UserId, stats: &ProfileStats, ) -> Result, AppError> { - let awards = BadgeAward::list_for(user, &st.db).await?; + let awards = crate::service::badge::list_for(&st.db, user).await?; let complete = badge::earned(stats.get_totals()) .iter() .all(|id| awards.iter().any(|award| award.get_badge() == *id)); if complete { return Ok(awards); } - if let Err(err) = badge::sync(user, &st.db).await { + if let Err(err) = crate::service::badge::sync(&st.db, user).await { tracing::warn!("failed to sync badges for {}: {err}", user.key()); return Ok(awards); } // Re-read so the badge just healed appears on *this* response, stamp and // all, rather than only on the next one. - BadgeAward::list_for(user, &st.db).await + crate::service::badge::list_for(&st.db, user).await } /// The profile gate: any authenticated account reads any profile — except a