feat: restructure notification services

This commit is contained in:
fawney19
2026-05-22 01:45:46 +08:00
parent d5e64d6ad9
commit 504c1ccb37
28 changed files with 1941 additions and 460 deletions
@@ -7,7 +7,9 @@ use axum::{
use serde::Deserialize;
use serde_json::json;
use crate::handlers::shared::{deserialize_optional_json_patch, normalize_feature_settings};
use crate::handlers::shared::{
deserialize_optional_json_patch, normalize_user_self_feature_settings_update,
};
use super::{
auth_password_policy_level, build_auth_error_response, resolve_authenticated_local_user,
@@ -65,12 +67,24 @@ pub(super) async fn handle_users_me_detail_put(
let email = normalize_users_me_optional_non_empty_string(payload.email);
let username = normalize_users_me_optional_non_empty_string(payload.username);
let feature_settings = match payload.feature_settings {
Some(value) => match normalize_feature_settings(value) {
Ok(value) => Some(value),
Err(detail) => {
return build_auth_error_response(http::StatusCode::BAD_REQUEST, detail, false);
Some(value) => {
let current = match state.read_user_feature_settings(&auth.user.id).await {
Ok(value) => value,
Err(err) => {
return build_auth_error_response(
http::StatusCode::INTERNAL_SERVER_ERROR,
format!("user feature settings lookup failed: {err:?}"),
false,
)
}
};
match normalize_user_self_feature_settings_update(value, current) {
Ok(value) => Some(value),
Err(detail) => {
return build_auth_error_response(http::StatusCode::BAD_REQUEST, detail, false);
}
}
},
}
None => None,
};