Spaces:
Sleeping
Sleeping
feat: add simulated user purchase history function
Browse files- user_data.py +10 -0
user_data.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def get_user_history(user_id: int) -> dict:
|
| 2 |
+
"""
|
| 3 |
+
Retorna o histórico de compras do usuário.
|
| 4 |
+
"""
|
| 5 |
+
user_histories = {
|
| 6 |
+
1: {'fiction': 5, 'non_fiction': 2, 'science': 0},
|
| 7 |
+
2: {'fiction': 1, 'non_fiction': 4, 'science': 1},
|
| 8 |
+
3: {'fiction': 0, 'non_fiction': 1, 'science': 5},
|
| 9 |
+
}
|
| 10 |
+
return user_histories.get(user_id)
|