[rewrite] Initial project structure with dashboard frontend and api
This commit is contained in:
1 parent
c018d2fb52
commit
40aa0295b1
70 files changed
+19923
-214
No files matched your search
@@ -0,0 +1,63 @@
|
||||
from datetime import datetime
|
||||
|
||||
class Cart:
|
||||
"""
|
||||
Represents a cart in the system.
|
||||
|
||||
:param id: The unique identifier of the cart.
|
||||
:type id: int
|
||||
:param price_total: The total price of the cart.
|
||||
:type price_total: float
|
||||
:param item_count: The count of items in the cart.
|
||||
:type item_count: int
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
cart_id: int = None,
|
||||
price_total: float = 0.00,
|
||||
item_count: int = 0,
|
||||
):
|
||||
self.id = cart_id
|
||||
self.price_total = price_total
|
||||
self.item_count = item_count
|
||||
|
||||
def __repr__(self):
|
||||
return f"Cart(id={self.id}, price_total={self.price_total}, item_count={self.item_count})"
|
||||
|
||||
class CartItem:
|
||||
"""
|
||||
Represents a cart item in the system.
|
||||
|
||||
:param id: The unique identifier of the cart item.
|
||||
:type id: int
|
||||
:param cart_id: The identifier of the cart.
|
||||
:type cart_id: int
|
||||
:param product_id: The identifier of the product.
|
||||
:type product_id: int
|
||||
:param count: The count of the product in the cart.
|
||||
:type count: int
|
||||
:param price_subtotal: The subtotal price of the product in the cart.
|
||||
:type price_subtotal: float
|
||||
:param date_added: The date and time when the item was added to the cart.
|
||||
:type date_added: datetime
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
cart_item_id: int = None,
|
||||
cart_id: int = None,
|
||||
product_id: int = None,
|
||||
count: int = 0,
|
||||
price_subtotal: float = 0.00,
|
||||
date_added: datetime = None,
|
||||
):
|
||||
self.id = cart_item_id
|
||||
self.cart_id = cart_id
|
||||
self.product_id = product_id
|
||||
self.count = count
|
||||
self.price_subtotal = price_subtotal
|
||||
self.date_added = date_added or datetime.now()
|
||||
|
||||
def __repr__(self):
|
||||
return f"CartItem(id={self.id}, cart_id={self.cart_id}, product_id={self.product_id}, count={self.count}, price_subtotal={self.price_subtotal}, date_added={self.date_added})"
|
||||
@@ -0,0 +1,38 @@
|
||||
from datetime import datetime
|
||||
from decimal import Decimal
|
||||
|
||||
|
||||
class Product:
|
||||
"""
|
||||
Represents a product in the system.
|
||||
|
||||
:param id: The unique identifier of the product.
|
||||
:type id: int
|
||||
:param seller_id: The user ID of the seller.
|
||||
:type seller_id: int
|
||||
:param name: The name of the product.
|
||||
:type name: str
|
||||
:param price: The price of the product.
|
||||
:type price: Decimal
|
||||
:param creation_date: The date and time when the product was created.
|
||||
:type creation_date: datetime
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
product_id: int = None,
|
||||
seller_id: int = None,
|
||||
seller_name: str = None,
|
||||
name: str = None,
|
||||
price: Decimal = None,
|
||||
creation_date: datetime = None,
|
||||
):
|
||||
self.product_id = product_id
|
||||
self.seller_id = seller_id
|
||||
self.seller_name = seller_name
|
||||
self.name = name
|
||||
self.price = price
|
||||
self.creation_date = creation_date
|
||||
|
||||
def __repr__(self):
|
||||
return f"Product(product_id={self.product_id}, seller_id={self.seller_id}, seller_name={self.seller_name}, name='{self.name}', price={self.price}, creation_date={self.creation_date!r})"
|
||||
@@ -0,0 +1,44 @@
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class User:
|
||||
"""
|
||||
Represents a user in the system.
|
||||
|
||||
:param user_id: The unique identifier of the user.
|
||||
:type user_id: int
|
||||
:param username: The username of the user.
|
||||
:type username: str
|
||||
:param displayname: The display name of the user.
|
||||
:type displayname: str
|
||||
:param email: The email address of the user.
|
||||
:type email: str
|
||||
:param password: The hashed password of the user.
|
||||
:type password: str
|
||||
:param role_id: The role ID of the user. Defaults to 1.
|
||||
:type role_id: int
|
||||
:param creation_date: The date and time when the user was created.
|
||||
:type creation_date: datetime
|
||||
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
user_id: str = None,
|
||||
username: str = None,
|
||||
displayname: str = None,
|
||||
email: str = None,
|
||||
password: str = None,
|
||||
role_id: int = 1,
|
||||
creation_date: datetime = None,
|
||||
):
|
||||
self.user_id = user_id
|
||||
self.username = username
|
||||
self.displayname = displayname
|
||||
self.email = email
|
||||
self.password = password
|
||||
self.role_id = role_id
|
||||
self.creation_date = creation_date
|
||||
|
||||
def __repr__(self):
|
||||
return f"User(id={self.user_id}, username={self.username}, displayname={self.displayname}, email={self.email}, password={self.password}, role_id={self.role_id}, creation_date={self.creation_date})"
|
||||
Reference in new issue
Block a user