1
0
Fork 0
forked from gorb/backend

feat: include user in message response

This commit is contained in:
Radical 2025-05-29 02:39:05 +02:00
parent 65918ae5f2
commit 4d7aabc8ac
5 changed files with 90 additions and 27 deletions

View file

@ -39,16 +39,7 @@ pub async fn get(
check_access_token(auth_header, &mut conn).await?;
if let Ok(cache_hit) = data.get_cache_key(uuid.to_string()).await {
return Ok(HttpResponse::Ok()
.content_type("application/json")
.body(cache_hit));
}
let user = User::fetch_one(&mut conn, uuid).await?;
data.set_cache_key(uuid.to_string(), user.clone(), 1800)
.await?;
let user = User::fetch_one(&data, uuid).await?;
Ok(HttpResponse::Ok().json(user))
}