add: user achievements
This commit is contained in:
parent
e7c4cf14aa
commit
b860f74124
15 changed files with 318 additions and 11 deletions
|
@ -7,7 +7,7 @@ use axum::{
|
|||
use axum_extra::extract::CookieJar;
|
||||
use tetratto_core::model::{
|
||||
addr::RemoteAddr,
|
||||
auth::IpBlock,
|
||||
auth::{AchievementName, IpBlock},
|
||||
communities::{CommunityReadAccess, Question},
|
||||
oauth,
|
||||
permissions::FinePermission,
|
||||
|
@ -50,6 +50,16 @@ pub async fn create_request(
|
|||
return Json(Error::NotAllowed.into());
|
||||
}
|
||||
|
||||
// award achievement
|
||||
if let Some(ref user) = user {
|
||||
if let Err(e) = data
|
||||
.add_achievement(user, AchievementName::CreateQuestion.into())
|
||||
.await
|
||||
{
|
||||
return Json(e.into());
|
||||
}
|
||||
}
|
||||
|
||||
// ...
|
||||
let mut props = Question::new(
|
||||
if let Some(ref ua) = user { ua.id } else { 0 },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue