fix: read real users from eventify-django SQLite via secondary database

The admin_api was querying eventify-backend's empty PostgreSQL. Real users
live in eventify-django's SQLite (db.sqlite3 on host). Fix:

- settings.py: auto-adds 'users_db' database config when users_db.sqlite3
  is mounted into the container (read-only volume in docker-compose)
- views.py: _user_db() helper selects the correct database alias;
  _user_qs() defers 'partner' field (absent from older SQLite schema)
- UserMetricsView, UserListView, UserDetailView, UserStatusView all use
  _user_qs() so they query the 25 real registered customers
This commit is contained in:
2026-03-25 11:38:03 +05:30
parent a3d1bbad30
commit 54aa7ce06e
2 changed files with 30 additions and 4 deletions

View File

@@ -176,3 +176,16 @@ SIMPLE_JWT = {
'USER_ID_FIELD': 'id',
'USER_ID_CLAIM': 'user_id',
}
# ---------------------------------------------------------------------------
# Secondary read-only database: real user data from eventify-django SQLite
# Activated automatically when users_db.sqlite3 is mounted into the container
# ---------------------------------------------------------------------------
import os as _os
_sqlite_users = BASE_DIR / 'users_db.sqlite3'
if _os.path.exists(_sqlite_users):
DATABASES['users_db'] = {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': _sqlite_users,
'OPTIONS': {'check_same_thread': False},
}