Skip to content
Clone

refactor(auth): refresh register types and birthday handler for current schema

zhenyi committed
parent fc8cfc7 commit c9fb93e Browse files

2 files changed

+14 −8

File tree 2
Modified lib/auth/features/register/types.rs View lib/auth/features/register/types.rs
@@ -3,10 +3,10 @@
33use utoipa::ToSchema;
44use uuid::Uuid;
55
6use db::user::user_email_verification_codes::EmailVerificationPurpose;
76use crate::features::TempKey;
87use crate::pow::Challenge;
98use crate::pow::Solution;
9use db::user::user_email_verification_codes::EmailVerificationPurpose;
1010
1111#[derive(Debug, Clone, Serialize, ToSchema)]
1212pub struct PowProof {
@@ -28,8 +28,14 @@
2828 #[serde(deserialize_with = "deserialize_solution")]
2929 solution: Solution,
3030 }
31 let Repr { challenge, solution } = Repr::deserialize(deserializer)?;
32 Ok(Self { challenge, solution })
31 let Repr {
32 challenge,
33 solution,
34 } = Repr::deserialize(deserializer)?;
35 Ok(Self {
36 challenge,
37 solution,
38 })
3339 }
3440}
3541
@@ -65,7 +71,9 @@
6571 }
6672 match Repr::deserialize(deserializer)? {
6773 Repr::Object(solution) => Ok(solution),
68 Repr::String(raw) => parse_payload_field::<Solution>(&raw, "solution").map_err(DeError::custom),
74 Repr::String(raw) => {
75 parse_payload_field::<Solution>(&raw, "solution").map_err(DeError::custom)
76 }
6977 }
7078}
7179
Modified lib/auth/handler/birthday.rs View lib/auth/handler/birthday.rs
@@ -4,15 +4,13 @@
44use utoipa::ToSchema;
55
66use db::conn::sea_orm::{ActiveModelTrait, EntityTrait};
7use db::user::user_profiles::{
8 ActiveModel as ProfileActiveModel, Entity as ProfileEntity,
9};
7use db::user::user_profiles::{ActiveModel as ProfileActiveModel, Entity as ProfileEntity};
108use jwt::extractor::AuthUser;
119
1210use crate::error::AuthError;
11use crate::features::AuthService;
1312use crate::features::age;
1413use crate::features::register::types::PowProof;
15use crate::features::AuthService;
1614use export::data::{AppRequest, AppResponseData};
1715
1816#[derive(Debug, Clone, Deserialize, ToSchema)]