pub struct RUser {
pub id: Uuid,
pub name: Option<String>,
pub gender: Option<Gender>,
pub birth_date: Option<NaiveDate>,
pub confession_id: Option<Uuid>,
pub email: Option<String>,
pub phone: Option<String>,
pub telegram_id: Option<i64>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
Core user entity for the Revelation ecosystem.
RUser represents a registered user with support for multiple
authentication methods and optional profile data.
§Fields
| Field | Type | Create | Update | Response |
|---|---|---|---|---|
id | Uuid | — | — | Yes |
name | Option<String> | — | Yes | Yes |
gender | Option<Gender> | — | Yes | Yes |
birth_date | Option<NaiveDate> | — | Yes | Yes |
confession_id | Option<Uuid> | — | Yes | Yes |
email | Option<String> | Yes | — | Yes |
phone | Option<String> | Yes | — | Yes |
telegram_id | Option<i64> | Yes | — | Yes |
created_at | DateTime<Utc> | — | — | Yes |
updated_at | DateTime<Utc> | — | — | Yes |
Fields§
§id: UuidUnique user identifier (UUIDv7).
name: Option<String>Display name (2-100 chars).
gender: Option<Gender>User’s gender.
birth_date: Option<NaiveDate>Date of birth.
confession_id: Option<Uuid>Reference to confession/denomination.
email: Option<String>Verified email address.
phone: Option<String>Phone number in E.164 format.
telegram_id: Option<i64>Telegram user ID.
created_at: DateTime<Utc>Creation timestamp.
updated_at: DateTime<Utc>Last update timestamp.
Implementations§
Source§impl RUser
impl RUser
Sourcepub fn from_telegram(telegram_id: i64) -> Self
pub fn from_telegram(telegram_id: i64) -> Self
Create user from Telegram authentication.
§Examples
use revelation_user::RUser;
let user = RUser::from_telegram(123456789);
assert_eq!(user.telegram_id, Some(123456789));Sourcepub fn from_email(email: impl Into<String>) -> Self
pub fn from_email(email: impl Into<String>) -> Self
Create user from email authentication.
§Examples
use revelation_user::RUser;
let user = RUser::from_email("user@example.com");
assert_eq!(user.email.as_deref(), Some("user@example.com"));Sourcepub fn from_phone(phone: impl Into<String>) -> Self
pub fn from_phone(phone: impl Into<String>) -> Self
Create user from phone authentication.
§Examples
use revelation_user::RUser;
let user = RUser::from_phone("+79991234567");
assert!(user.phone.is_some());Trait Implementations§
Source§impl<'de> Deserialize<'de> for RUser
impl<'de> Deserialize<'de> for RUser
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&RUser> for RUserPublic
impl From<&RUser> for RUserPublic
Source§fn from(user: &RUser) -> Self
fn from(user: &RUser) -> Self
Converts a reference to RUser into RUserPublic.
This allows creating a public projection without consuming the original user.
§Examples
use revelation_user::{RUser, RUserPublic};
let user = RUser::from_email("user@example.com");
let public: RUserPublic = (&user).into();
// user is still available
assert!(user.email.is_some());Source§impl From<&RUser> for RUserResponse
impl From<&RUser> for RUserResponse
Source§impl From<CreateRUserRequest> for RUser
impl From<CreateRUserRequest> for RUser
Source§fn from(dto: CreateRUserRequest) -> Self
fn from(dto: CreateRUserRequest) -> Self
Converts to this type from the input type.
Source§impl From<RUser> for RUserPublic
impl From<RUser> for RUserPublic
Source§impl From<RUser> for RUserResponse
impl From<RUser> for RUserResponse
Auto Trait Implementations§
impl Freeze for RUser
impl RefUnwindSafe for RUser
impl Send for RUser
impl Sync for RUser
impl Unpin for RUser
impl UnwindSafe for RUser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more