Header shows the user's package and what is left of it
- /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:
@@ -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) })),
|
||||
})))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user