fix: seed FK flush order, DPS path resolution, admin_uploads Docker mount, docker-compose env additions
This commit is contained in:
@@ -72,6 +72,9 @@ def seed_local_database():
|
|||||||
)
|
)
|
||||||
session.add(student_user)
|
session.add(student_user)
|
||||||
|
|
||||||
|
# Flush users first so FK constraints for subscription/transaction are satisfied
|
||||||
|
session.flush()
|
||||||
|
|
||||||
# Seed Demo Student Subscription record
|
# Seed Demo Student Subscription record
|
||||||
demo_subscription = models.Subscription(
|
demo_subscription = models.Subscription(
|
||||||
id=uuid4(),
|
id=uuid4(),
|
||||||
@@ -98,8 +101,8 @@ def seed_local_database():
|
|||||||
)
|
)
|
||||||
session.add(demo_txn)
|
session.add(demo_txn)
|
||||||
|
|
||||||
admin_id = uuid4()
|
|
||||||
|
|
||||||
|
# admin_id is already defined above as the fixed UUID for the admin user
|
||||||
jee_test_id = UUID("b6faa295-3bf5-4de2-a587-d72b889629c4")
|
jee_test_id = UUID("b6faa295-3bf5-4de2-a587-d72b889629c4")
|
||||||
neet_test_id = UUID("e7c80521-825b-4c07-889a-ee646c05d762")
|
neet_test_id = UUID("e7c80521-825b-4c07-889a-ee646c05d762")
|
||||||
|
|
||||||
@@ -370,7 +373,12 @@ def seed_local_database():
|
|||||||
|
|
||||||
# --- DPS (Daily Practice Sheets) from admin_uploads JSON files ---
|
# --- DPS (Daily Practice Sheets) from admin_uploads JSON files ---
|
||||||
print("Seeding DPS tests from admin_uploads...")
|
print("Seeding DPS tests from admin_uploads...")
|
||||||
dps_json_dir = os.path.join(os.path.dirname(os.path.dirname(__file__)), "admin_uploads")
|
# Resolve path: works inside Docker (/app/admin_uploads) and locally (../../admin_uploads)
|
||||||
|
_script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
_docker_path = os.path.join(_script_dir, "admin_uploads")
|
||||||
|
_local_path = os.path.join(_script_dir, "..", "admin_uploads")
|
||||||
|
dps_json_dir = _docker_path if os.path.isdir(_docker_path) else _local_path
|
||||||
|
|
||||||
dps_json_files = sorted(glob.glob(os.path.join(dps_json_dir, "dps_*.json")))
|
dps_json_files = sorted(glob.glob(os.path.join(dps_json_dir, "dps_*.json")))
|
||||||
|
|
||||||
with Session(engine) as dps_session:
|
with Session(engine) as dps_session:
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ services:
|
|||||||
container_name: pragativeer_backend
|
container_name: pragativeer_backend
|
||||||
volumes:
|
volumes:
|
||||||
- ./backend:/app
|
- ./backend:/app
|
||||||
|
- ./admin_uploads:/app/admin_uploads:ro
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
environment:
|
environment:
|
||||||
@@ -121,6 +122,7 @@ services:
|
|||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
environment:
|
environment:
|
||||||
- NEXT_PUBLIC_API_URL=http://localhost:8000
|
- NEXT_PUBLIC_API_URL=http://localhost:8000
|
||||||
|
- NEXT_PUBLIC_PAYMENT_GATEWAY=razorpay
|
||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
Reference in New Issue
Block a user