Fixing vendor dashboard area

This commit is contained in:
2025-11-21 23:15:25 +01:00
parent 5aff76a27e
commit 86f1e16ef2
38 changed files with 312 additions and 433 deletions

View File

@@ -9,7 +9,7 @@ from typing import Optional
from fastapi import APIRouter, Depends, Query
from sqlalchemy.orm import Session
from app.api.deps import get_current_user
from app.api.deps import get_current_vendor_api
from app.core.database import get_db
from middleware.vendor_context import require_vendor_context
from models.database.user import User
@@ -25,7 +25,7 @@ def get_notifications(
limit: int = Query(50, ge=1, le=100),
unread_only: Optional[bool] = Query(False),
vendor: Vendor = Depends(require_vendor_context()),
current_user: User = Depends(get_current_user),
current_user: User = Depends(get_current_vendor_api),
db: Session = Depends(get_db),
):
"""
@@ -48,7 +48,7 @@ def get_notifications(
@router.get("/unread-count")
def get_unread_count(
vendor: Vendor = Depends(require_vendor_context()),
current_user: User = Depends(get_current_user),
current_user: User = Depends(get_current_vendor_api),
db: Session = Depends(get_db),
):
"""
@@ -68,7 +68,7 @@ def get_unread_count(
def mark_as_read(
notification_id: int,
vendor: Vendor = Depends(require_vendor_context()),
current_user: User = Depends(get_current_user),
current_user: User = Depends(get_current_vendor_api),
db: Session = Depends(get_db),
):
"""
@@ -86,7 +86,7 @@ def mark_as_read(
@router.put("/mark-all-read")
def mark_all_as_read(
vendor: Vendor = Depends(require_vendor_context()),
current_user: User = Depends(get_current_user),
current_user: User = Depends(get_current_vendor_api),
db: Session = Depends(get_db),
):
"""
@@ -105,7 +105,7 @@ def mark_all_as_read(
def delete_notification(
notification_id: int,
vendor: Vendor = Depends(require_vendor_context()),
current_user: User = Depends(get_current_user),
current_user: User = Depends(get_current_vendor_api),
db: Session = Depends(get_db),
):
"""
@@ -123,7 +123,7 @@ def delete_notification(
@router.get("/settings")
def get_notification_settings(
vendor: Vendor = Depends(require_vendor_context()),
current_user: User = Depends(get_current_user),
current_user: User = Depends(get_current_vendor_api),
db: Session = Depends(get_db),
):
"""
@@ -146,7 +146,7 @@ def get_notification_settings(
def update_notification_settings(
settings: dict,
vendor: Vendor = Depends(require_vendor_context()),
current_user: User = Depends(get_current_user),
current_user: User = Depends(get_current_vendor_api),
db: Session = Depends(get_db),
):
"""
@@ -165,7 +165,7 @@ def update_notification_settings(
@router.get("/templates")
def get_notification_templates(
vendor: Vendor = Depends(require_vendor_context()),
current_user: User = Depends(get_current_user),
current_user: User = Depends(get_current_vendor_api),
db: Session = Depends(get_db),
):
"""
@@ -187,7 +187,7 @@ def update_notification_template(
template_id: int,
template_data: dict,
vendor: Vendor = Depends(require_vendor_context()),
current_user: User = Depends(get_current_user),
current_user: User = Depends(get_current_vendor_api),
db: Session = Depends(get_db),
):
"""
@@ -208,7 +208,7 @@ def update_notification_template(
def send_test_notification(
notification_data: dict,
vendor: Vendor = Depends(require_vendor_context()),
current_user: User = Depends(get_current_user),
current_user: User = Depends(get_current_vendor_api),
db: Session = Depends(get_db),
):
"""