Spaces:
Running
Running
Download app/projects/models/notifications.py from basyx/MediaRouter: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/spaces/basyx/MediaRouter/resolve/main/app/projects/models/notifications.py
- Command line
-
hf download hf://spaces/basyx/MediaRouter/app/projects/models/notifications.py
-
curl -L -o notifications.py https://huggingface.co/spaces/basyx/MediaRouter/resolve/main/app/projects/models/notifications.py
1.16 kB
| from __future__ import annotations | |
| from datetime import datetime | |
| from uuid import uuid4 | |
| from sqlalchemy import String, ForeignKey, Boolean, DateTime, Index, UniqueConstraint | |
| from sqlalchemy.orm import Mapped, mapped_column | |
| from app.security.models import Base, utcnow | |
| class NotificationPreference(Base): | |
| __tablename__ = "notification_preferences" | |
| __table_args__ = ( | |
| UniqueConstraint("workspace_id", "user_id", "event_type", name="uq_notification_preference"), | |
| Index("ix_notification_preferences_workspace_user", "workspace_id", "user_id"), | |
| ) | |
| id: Mapped[str] = mapped_column(String(36), primary_key=True, default=lambda: str(uuid4())) | |
| workspace_id: Mapped[str] = mapped_column(String(36), ForeignKey("workspaces.id", ondelete="CASCADE"), nullable=False) | |
| user_id: Mapped[str] = mapped_column(String(36), ForeignKey("users.id", ondelete="CASCADE"), nullable=False) | |
| event_type: Mapped[str] = mapped_column(String(50), nullable=False) | |
| enabled: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True) | |
| created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False, default=utcnow) | |