rairo commited on
Commit
9253f3c
·
verified ·
1 Parent(s): 9b7a78d

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +41 -0
main.py CHANGED
@@ -28,6 +28,47 @@ bucket = storage.bucket()
28
  api_key = os.environ['Gemini']
29
  FIREBASE_API_KEY = os.environ.get('FIREBASE_API_KEY')
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  # Helper functions
32
  def configure_gemini():
33
  genai.configure(api_key=api_key)
 
28
  api_key = os.environ['Gemini']
29
  FIREBASE_API_KEY = os.environ.get('FIREBASE_API_KEY')
30
 
31
+ def create_test_accounts():
32
+ try:
33
+ # Create/admin2@test.com (Admin)
34
+ try:
35
+ admin_user = auth.create_user(
36
+ email='carol@probottlers.co.zw',
37
+ password='carol.zw25!'
38
+ )
39
+ except auth.EmailAlreadyExistsError:
40
+ admin_user = auth.get_user_by_email('carol@probottlers.co.zw')
41
+
42
+ db.reference(f'users/{admin_user.uid}').set({
43
+ 'daily_cash': 0,
44
+ 'remaining_cash': 0,
45
+ 'last_reset': '2025-01-01T00:00:00+00:00',
46
+ 'is_admin': True
47
+ })
48
+
49
+ # Create user1@test.com (Regular user)
50
+ try:
51
+ admin_user1 = auth.create_user(
52
+ email='dean@probottlers.co.zw',
53
+ password='dean@zw25!'
54
+ )
55
+ except auth.EmailAlreadyExistsError:
56
+ admin_user1 = auth.get_user_by_email('dean@probottlers.co.zw')
57
+
58
+ db.reference(f'users/{admin_user1.uid}').set({
59
+ 'daily_cash': 0,
60
+ 'remaining_cash': 0,
61
+ 'last_reset': '2025-01-01T00:00:00+00:00',
62
+ 'is_admin': True
63
+ })
64
+
65
+ print("Test accounts created/updated successfully")
66
+ except Exception as e:
67
+ print(f"Error creating test accounts: {str(e)}")
68
+
69
+ # Create test accounts when server starts
70
+ create_test_accounts()
71
+
72
  # Helper functions
73
  def configure_gemini():
74
  genai.configure(api_key=api_key)