Header shows the user's package and what is left of it
CI / test (push) Successful in 51s
CI / build (push) Successful in 4m0s
CI / deploy (push) Skipped

- /v1/me: `package` = the running unlimited package, or the latest main
  package bought or given (top-ups do not count; an ended unlimited not)
- header badge: "Család · 11 elemzés", "Korlátlan · 2027. november 17-ig",
  "Páros · elfogyott"; links to the packages page, details in the tooltip

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
feco
2026-11-17 19:24:52 +00:00
co-authored by Claude Opus 5.5
parent 21640ffd9e
commit 742b88183b
6 changed files with 77 additions and 1 deletions
+2
View File
@@ -33,6 +33,7 @@ pub async fn me(State(state): St, auth: AuthUser) -> ApiResult<Json<Value>> {
let birth_change = crate::birth_changes::view(&mut conn, &auth).await?;
let persons = crate::persons::slots(&mut conn, &auth, state.config.free_person_slots).await?;
let unlimited = crate::packages::unlimited_until(&mut conn, auth.id()).await?;
let package = crate::packages::current(&mut conn, auth.id(), unlimited).await?;
Ok(Json(json!({
"user": UserView::from(&auth.user),
"providers": providers.into_iter().map(|(p,)| p).collect::<Vec<_>>(),
@@ -41,6 +42,7 @@ pub async fn me(State(state): St, auth: AuthUser) -> ApiResult<Json<Value>> {
"birth_change": birth_change,
"persons": persons.view(),
"unlimited_until": rfc3339_opt(unlimited),
"package": package.map(|(p, since)| json!({ "id": p.id, "name": p.name, "since": rfc3339(since) })),
})))
}