refactor: moved knowledge of subscription change time to store

This commit is contained in:
Jef Roosens 2025-03-15 20:20:38 +01:00
parent 8a9744c4a9
commit 330877c8c5
No known key found for this signature in database
GPG key ID: 21FD3D77D56BAF49
6 changed files with 72 additions and 25 deletions

View file

@ -85,8 +85,8 @@ pub async fn get_subscription_changes(
.unwrap()
.map(|(next_time_changed, add, remove)| {
Json(SubscriptionDeltaResponse {
add,
remove,
add: add.into_iter().map(|s| s.url).collect(),
remove: remove.into_iter().map(|s| s.url).collect(),
timestamp: next_time_changed.timestamp(),
})
})?)

View file

@ -37,7 +37,7 @@ pub async fn get_device_subscriptions(
tokio::task::spawn_blocking(move || ctx.store.subscriptions_for_device(&user, &id))
.await
.unwrap()
.map(Json)?,
.map(|subs| Json(subs.into_iter().map(|s| s.url).collect()))?,
)
}
@ -54,7 +54,7 @@ pub async fn get_user_subscriptions(
tokio::task::spawn_blocking(move || ctx.store.subscriptions_for_user(&user))
.await
.unwrap()
.map(Json)?,
.map(|subs| Json(subs.into_iter().map(|s| s.url).collect()))?,
)
}