-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb.py
More file actions
53 lines (50 loc) · 1.53 KB
/
db.py
File metadata and controls
53 lines (50 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from typing import Dict, Optional
from dataclasses import dataclass
from datetime import datetime
@dataclass
class Order:
order_number: str
customer_name: str
items: list
total_amount: float
order_date: datetime
status: str
shipping_address: str
orders_db: Dict[str, Order] = {
"101": Order(
order_number="101",
customer_name="John Doe",
items=[
{"product": "Laptop", "quantity": 1, "price": 999.99},
{"product": "Mouse", "quantity": 1, "price": 29.99}
],
total_amount=1029.98,
order_date=datetime(2024, 3, 15, 14, 30),
status="Delivered",
shipping_address="123 Main St, New York, NY 10001"
),
"102": Order(
order_number="102",
customer_name="Jane Smith",
items=[
{"product": "Headphones", "quantity": 2, "price": 79.99},
{"product": "Phone Case", "quantity": 1, "price": 19.99}
],
total_amount=179.97,
order_date=datetime(2024, 3, 16, 9, 15),
status="Processing",
shipping_address="456 Oak Ave, Los Angeles, CA 90001"
),
"103": Order(
order_number="103",
customer_name="Bob Johnson",
items=[
{"product": "Smart Watch", "quantity": 1, "price": 299.99},
{"product": "Charger", "quantity": 1, "price": 24.99}
],
total_amount=324.98,
order_date=datetime(2024, 3, 17, 11, 45),
status="Shipped",
shipping_address="789 Pine Rd, Chicago, IL 60601"
)
}