2021-07-05 08:54:41 +00:00
|
|
|
use crate::domain::{User, UserCheck, UserEmail, UserName};
|
|
|
|
use flowy_sys::prelude::*;
|
2021-06-29 15:21:25 +00:00
|
|
|
use std::convert::TryInto;
|
|
|
|
|
2021-06-30 07:33:49 +00:00
|
|
|
// tracing instrument 👉🏻 https://docs.rs/tracing/0.1.26/tracing/attr.instrument.html
|
|
|
|
#[tracing::instrument(
|
|
|
|
name = "User check",
|
|
|
|
skip(data),
|
|
|
|
fields(
|
|
|
|
email = %data.email,
|
|
|
|
name = %data.name
|
|
|
|
)
|
|
|
|
)]
|
2021-07-05 08:54:41 +00:00
|
|
|
pub async fn user_check(data: Data<UserCheck>) -> ResponseResult<User, String> {
|
|
|
|
let user: User = data.into_inner().try_into().unwrap();
|
2021-06-29 15:21:25 +00:00
|
|
|
|
2021-07-05 08:54:41 +00:00
|
|
|
response_ok(user)
|
2021-06-29 15:21:25 +00:00
|
|
|
}
|