feat(backend): migrate auth and notifications off email
This commit is contained in:
@@ -5,6 +5,7 @@ from apps.certificates.api.views import certificates_router
|
||||
from apps.communications.api.views import communications_router
|
||||
from apps.events.api.views import events_router
|
||||
from apps.gallery.api.views import gallery_router
|
||||
from apps.notifications.api.views import notifications_router
|
||||
from apps.payments.api.views import payments_router
|
||||
from apps.users.api.meta import meta_router
|
||||
from apps.users.api.views import auth_router
|
||||
@@ -15,9 +16,9 @@ router.add_router("auth/", auth_router, tags=["Authentication"])
|
||||
router.add_router("blog/", blog_router, tags=["Blog"])
|
||||
router.add_router("gallery/", gallery_router, tags=["Gallery"])
|
||||
router.add_router("events/", events_router, tags=["Events"])
|
||||
router.add_router("notifications/", notifications_router, tags=["Notifications"])
|
||||
router.add_router("communications/", communications_router, tags=["Communications"])
|
||||
router.add_router("payments/", payments_router, tags=["Payments"])
|
||||
router.add_router("certificates/", certificates_router, tags=["Certificates"])
|
||||
router.add_router("meta/", meta_router, tags=["Meta"])
|
||||
router.add_router("", health_router, tags=["Health"])
|
||||
|
||||
|
||||
@@ -33,15 +33,10 @@ app.conf.beat_schedule = {
|
||||
'schedule': crontab(minute=0, hour='*/1'),
|
||||
'description': 'Runs hourly to notify about upcoming events.',
|
||||
},
|
||||
'send-weekly-newsletter': {
|
||||
'task': 'apps.communications.tasks.send_weekly_newsletter',
|
||||
'schedule': crontab(hour=9, minute=0, day_of_week=1),
|
||||
'description': 'Runs every Monday at 09:00 UTC.',
|
||||
},
|
||||
'cleanup-expired-tokens': {
|
||||
'task': 'apps.communications.tasks.cleanup_expired_tokens',
|
||||
'cleanup-notification-retention': {
|
||||
'task': 'apps.notifications.tasks.cleanup_notification_retention',
|
||||
'schedule': crontab(hour=2, minute=0),
|
||||
'description': 'Runs daily at 02:00 UTC.',
|
||||
'description': 'Runs daily at 02:00 UTC to cleanup notification retention.',
|
||||
},
|
||||
'process-scheduled-announcements': {
|
||||
'task': 'apps.communications.tasks.process_scheduled_announcements',
|
||||
|
||||
@@ -36,6 +36,7 @@ THIRD_PARTY_APPS = [
|
||||
LOCAL_APPS = [
|
||||
"core",
|
||||
"apps.users",
|
||||
"apps.notifications",
|
||||
"apps.blog",
|
||||
"apps.gallery",
|
||||
"apps.events",
|
||||
@@ -151,11 +152,18 @@ SESSION_COOKIE_SECURE = config('SESSION_COOKIE_SECURE', default=True, cast=bool)
|
||||
EMAIL_BACKEND = config('EMAIL_BACKEND', default='django.core.mail.backends.console.EmailBackend')
|
||||
EMAIL_HOST = config('EMAIL_HOST', default='')
|
||||
EMAIL_PORT = config('EMAIL_PORT', default=587, cast=int)
|
||||
EMAIL_USE_SSL = config('EMAIL_USE_SSL', default=False, cast=bool)
|
||||
EMAIL_USE_TLS = config('EMAIL_USE_TLS', default=True, cast=bool)
|
||||
EMAIL_HOST_USER = config('EMAIL_HOST_USER', default='')
|
||||
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD', default='')
|
||||
DEFAULT_FROM_EMAIL = config('DEFAULT_FROM_EMAIL', default='webmaster@localhost')
|
||||
|
||||
SMS_APIKEY = config('SMS_APIKEY', default='')
|
||||
SMS_AUTH_OTP_TEMPLATE_ID = config('SMS_AUTH_OTP_TEMPLATE_ID', default='')
|
||||
SMS_EVENT_CANCELLATION_TEMPLATE_ID = config('SMS_EVENT_CANCELLATION_TEMPLATE_ID', default='')
|
||||
SMS_EVENT_RESCHEDULE_TEMPLATE_ID = config('SMS_EVENT_RESCHEDULE_TEMPLATE_ID', default='')
|
||||
SMS_PAYMENT_STATUS_TEMPLATE_ID = config('SMS_PAYMENT_STATUS_TEMPLATE_ID', default='')
|
||||
|
||||
# JWT Configuration
|
||||
JWT_SECRET_KEY = config('JWT_SECRET_KEY', default=SECRET_KEY)
|
||||
JWT_ALGORITHM = config('JWT_ALGORITHM', default='HS256')
|
||||
@@ -174,8 +182,8 @@ CACHES = {
|
||||
}
|
||||
|
||||
# Celery Configuration
|
||||
CELERY_BROKER_URL = REDIS_URL
|
||||
CELERY_RESULT_BACKEND = REDIS_URL
|
||||
CELERY_BROKER_URL = config('CELERY_BROKER_URL', default=REDIS_URL)
|
||||
CELERY_RESULT_BACKEND = config('CELERY_RESULT_BACKEND', default=REDIS_URL)
|
||||
|
||||
|
||||
# Logging Configuration
|
||||
@@ -230,6 +238,18 @@ BACKEND_ROOT = config('DJANGO_HOST', default='http://localhost:8000/')
|
||||
FRONTEND_ROOT = config('FRONTEND_ROOT', default='http://localhost:3000/')
|
||||
FRONTEND_PASSWORD_RESET_PAGE = config('FRONTEND_PASSWORD_RESET_PAGE', default='http://localhost:3000/api/auth/reset-password-confirm/')
|
||||
FRONTEND_CALLBACK_URL = config('FRONTEND_CALLBACK_URL', default='http://localhost:3000/payments/result')
|
||||
GOOGLE_OAUTH_CLIENT_ID = config('GOOGLE_OAUTH_CLIENT_ID', default='')
|
||||
GOOGLE_OAUTH_CLIENT_SECRET = config('GOOGLE_OAUTH_CLIENT_SECRET', default='')
|
||||
GOOGLE_OAUTH_REDIRECT_URI = config('GOOGLE_OAUTH_REDIRECT_URI', default='')
|
||||
GOOGLE_OAUTH_FRONTEND_CALLBACK_URL = config('GOOGLE_OAUTH_FRONTEND_CALLBACK_URL', default='http://localhost:8080/auth/google/callback')
|
||||
NOTIFICATIONS_ENABLED = config('NOTIFICATIONS_ENABLED', default=True, cast=bool)
|
||||
NOTIFICATION_STREAM_TOKEN_LIFETIME_SECONDS = config('NOTIFICATION_STREAM_TOKEN_LIFETIME_SECONDS', default=300, cast=int)
|
||||
NOTIFICATION_SSE_HEARTBEAT_SECONDS = config('NOTIFICATION_SSE_HEARTBEAT_SECONDS', default=20, cast=int)
|
||||
NOTIFICATION_SSE_RETRY_MS = config('NOTIFICATION_SSE_RETRY_MS', default=3000, cast=int)
|
||||
NOTIFICATION_REDIS_CHANNEL_PREFIX = config('NOTIFICATION_REDIS_CHANNEL_PREFIX', default='notif')
|
||||
NOTIFICATION_RETENTION_DAYS = config('NOTIFICATION_RETENTION_DAYS', default=30, cast=int)
|
||||
NOTIFICATION_DEFAULT_PAGE_SIZE = config('NOTIFICATION_DEFAULT_PAGE_SIZE', default=20, cast=int)
|
||||
NOTIFICATION_MAX_PAGE_SIZE = config('NOTIFICATION_MAX_PAGE_SIZE', default=100, cast=int)
|
||||
|
||||
if DATABASES["default"]["ENGINE"] == "django.db.backends.postgresql":
|
||||
DATABASES["default"]["ENGINE"] = "django_prometheus.db.backends.postgresql"
|
||||
|
||||
@@ -3,6 +3,7 @@ from django.urls import path, include
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
from ninja import NinjaAPI
|
||||
from apps.notifications.api.views import NotificationStreamView
|
||||
from config.api import router as api_router
|
||||
|
||||
api = NinjaAPI(
|
||||
@@ -16,6 +17,7 @@ api.add_router("", api_router)
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('api/', api.urls),
|
||||
path("api/notifications/stream/", NotificationStreamView.as_view()),
|
||||
path("", include("django_prometheus.urls")),
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user