pub struct Creator { /* private fields */ }Expand description
Domain Entity: Creator
Represents a content creator in the paywall system. Creators sign up, configure their paywall settings, and receive payments.
Domain Rules:
- Creator must have a valid email
- Creator must have a valid wallet address for receiving payments
- Only active creators can receive payments
- Creator tier determines platform fee
- API key must be kept secure
Implementations§
Source§impl Creator
impl Creator
Sourcepub fn new(
tenant_id: TenantId,
email: String,
wallet_address: WalletAddress,
blog_url: Option<String>,
) -> Result<Self>
pub fn new( tenant_id: TenantId, email: String, wallet_address: WalletAddress, blog_url: Option<String>, ) -> Result<Self>
Create a new creator with validation
Sourcepub fn reconstruct(
id: CreatorId,
tenant_id: TenantId,
email: String,
name: Option<String>,
wallet_address: WalletAddress,
blog_url: Option<String>,
status: CreatorStatus,
tier: CreatorTier,
settings: CreatorSettings,
api_key_hash: Option<String>,
email_verified: bool,
total_revenue_cents: u64,
total_articles: u32,
created_at: DateTime<Utc>,
updated_at: DateTime<Utc>,
metadata: Value,
) -> Self
pub fn reconstruct( id: CreatorId, tenant_id: TenantId, email: String, name: Option<String>, wallet_address: WalletAddress, blog_url: Option<String>, status: CreatorStatus, tier: CreatorTier, settings: CreatorSettings, api_key_hash: Option<String>, email_verified: bool, total_revenue_cents: u64, total_articles: u32, created_at: DateTime<Utc>, updated_at: DateTime<Utc>, metadata: Value, ) -> Self
Reconstruct creator from storage (bypasses validation)
pub fn id(&self) -> &CreatorId
pub fn tenant_id(&self) -> &TenantId
pub fn email(&self) -> &str
pub fn name(&self) -> Option<&str>
pub fn wallet_address(&self) -> &WalletAddress
pub fn blog_url(&self) -> Option<&str>
pub fn status(&self) -> CreatorStatus
pub fn tier(&self) -> CreatorTier
pub fn settings(&self) -> &CreatorSettings
pub fn api_key_hash(&self) -> Option<&str>
pub fn is_email_verified(&self) -> bool
pub fn total_revenue_cents(&self) -> u64
pub fn total_articles(&self) -> u32
pub fn created_at(&self) -> DateTime<Utc>
pub fn updated_at(&self) -> DateTime<Utc>
pub fn metadata(&self) -> &Value
Sourcepub fn can_receive_payments(&self) -> Result<()>
pub fn can_receive_payments(&self) -> Result<()>
Check if creator can receive payments
Sourcepub fn fee_percentage(&self) -> u64
pub fn fee_percentage(&self) -> u64
Get the platform fee percentage for this creator
Sourcepub fn verify_email(&mut self)
pub fn verify_email(&mut self)
Verify the email address
Sourcepub fn update_name(&mut self, name: Option<String>)
pub fn update_name(&mut self, name: Option<String>)
Update the name
Sourcepub fn update_wallet_address(&mut self, wallet_address: WalletAddress)
pub fn update_wallet_address(&mut self, wallet_address: WalletAddress)
Update the wallet address
Sourcepub fn update_settings(&mut self, settings: CreatorSettings)
pub fn update_settings(&mut self, settings: CreatorSettings)
Update settings
Sourcepub fn set_api_key_hash(&mut self, hash: String)
pub fn set_api_key_hash(&mut self, hash: String)
Set the API key hash
Sourcepub fn upgrade_tier(&mut self, tier: CreatorTier)
pub fn upgrade_tier(&mut self, tier: CreatorTier)
Upgrade tier
Sourcepub fn reactivate(&mut self) -> Result<()>
pub fn reactivate(&mut self) -> Result<()>
Reactivate a suspended creator
Sourcepub fn deactivate(&mut self)
pub fn deactivate(&mut self)
Permanently deactivate the creator
Sourcepub fn record_revenue(&mut self, amount_cents: u64)
pub fn record_revenue(&mut self, amount_cents: u64)
Record revenue from a transaction
Sourcepub fn increment_articles(&mut self)
pub fn increment_articles(&mut self)
Increment article count
Sourcepub fn decrement_articles(&mut self)
pub fn decrement_articles(&mut self)
Decrement article count
Sourcepub fn update_metadata(&mut self, metadata: Value)
pub fn update_metadata(&mut self, metadata: Value)
Update metadata
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Creator
impl<'de> Deserialize<'de> for Creator
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<&Creator> for CreatorDto
impl From<&Creator> for CreatorDto
Source§impl From<Creator> for CreatorDto
impl From<Creator> for CreatorDto
Auto Trait Implementations§
impl Freeze for Creator
impl RefUnwindSafe for Creator
impl Send for Creator
impl Sync for Creator
impl Unpin for Creator
impl UnsafeUnpin for Creator
impl UnwindSafe for Creator
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