This commit introduces a system to revoke tokens by storing their `jti` in a new `RevokedToken` model. It includes APIs for logging out (revoking a current token) and logging out from all devices (revoking all tokens). Additionally, token validation now checks revocation status during the decode process.
44 lines
1.5 KiB
Python
44 lines
1.5 KiB
Python
"""
|
|
Models package initialization.
|
|
Imports all models to ensure they're registered with SQLAlchemy.
|
|
"""
|
|
# First import Base to avoid circular imports
|
|
from app.core.database import Base
|
|
from .base import TimestampMixin, UUIDMixin
|
|
|
|
# Import user model
|
|
from .user import User
|
|
|
|
# Import event-related models
|
|
from .event import Event
|
|
from .event_manager import EventManager, EventManagerRole, init_event_owner
|
|
from .event_theme import EventTheme
|
|
from .event_media import EventMedia, MediaType, MediaPurpose
|
|
|
|
# Import guest and RSVP models
|
|
from .guest import Guest, GuestStatus, guest_gifts
|
|
from .rsvp import RSVP, RSVPStatus
|
|
|
|
# Import gift-related models
|
|
from .gift import (
|
|
GiftItem, GiftStatus, GiftPriority, GiftCategory,
|
|
GiftPurchase
|
|
)
|
|
|
|
# Import new models
|
|
from .email_template import EmailTemplate, TemplateType
|
|
from .notification_log import NotificationLog, NotificationType, NotificationStatus
|
|
from .activity_log import ActivityLog, ActivityType
|
|
from .token import RevokedToken
|
|
# Make sure all models are imported above this line
|
|
__all__ = [
|
|
'Base', 'TimestampMixin', 'UUIDMixin',
|
|
'User',
|
|
'Event', 'EventManager', 'EventManagerRole', 'EventTheme', 'EventMedia','MediaType', 'MediaPurpose',
|
|
'Guest', 'GuestStatus', 'RSVP', 'RSVPStatus',
|
|
'GiftItem', 'GiftStatus', 'GiftPriority', 'GiftCategory', 'GiftPurchase',
|
|
'EmailTemplate', 'TemplateType',
|
|
'NotificationLog', 'NotificationType', 'NotificationStatus',
|
|
'ActivityLog', 'ActivityType',
|
|
'RevokedToken',
|
|
] |