remove: marketplace
This commit is contained in:
parent
2407e6b213
commit
b5f841a990
27 changed files with 22 additions and 1067 deletions
|
@ -79,9 +79,6 @@ pub struct User {
|
|||
/// view pages which require authentication (all `$` routes).
|
||||
#[serde(default)]
|
||||
pub browser_session: String,
|
||||
/// Stripe connected account information (for Tetratto marketplace).
|
||||
#[serde(default)]
|
||||
pub seller_data: StripeSellerData,
|
||||
/// The reason the user was banned.
|
||||
#[serde(default)]
|
||||
pub ban_reason: String,
|
||||
|
@ -355,14 +352,6 @@ pub struct UserSettings {
|
|||
pub forum_signature: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, Default)]
|
||||
pub struct StripeSellerData {
|
||||
#[serde(default)]
|
||||
pub account_id: Option<String>,
|
||||
#[serde(default)]
|
||||
pub completed_onboarding: bool,
|
||||
}
|
||||
|
||||
fn mime_avif() -> String {
|
||||
"image/avif".to_string()
|
||||
}
|
||||
|
@ -407,7 +396,6 @@ impl User {
|
|||
awaiting_purchase: false,
|
||||
was_purchased: false,
|
||||
browser_session: String::new(),
|
||||
seller_data: StripeSellerData::default(),
|
||||
ban_reason: String::new(),
|
||||
channel_mutes: Vec::new(),
|
||||
is_deactivated: false,
|
||||
|
|
|
@ -11,7 +11,6 @@ pub mod mail;
|
|||
pub mod moderation;
|
||||
pub mod oauth;
|
||||
pub mod permissions;
|
||||
pub mod products;
|
||||
pub mod reactions;
|
||||
pub mod requests;
|
||||
pub mod socket;
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
use std::fmt::Display;
|
||||
|
||||
use serde::{Serialize, Deserialize};
|
||||
use tetratto_shared::{snow::Snowflake, unix_epoch_timestamp};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Product {
|
||||
pub id: usize,
|
||||
pub created: usize,
|
||||
pub owner: usize,
|
||||
pub name: String,
|
||||
pub description: String,
|
||||
pub likes: isize,
|
||||
pub dislikes: isize,
|
||||
pub product_type: ProductType,
|
||||
pub price: ProductPrice,
|
||||
/// Optional uploads to accompany the product title and description. Maximum of 4.
|
||||
pub uploads: Vec<usize>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum ProductType {
|
||||
/// Text + images.
|
||||
Data,
|
||||
/// When a commission product is purchased, the creator will receive a request
|
||||
/// prompting them to respond with text + images.
|
||||
///
|
||||
/// This is the only product type which does not immediately return data to the
|
||||
/// customer, as seller input is required.
|
||||
///
|
||||
/// If the request is deleted, the purchase should be immediately refunded.
|
||||
///
|
||||
/// Commissions are paid beforehand to prevent theft. This means it is vital
|
||||
/// that refunds are enforced.
|
||||
Commission,
|
||||
}
|
||||
|
||||
/// A currency.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum Currency {
|
||||
USD,
|
||||
EUR,
|
||||
GBP,
|
||||
}
|
||||
|
||||
impl Display for Currency {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(match self {
|
||||
Currency::USD => "$",
|
||||
Currency::EUR => "€",
|
||||
Currency::GBP => "£",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// Price in USD. `(dollars, cents)`.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct ProductPrice(u64, u64, Currency);
|
||||
|
||||
impl Display for ProductPrice {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_str(&format!("{}{}.{}", self.2, self.0, self.1))
|
||||
}
|
||||
}
|
||||
|
||||
impl Product {
|
||||
/// Create a new [`Product`].
|
||||
pub fn new(
|
||||
owner: usize,
|
||||
name: String,
|
||||
description: String,
|
||||
price: ProductPrice,
|
||||
r#type: ProductType,
|
||||
) -> Self {
|
||||
Self {
|
||||
id: Snowflake::new().to_string().parse::<usize>().unwrap(),
|
||||
created: unix_epoch_timestamp(),
|
||||
owner,
|
||||
name,
|
||||
description,
|
||||
likes: 0,
|
||||
dislikes: 0,
|
||||
product_type: r#type,
|
||||
price,
|
||||
uploads: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue