add: product types

This commit is contained in:
trisua 2025-07-13 00:50:16 -04:00
parent 2705608903
commit ea13526515
9 changed files with 163 additions and 8 deletions

View file

@ -176,6 +176,7 @@ bitflags! {
const ADMINISTRATOR = 1 << 1;
const MANAGE_DOMAINS = 1 << 2;
const MANAGE_SERVICES = 1 << 3;
const MANAGE_PRODUCTS = 1 << 4;
const _ = !0;
}

View file

@ -6,11 +6,11 @@ pub struct Product {
pub id: usize,
pub created: usize,
pub owner: usize,
pub title: String,
pub name: String,
pub description: String,
pub likes: usize,
pub dislikes: usize,
pub r#type: ProductType,
pub likes: isize,
pub dislikes: isize,
pub product_type: ProductType,
pub stripe_id: String,
pub price: ProductPrice,
}
@ -37,7 +37,7 @@ impl Product {
/// Create a new [`Product`].
pub fn new(
owner: usize,
title: String,
name: String,
description: String,
price: ProductPrice,
r#type: ProductType,
@ -46,11 +46,11 @@ impl Product {
id: Snowflake::new().to_string().parse::<usize>().unwrap(),
created: unix_epoch_timestamp(),
owner,
title,
name,
description,
likes: 0,
dislikes: 0,
r#type,
product_type: r#type,
stripe_id: String::new(),
price,
}