RUser

Struct RUser 

Source
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

FieldTypeCreateUpdateResponse
idUuidYes
nameOption<String>YesYes
genderOption<Gender>YesYes
birth_dateOption<NaiveDate>YesYes
confession_idOption<Uuid>YesYes
emailOption<String>YesYes
phoneOption<String>YesYes
telegram_idOption<i64>YesYes
created_atDateTime<Utc>Yes
updated_atDateTime<Utc>Yes

Fields§

§id: Uuid

Unique 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

Source

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));
Source

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"));
Source

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());
Source

pub fn empty() -> Self

Create empty user with only ID.

§Examples
use revelation_user::RUser;

let user = RUser::empty();
assert!(user.email.is_none());
Source

pub fn with_id(id: Uuid) -> Self

Create user with a specific ID.

§Examples
use revelation_user::RUser;
use uuid::Uuid;

let id = Uuid::now_v7();
let user = RUser::with_id(id);
assert_eq!(user.id, id);

Trait Implementations§

Source§

impl Clone for RUser

Source§

fn clone(&self) -> RUser

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RUser

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RUser

Source§

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

Source§

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

Source§

fn from(entity: &RUser) -> Self

Converts to this type from the input type.
Source§

impl From<CreateRUserRequest> for RUser

Source§

fn from(dto: CreateRUserRequest) -> Self

Converts to this type from the input type.
Source§

impl From<RUser> for RUserPublic

Source§

fn from(user: RUser) -> Self

Converts an owned RUser into RUserPublic.

§Examples
use revelation_user::{RUser, RUserPublic};

let user = RUser::from_telegram(123456);
let public: RUserPublic = user.into();
Source§

impl From<RUser> for RUserResponse

Source§

fn from(entity: RUser) -> Self

Converts to this type from the input type.
Source§

impl Serialize for RUser

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,