feat(front+back): pwa added, register parkour update with it, and jeux added in coming soon
Some checks failed
Deploy to Development / build-and-deploy (push) Failing after 20s
Some checks failed
Deploy to Development / build-and-deploy (push) Failing after 20s
This commit is contained in:
@@ -8,6 +8,7 @@ from config.database import get_db
|
||||
from config.settings import settings
|
||||
from models.vlog import Vlog, VlogLike, VlogComment, VlogView
|
||||
from models.user import User
|
||||
from models.notification import Notification, NotificationType
|
||||
from schemas.vlog import VlogCreate, VlogUpdate, VlogResponse, VlogCommentCreate
|
||||
from utils.security import get_current_active_user
|
||||
from utils.video_utils import generate_video_thumbnail, get_video_duration
|
||||
@@ -332,6 +333,22 @@ async def upload_vlog_video(
|
||||
db.commit()
|
||||
db.refresh(vlog)
|
||||
|
||||
# Create notifications for all active users (except the creator)
|
||||
users = db.query(User).filter(User.is_active == True).all()
|
||||
for user in users:
|
||||
if user.id != current_user.id:
|
||||
notification = Notification(
|
||||
user_id=user.id,
|
||||
type=NotificationType.NEW_VLOG,
|
||||
title="Nouveau vlog",
|
||||
message=f"{current_user.full_name} a publié un nouveau vlog : {vlog.title}",
|
||||
link=f"/vlogs/{vlog.id}",
|
||||
is_read=False
|
||||
)
|
||||
db.add(notification)
|
||||
|
||||
db.commit()
|
||||
|
||||
return format_vlog_response(vlog, db, current_user.id)
|
||||
|
||||
def format_vlog_response(vlog: Vlog, db: Session, current_user_id: int) -> dict:
|
||||
|
||||
Reference in New Issue
Block a user