fix(notification+vlog upload)
This commit is contained in:
@@ -9,6 +9,7 @@ from models.notification import Notification, NotificationType
|
||||
from schemas.event import EventCreate, EventUpdate, EventResponse, ParticipationUpdate
|
||||
from utils.security import get_current_active_user
|
||||
from utils.email import send_event_notification
|
||||
from utils.push_service import send_push_to_user
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -48,15 +49,22 @@ async def create_event(
|
||||
|
||||
# Create notification
|
||||
if user.id != current_user.id:
|
||||
notif_title = f"Invitation à un événement privé: {event.title}"
|
||||
notif_message = f"{current_user.full_name} vous a invité à un événement privé"
|
||||
notif_link = f"/events/{event.id}"
|
||||
|
||||
notification = Notification(
|
||||
user_id=user.id,
|
||||
type=NotificationType.EVENT_INVITATION,
|
||||
title=f"Invitation à un événement privé: {event.title}",
|
||||
message=f"{current_user.full_name} vous a invité à un événement privé",
|
||||
link=f"/events/{event.id}"
|
||||
title=notif_title,
|
||||
message=notif_message,
|
||||
link=notif_link
|
||||
)
|
||||
db.add(notification)
|
||||
|
||||
# Send push notification
|
||||
send_push_to_user(db, user.id, notif_title, notif_message, notif_link)
|
||||
|
||||
# Send email notification
|
||||
try:
|
||||
send_event_notification(user.email, event)
|
||||
@@ -75,15 +83,22 @@ async def create_event(
|
||||
|
||||
# Create notification
|
||||
if user.id != current_user.id:
|
||||
notif_title = f"Nouvel événement: {event.title}"
|
||||
notif_message = f"{current_user.full_name} a créé un nouvel événement"
|
||||
notif_link = f"/events/{event.id}"
|
||||
|
||||
notification = Notification(
|
||||
user_id=user.id,
|
||||
type=NotificationType.EVENT_INVITATION,
|
||||
title=f"Nouvel événement: {event.title}",
|
||||
message=f"{current_user.full_name} a créé un nouvel événement",
|
||||
link=f"/events/{event.id}"
|
||||
title=notif_title,
|
||||
message=notif_message,
|
||||
link=notif_link
|
||||
)
|
||||
db.add(notification)
|
||||
|
||||
# Send push notification
|
||||
send_push_to_user(db, user.id, notif_title, notif_message, notif_link)
|
||||
|
||||
# Send email notification
|
||||
try:
|
||||
send_event_notification(user.email, event)
|
||||
@@ -309,15 +324,22 @@ async def invite_users_to_event(
|
||||
db.add(participation)
|
||||
|
||||
# Créer une notification
|
||||
notif_title = f"Invitation à un événement privé: {event.title}"
|
||||
notif_message = f"{current_user.full_name} vous a invité à un événement privé"
|
||||
notif_link = f"/events/{event.id}"
|
||||
|
||||
notification = Notification(
|
||||
user_id=user.id,
|
||||
type=NotificationType.EVENT_INVITATION,
|
||||
title=f"Invitation à un événement privé: {event.title}",
|
||||
message=f"{current_user.full_name} vous a invité à un événement privé",
|
||||
link=f"/events/{event.id}"
|
||||
title=notif_title,
|
||||
message=notif_message,
|
||||
link=notif_link
|
||||
)
|
||||
db.add(notification)
|
||||
|
||||
# Send push notification
|
||||
send_push_to_user(db, user.id, notif_title, notif_message, notif_link)
|
||||
|
||||
# Envoyer un email
|
||||
try:
|
||||
send_event_notification(user.email, event)
|
||||
|
||||
Reference in New Issue
Block a user